JLuc / makscribus

scripts to make and install scribus
GNU General Public License v2.0
1 stars 0 forks source link

Internationalization #2

Open luzpaz opened 10 years ago

luzpaz commented 10 years ago

Is this the direction we want to go in? http://www.linuxjournal.com/content/internationalizing-those-bash-scripts

JLuc commented 10 years ago

Hmm interesting but that's a bit overkill. Better stick to one file only when possible. Easiest would be to have all in english only of course.

luzpaz commented 10 years ago

is there a simpler way to do it than that methodology ?

JLuc commented 10 years ago

Alternative could be using variables

JLuc commented 10 years ago

I began something like this

if [[ "${LANGUAGE:0:2}" == 'fr' ]]
then
txt_jumptostart="Hop, allons vers ~/dev/scribus"
txt_help="
usage : maksvn [-h]ou[-?] [-d]ou[clean] [-nomaj] [diff [dest]]
met à jour le source svn de scribus 1.5 et compile
=== OPTIONS ====================
-h ou -? : affiche cette aide
-d ou clean : efface d'abord les bin et objs déjà là
-nomaj : pas de mise à jour svn
-diff ou diff  : crée le fichier de diff dans dest.diff si dest est précisé (dans svnhead.diff sinon)
=== INFOS ======================
"
txt_diffdest="ok on va mettre le diff dans "
txt_diffdel="Effacement de "
fi
luzpaz commented 10 years ago

What does ${LANGUAGE:0:2} mean? (specifically the ':0:2')

JLuc commented 10 years ago

$LANGUAGE is fr_CA:fr_FR on my session ${LANGUAGE:0:2} is 'fr' on my session (= 2 letters starting at position 0) and will probably be 'en' on some session with english local language Have a try : echo ${LANGUAGE:0:2} There are variants : $LANG for the variable... and other shell syntax to get these 2 letters.

luzpaz commented 10 years ago

Doesn't work in OS X. But I get it :)

JLuc commented 10 years ago

Some shell might not know that syntax. Got to use widely spread syntax. What shell is yours ?

luzpaz commented 10 years ago

Ok

$ echo $LANG
en_US.UTF-8
luzpaz commented 10 years ago

so should we make a part of the script to recognize locale ? or just give the user an option ?

JLuc commented 10 years ago

its now in english