Bug 14367

Summary: xdg-utils should provide a standard way for accessing localized through xdg-usr-dirs user directories
Product: Portland Reporter: Konstantinos Togias <ktogias>
Component: xdg-utilsAssignee: Portland Bugs <portland-bugs>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium CC: simos.bugzilla
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: xdg-cd shell script for changing to localized user dirs giving their original english name

Description Konstantinos Togias 2008-02-04 05:12:01 UTC
Created attachment 14136 [details]
xdg-cd shell script for changing to localized user dirs giving their original english name

As I found out using ubuntu 7.10 with Greek local user dirs (Desktop, Documents, etc) are renamed to greek equivalent names (eg. Επιφάνεια Εργασίας, Έγγραφα, etc). Although most applications can access those localized dirs through XDG_.*_DIR XDG environment variables, there is not a standard/uniform/trivial way for the user to access them through console. 

The greek (or any other non-latin language) directory names may be pleasant when using the GUI but cause problems when trying to access them (eg. change to) from console, or terminal. The most trivial inconvenience is thet one has to switch the keyboard layout to greek in order to type the localized dir name and then back to latin in order to continue typing the command. Furthermore, localized dirs can be completely inaccessible when working form a console where the proper keyboard layout switching is not set up, and/or the font is not capable for displaying greek characters or the system does not use unicode. The above issues raise frequently when using plain console (no X), or accessing a localized machine remotely through ssh, telnet, ftp from an other system that is not set up for greek. It also hinders users of localized machines to get help or follow howtos in english that suggest using terminal commands that involve accessing some of the folders that are localized. (eg. the directions: "Download through firefox this_link, open a terminal and type cd Desktop && sh this_file" will fail because the DOWNLOAD directory is not named Desktop but Επιφάνεια Εργασίας at the user's system.)

For the reasons above I think that it would be useful to have a script (or make cd xdg aware???) that would allow changing to user dirs using the default english names whether those dirs are localized or not. As an example/proposition I attach a small shell script I have written that creates a command named "xdg-cd". xdg-cd functions as following:

The user can change from everywhere in the filesystem to the ~/Desktop equivalent directory with:

$ xdg-cd Desktop

For example, if xdg-dirs are set to greek the above command is equivalent to this:

$ cd ~/Επιφάνεια\ Εργασίας

but with xdg-cd you don't have to switch layout and type greek characters. You don't even care how Desktop dir is named in greek or if the system is set up to greek or Japanese or any other layout. You just type xdg-cd Desktop and you are taken to your Desktop dir. The xdg-cd command works similarly for the other user dirs (Download, Documents, Music, etc). I think that such functionality should be added to xdg-utils in order to have a standard way to access localized user dirs regardless of the language to which they are translated. 

In order to try the attached script put the attached file somewhere (eg.in  ~/.xdg/) and add the following line to your ~/.bashrc :

alias xdg-cd='source ~/.xdg/xdg-cd'

Then open a new terminal or log in again, and you will be able to use xdg-cd command as described above.
Comment 1 GitLab Migration User 2019-02-16 13:28:58 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdg-utils/issues/23.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.