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.

I need to provide to my users a localized text file that would open (from a desktop icon) in the language that gnome is running. How I do that ?

I am running Lucid Ubuntu

Thanks !!

share|improve this question
    
10.04? It is supported, but I would seriously upgrade to a better version. –  nerof61 Feb 22 '13 at 11:22
1  
@nerof61 : this is a specific system with specific hardware. Not my desktop OS :) –  martin-mystere Feb 22 '13 at 11:53
add comment

1 Answer

up vote 6 down vote accepted

You probably want to check the value of the LANG environment variable:

user@host:~$ echo $LANG
en_GB.UTF-8

You can then write a short script which picks an appropriate file based on the value of this:

#!/bin/bash
SHORTLANG=${LANG:0:2}
zenity --text-info --filename greeting_${SHORTLANG}.txt

Which takes the first two characters of $LANG and displays the appropriate textfile - greeting_en.txt etc.

Finally, create a desktop link to this script.

(Adjust the length of the SHORTLANG string if you're interested in the difference between en_GB and en_US rather than just the difference between fr and de).

share|improve this answer
    
That will to the trick. Thanks ! –  martin-mystere Feb 22 '13 at 14:08
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.