Localizing standard directories, or nautilus .hidden hacks

There has been a interesting discussion about localizing standard directory names for applications on GNOME’s desktop-devel-list. The discussion is under the ‘Call for a Gnome Media Center‘ thread. There is a lot of well meant suggestions about mapping a Music folder to another name.

I don’t think this is a GNOME problem though. This is a desktop problem, a distro problem. Users want their apps and data to work in their language, and those apps come from a lot of projects. No one is happy when a lone app like Firefox, OpenOffice, or Quanta insists that a specific directory name exist. I think we need a concerted effort at freedesktop.org to define how apps locate a standard directory where data is stored. By concerted, I mean settle on a simple standard that can be implement in less than 100 lines of code by the major desktop projects/apps. Distros might want to put some labor behind the effort to see that key apps are updated in time for distro’s next upgrade.

Localization of diretories, is more that just language, it’s the user’s perception of the data. Ubuntu Edgy 6.10 switched to F-Spot for photo management. F-Spot is a great application! I’ve been building it for years now, so I wasn’t put out by making a few changes to it so that it uses my ‘Camera’ directory. My wife Anne was not pleased though. She refused to use it because it wanted her ‘Pictures’ folder renamed to ‘photos’. I think she was taking a pretty draconian position considering the benefits she got by switching to F-Spot. I found a compromise by using a poorly documented feature of nautilus. If you have ever read the source for nautilus (because I’ve never seen a document or announcement about this), you may have come across the ‘.hidden’ file. Nautilus will not display any files or directories listed in a directory’s ‘.hidden’ file. I believe this feature was created in response to a few apps like Java that were littering $HOME with files needed only by developers. Apple’s finder has a similar feature, though I don’t believe it is configurable like Nautilus’. To fix my wife’s desktop I opened the terminal and

ln -s Pictures photos
echo "photos" >> .hidden

F-Spot uses the photos symlink, Anne sees her Pictures. Anne is not a command line user; it might be years for her workout what I’ve done.

This solution could go a long way for GNOME GUI users. It is not good for command line users, and it does require some admin experience to setup and maintain. I suspect a simpler and robust solution would require the app (or platform lib) to check a dot-hidden file that maps standard to locale names. Regardless of how the platform stores is configuration information, the publication of that information must be backward compatible, and easy to implement for older or non-platform apps–hence a dot-hidden file in the $HOME directory. I’m sure the solution is not that simple; some apps cannot handle unicode still.