Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internationalization #2

Open
luzpaz opened this issue Jun 13, 2014 · 11 comments
Open

Internationalization #2

luzpaz opened this issue Jun 13, 2014 · 11 comments

Comments

@luzpaz
Copy link
Contributor

luzpaz commented Jun 13, 2014

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

@JLuc
Copy link
Owner

JLuc commented Jun 13, 2014

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
Copy link
Contributor Author

luzpaz commented Jun 13, 2014

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

@JLuc
Copy link
Owner

JLuc commented Jun 13, 2014

Alternative could be using variables

  • recognize environnement language
  • at the begining of the file have :
    if lang = fr
    set messageid1 = bonjour à tous
    set messageid2 = Oh la la
    ...
    else if lang=de
    set messageid1 = Hallo Feunde
    set messageid2 = Ach quatsch
    else
    set messageid1 = hello world
    set messageid2 = woaow
    ...
  • use the variables where needed :
    echo messageid1
    ...

@JLuc
Copy link
Owner

JLuc commented Jun 15, 2014

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
Copy link
Contributor Author

luzpaz commented Jun 18, 2014

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

@JLuc
Copy link
Owner

JLuc commented Jun 18, 2014

$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
Copy link
Contributor Author

luzpaz commented Jun 18, 2014

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

@JLuc
Copy link
Owner

JLuc commented Jun 19, 2014

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

@luzpaz
Copy link
Contributor Author

luzpaz commented Jun 19, 2014

Ok

$ echo $LANG
en_US.UTF-8

@luzpaz
Copy link
Contributor Author

luzpaz commented Jun 19, 2014

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

@JLuc
Copy link
Owner

JLuc commented Jun 27, 2014

its now in english

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants