Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Switching languages per user and "cascading" translations

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
cupakm
Posts: 5
Joined: 2018-07-17 05:58

Switching languages per user and "cascading" translations

#1 Post by cupakm »

HI all,

I have recently moved from Ubuntu to Debian and have problems setting languages per user. I've tried changing the LANG env-var in .profile and .bashrc and have "nice" output of the locale command (showing all changed how I want it), but there are still only a few string / messages translated. The translation appears to be very partial, in comparison with the same DE (in my case XFCE) and common apps (browsers, LibreOffice, etc.) in Ubuntu. Why?
How can I change language per user for terminal, desktop environment and all applications?

In Ubuntu, there is a language pack manager which can install packages for several languages (I've tried to install multiple locales on Debian) and it is possible to prioritize them and achieve a sort of "cascaded" translation, i.e. if some message is not translated in language #1, it looks up translation in language #2, then #3, etc. with a fallback into English if no translation was found in any languages with higher priority. This is very useful to do with mutually intelligible languages. How can I achieve similar behavior in Debian?

Many thanks in advance for your suggestions.

arzgi
Posts: 1183
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 31 times

Re: Switching languages per user and "cascading" translation

#2 Post by arzgi »

cupakm wrote:HI all,

I have recently moved from Ubuntu to Debian and have problems setting languages per user. I've tried changing the LANG env-var in .profile and .bashrc and have "nice" output of the locale command (showing all changed how I want it), but there are still only a few string / messages translated. The translation appears to be very partial, in comparison with the same DE (in my case XFCE) and common apps (browsers, LibreOffice, etc.) in Ubuntu. Why?
How can I change language per user for terminal, desktop environment and all applications?

In Ubuntu, there is a language pack manager which can install packages for several languages (I've tried to install multiple locales on Debian) and it is possible to prioritize them and achieve a sort of "cascaded" translation, i.e. if some message is not translated in language #1, it looks up translation in language #2, then #3, etc. with a fallback into English if no translation was found in any languages with higher priority. This is very useful to do with mutually intelligible languages. How can I achieve similar behavior in Debian?

Many thanks in advance for your suggestions.
From man locale:

Code: Select all

The following example compiles a custom locale from the ./wrk directory
       with  the  localedef(1) utility under the $HOME/.locale directory, then
       tests the result with the date(1) command, and then sets  the  environ‐
       ment  variables  LOCPATH and LANG in the shell profile file so that the
       custom locale will be used in the subsequent user sessions:

       $ mkdir -p $HOME/.locale
       $ I18NPATH=./wrk/ localedef -f UTF-8 -i fi_SE $HOME/.locale/fi_SE.UTF-8
       $ LOCPATH=$HOME/.locale LC_ALL=fi_SE.UTF-8 date
       $ echo "export LOCPATH=\$HOME/.locale" >> $HOME/.bashrc
       $ echo "export LANG=fi_SE.UTF-8" >> $HOME/.bashrc
I hope that helps. Debian is not Ubuntu, so maybe you can't get perfectly equal solution.

This question has been asked a few times here, it is good habit to search before posting.

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Switching languages per user and "cascading" translation

#3 Post by debiman »

op's second question doesn't seem to have been answered at all, and i have never seen it on any forum.
i didn't know something like this was possible at all; i thought english was always the fallback language for partial translations.

User avatar
johnraff
Posts: 2
Joined: 2011-02-16 15:19

Re: Switching languages per user and "cascading" translation

#4 Post by johnraff »

cupakm wrote:...multiple locales on Debian) and it is possible to prioritize them and achieve a sort of "cascaded" translation, i.e. if some message is not translated in language #1, it looks up translation in language #2, then #3, etc. with a fallback into English if no translation was found in any languages with higher priority.
The LANGUAGE environment variable supports this, with alternatives separated by colons. There are many places you might set this, but for example, in ~/.xsessionrc:

Code: Select all

export LANGUAGE=ja_JP:it_IT:en
will display messages in Japanese, or failing that Italian, finally falling back to any variety of English (Which I think is the default anyway). I've never actually tried this though...

cupakm
Posts: 5
Joined: 2018-07-17 05:58

Re: Switching languages per user and "cascading" translation

#5 Post by cupakm »

johnraff wrote:The LANGUAGE environment variable supports this, with alternatives separated by colons.
Thanks! That was exactly what I was looking for!

Post Reply