Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I change the text direction in gnome-shell back and forth between right-to-left and left-to-right?

(Mine is in left-to-right. I have tried changing the language to Chinese (using the "Region and Language" settings widget) which I believe does right-to-left. Upon logging out and back in, the shell still appeared left to right. Do I need to do something else like set a keyboard layout to cause RTL ??).

share|improve this question
    
Could explain more? you want to flip GUI for the whole desktop as RTL or just just some needed application, or just make cursor as RTL language input in textbox it start from right, moving to left or some thing else. As I know Chinese is direction independent, I suppose it is configured as LTR. –  Sneetsher Mar 22 at 17:54
1  
gnome-shell has a RTL setting it checks upon which it rearranges the entire desktop to be right-to-left (instead of the dash being on the left, it is on the right, etc). I'm attempting to set whatever setting gnome-shell is querying. –  mathematical.coffee Mar 22 at 23:08
add comment

1 Answer 1

up vote 1 down vote accepted

Gnome as all GTK application, its RTL switch comes from locale definition and it's tight coded. So you have to change to RTL locale/language. If that locale is not installed GUI will be flipped but text/labels/menu will fall-back to the original language (English in most cases) with warning message:

Gtk-WARNING **: Locale not supported by C library.
    Using the fallback 'C' locale.

As I know Chinese is direction independent, I suppose it is configured as LTR. So it is better to look pure RTL locales like Arabic, Hebrew, Persian ...

To change setting for Unity or Gnome Sessions/Desktop

  • To change global settings /etc/default/locale, Example (ar_DZ, Arabic_Algeria):

    LANGUAGE=ar
    LANG=ar_DZ.UTF-8
    

    Need to logout

  • To change only user setting ~/.pam_environment

    LANGUAGE=ar
    LANG=ar_DZ.UTF-8
    

    Need to logout

Another way, If you want to flip GUI or switch locale/language for just one application:

  • Open terminal Ctrl+Alt+t
  • Run it with LANG=ar_DZ.UTF-8 or LANGUAGE=ar_DZ.UTF-8, try both of them not all application use same env variable:

    LANGUAGE=ar_DZ.UTF-8 evince
    LANG=ar_DZ.UTF-8 okular
    

Qt applications have a separated RTL switch -reverse which could be used without language change. Example:

qv4l2 -reverse

Now, If your language is not English and you want to use RTL flipped interface with it. There is a trick, you may test it:

  • Generate new locale as variation of an RTL language, example:

    sudo locale-gen ar_YY.UTF-8
    sudo dpkg-reconfigure locales
    
  • Copy your language translation (of gettext) files to new locale folder. As example French.

    sudo cp -r /usr/local/share/locale/fr /usr/local/share/locale/ar_YY
    
  • Not all application put their locales in /usr/local/share/locale/. If you face such case, you may look where all locale files:

    locate /locale/fr
    

References:

share|improve this answer
    
Thanks for the detailed answer (I have yet to try to confirm). –  mathematical.coffee Mar 31 at 0:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.