localizing-shell-scripts-without bashisms, gettext or ...

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

localizing-shell-scripts-without bashisms, gettext or ...

#1 Post by L18L »

Inspired by technosaurus' work on this, see

http://bashismal.blogspot.com/2011/10/l ... thout.html

I have been working on an example just a little bit larger then “hello world
Attachments
t12s_translate.png
That is not really Spanish
but it works
(23.25 KiB) Downloaded 2598 times
t12s.gz
klick to unzip it
and move it to ~/my-applications/bin
or /usr/sbin
(2.14 KiB) Downloaded 938 times
Last edited by L18L on Wed 16 Nov 2011, 20:17, edited 2 times in total.

ferro10n
Posts: 106
Joined: Wed 15 Jun 2011, 20:18
Contact:

#2 Post by ferro10n »

Awesome! :D Do I have to run as fido instead of root to use this?
Also, the screenshot seems to be from Wary 5.2, how about other puppies?
A beginner Puppy Linux user
Intel(R) Celeron(R) CPU 2.13GHz 512MB
LiveCD user

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

#3 Post by L18L »

ferro10n,
thanks for reporting :)

Answering your questions:
1: which puppy
This was made in wary 5.2.190 and should work in all puppies that have yad installed. Test this by entering yad in a console. If 'command not found then' then install yad from repo puppy-common.

2: which user
- To reproduce the screenshot you must run as root.
- To install askpass copy above script into /usr/sbin/askpass (you might copy the original askpass to askpass.orig before)
- To make a translation just start the script t12s. You will be asked for administrator's password if you are not root, and you will requested to enable utf8 if it is disabled.

To test the script completely you must do this as fido or spot.
I have run it in a real console (CTRL-ALT-F2, switch back to X by CTRL-ALT-F4):
login as root, then
su fido
pmount
This will ask for administrator's password using your translation.

Note,
Doing this I have found a small bug in permission of /dev/console.
/dev/console is writable by root only. That is wrong!
Fix it now by:

Code: Select all

chgrp users /dev/console
chmod g+w /dev/console
Looking forward to your translations :)
edited:
start with es only
I will have to make some changes that pt_BR will work too
Attachments
t12s_start.png
(20.46 KiB) Downloaded 2178 times

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

askpass

#4 Post by L18L »

L18L wrote:...
edited:
start with es only
I will have to make some changes that pt_BR will work too
Just apply red marked changes to above /usr/sbin/askpass script
#!/bin/sh
#Barry Kauler 2011, GPL3 (/usr/share/doc/legal)
#specified in /etc/sudoers or /etc/sudo.conf, gui-helper for sudo. (path compiled-in to my sudo PET)
#110513 display name of app that is requesting to run.
#111112 i18n by L18L using Technosaurus' method <smile>
#111114 expanding Technosaurus' method to enable en_AU, pt_BR,...
# /dev/console: write permission for users required !!!

#LANGPATH=/usr/share/locale/${LANG%_*}/askpass #111114
LANGPATH=/usr/share/locale/${LANG%.*}/askpass #111114
[ ! -f $LANGPATH ] && LANGPATH=/usr/share/locale/${LANG%_*}/askpass #111114

[ -f $LANGPATH ] && . $LANGPATH

PSALL="`ps`"

User avatar
shinobar
Posts: 2672
Joined: Thu 28 May 2009, 09:26
Location: Japan
Contact:

Is it easier?

#5 Post by shinobar »

As a conclusion, i do not think it is easier than using gettext.
gettext '.po' file can be edited by text editors. The original message is associated on the 'po' file.
But using the smert tools like poedit is more easier.

The way you discuss is the way MU did and now zigbert do.
There are some traps:
1. locale file path
MU placed the translation files at '/usr/share/locale/LANGAGE_CODE/LC_MESSAGES/APPNAME.mo'.
The place and the extention makes problem because they are not actually '.mo' files.
Zigbert places the translation files at /usr/local/APPNAME/locals with the file name as 'LANGUAGE_CODE:LANGUAGE_NAME'.
Therefore the translation files are here and there, so it takes a bit work to make a collection of NLS.
To place the translation files '/usr/share/locale/LANGAGE_CODE/APPNAME' is nice.

2. incomplete translations
The translation s are not always fully done.
When the programer add new messages, the old translations are lacking the messages.
If some messages are lacking, the program may fail.
Technosaulus proposes 'echo ${VAR:-default message}'. It is a solution but seems complax for me.
Another way is to make a default message file. But the program fails without the default message file.
I prefer to place the default messages at the top of the program. Like;

Code: Select all

VAR="default message"
echo ${VAR}
3. searching path of the translation file from the language code
it can be 'pl' and/or 'pl_BR'.
Here is a code using a default message file, '/usr/share/locale/C/APPNAME':

Code: Select all

LOCALEDIR=/usr/share/locale
LOCALEFILE=$(basename $0)
for D in C ${LANG%_*} ${LANG%.*}; do
  F="$LOCALEDIR/$D/$LOCALEFILE"
  [ -f "$F" ] && . "$F" 
done
4. finding original messages
If the messages are in lines of the program code, it is a hard work to find the original messages to make the translations.
It is a hard work for the programmer if he offers a default messages as a file.
It is a hard work to replace the messages with making the variable names.
The xgettext automatically makes '.po' file with the message id's.
Downloads for Puppy Linux [url]http://shino.pos.to/linux/downloads.html[/url]

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: Is it easier?

#6 Post by L18L »

shinobar,
thanks for your input.

First:
- I like translations
- I like different methods
- I like to use the best available
- I like gettext. It is not out!
shinobar wrote:As a conclusion, i do not think it is easier than using gettext.
The goal is: faster than gettext

First time I was fascinated by speed see
http://murga-linux.com/puppy/viewtopic.php?t=70804 please
shinobar wrote:gettext '.po' file can be edited by text editors. The original message is associated on the 'po' file.
The file '/usr/share/locale/LANGAGE_CODE/APPNAME' can be edited by text editors though without original message. My little GUI ‘t12s’ shows original message at translating. These are taken from a temporary file. No need to save it anywhere!
shinobar wrote:But using the smert tools like poedit is more easier.
Maybe. Let us wait if and how ferro10n will succeed translating to es and pt_BR.

shinobar wrote:The way you discuss is the way MU did and now zigbert do.
Sorry, I do not understand this. But I will try to recomment further.
shinobar wrote:There are some traps:
1. locale file path
MU placed the translation files at '/usr/share/locale/LANGAGE_CODE/LC_MESSAGES/APPNAME.mo'.
The place and the extention makes problem because they are not actually '.mo' files.
That is the very sad truth. [joke]better call them MU[/joke]
shinobar wrote:Zigbert places the translation files at /usr/local/APPNAME/locals with the file name as 'LANGUAGE_CODE:LANGUAGE_NAME'.
Therefore the translation files are here and there, so it takes a bit work to make a collection of NLS.
You know it is more than a bit.

shinobar wrote:To place the translation files '/usr/share/locale/LANGAGE_CODE/>APPNAME' is nice.
To place the translation files '/usr/share/locale/LANGAGE_CODE/APPNAME'
was technosaurus’ idea.
shinobar wrote:2. incomplete translations
The translation s are not always fully done.
When the programer add new messages, the old translations are lacking the messages.
New messages always have to be translated new. Where is the problem? Just work to translate and update.

shinobar wrote:If some messages are lacking, the program may fail.


No. The original English message is shown.

shinobar wrote:Technosaulus proposes 'echo ${VAR:-default message}'. It is a solution but seems complax for me.
Seemed the same to me at the beginning. But using it now it is more than just OK. We all need time to learn new things.

shinobar wrote:Another way is to make a default message file. But the program fails without the default message file.
That is why a default message file is NOT needed, so no fail.

shinobar wrote:I prefer to place the default messages at the top of the program. Like;

Code: Select all

VAR="default message" 
echo ${VAR}
And I prefer to have the message there where it is used.
Simplest example:
echo “$(gettext ’hello worls‘)

User avatar
shinobar
Posts: 2672
Joined: Thu 28 May 2009, 09:26
Location: Japan
Contact:

Re: Is it easier?

#7 Post by shinobar »

L18L wrote:The goal is: faster than gettext
How the

Code: Select all

echo “${_M_x:-hello world}
Downloads for Puppy Linux [url]http://shino.pos.to/linux/downloads.html[/url]

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: Is it easier?

#8 Post by L18L »

shinobar wrote:...
How can it be faster without gettext?
Technosauraus has explained how.
I can only show that it is faster.

Code: Select all

# time echo "$(gettext 'hello world')" 

hello world

real	0m0.014s
user	0m0.016s
sys	0m0.000s

# time echo “${_M_x:-hello world}

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

localizing-shell-scripts-without bashisms, gettext or ...

#9 Post by L18L »

It is fast!

Another script /usr/sbin/alsawizard prepared translated and tested in 1 hour. Here it is:
#!/bin/sh
#Lesser GPL licence v2 (/usr/share/doc/legal/lgpl-2.1.txt). 2007 www.puppylinux.com

#if [ "`/etc/rc.d/rc.alsa status | grep "not loaded"`" = "" ];then
# Xdialog --title "ALSA sound Wizard" --yesno "ALSA sound modules are currently loaded and active.\n
#If you answer Yes here, modules will be unloaded,\nand the Wizard will continue.\nAnswer No, Wizard will exit..." 0 0
# [ ! $? -eq 0 ] && exit
# /etc/rc.d/rc.alsa stop
#fi

#...above not necessary, alsaconf does it.

#100501 weird, nvidia xorg pet pkg seems to need the files created by busybox depmod,
#however alsaconf has been modified to run depmod-FULL. so, rerun busybox depmod after...

#110513 put up a preliminary dlg...
AUDIOICON='/usr/local/lib/X11/mini-icons/mini-speaker.xpm'
[ -f /usr/share/retrovol/images/working.png ] && AUDIOICON='/usr/share/retrovol/images/working.png'
#/usr/local/apps/ROX-Filer/ROX/MIME/audio.png

# <frame THREE: Reboot>
# <text><label>It is unusual, but presuming that you have booted Puppy for the first time, sometimes you have to shutdown (and create a session save-file) and reboot for sound to work. Various peripherals, especially modems, may have conflicting kernel sound driver requirements, which might not get sorted out until the second boot. If you played with the mixer settings but your sound is still not working, it is recommended that you still do not run the ALSA Wizard, instead choose to reboot (see menu). Recommend click 'EXIT' button below.</label></text>
# </frame>

#111116 i18n using _ M _ method L18L
# note, simple quote (') inside message is not allowed, used (´) instead
OUTPUT_CHARSET=UTF-8
export OUTPUT_CHARSET
TEXTDOMAINDIR=/usr/share/locale
TEXTDOMAIN=`basename $0`

LANGPATH=${TEXTDOMAINDIR}/${LANG%.*}/$TEXTDOMAIN
[ ! -f $LANGPATH ] && LANGPATH=${TEXTDOMAINDIR}/${LANG%_*}/$TEXTDOMAIN
[ -f $LANGPATH ] && . $LANGPATH
#

export ASKDIALOG="
<window title=\"${_M_1:-Sound Wizard}\" window_position=\"1\">
<vbox>

<text use-markup=\"true\"><label>\"<big>${_M_11:-Welcome to the Sound Wizard}</big>\"</label></text>
<text><label>${_M_12:-Presumably you are here because your sound does not work? If so, there are things that you should try before running the full ALSA Wizard}</label></text>

<frame ${_M_13:-ONE: Adjust levels}>
<hbox>
<text><label>${_M_14:-Often non-working sound is just a matter of unmuting (tick a checkbox) and/or bring up a level in the audio mixer. Click this button to run the mixer:}</label></text>
<vbox><button><input file>${AUDIOICON}</input><action>/usr/local/bin/defaultaudiomixer & </action></button></vbox>
</hbox>
</frame>

<frame ${_M_2:-TWO: Play test sound}>
<hbox>
<text><label>${_M_21:-Having adjusted the levels, click this button to play a test sound:}</label></text>
<vbox><button><input file>${AUDIOICON}</input><action>/usr/bin/aplay /usr/share/audio/2barks.au & </action></button></vbox>
</hbox>
<hbox>
<text><label>${_M_22:-On some hardware (very rare fortunately) sound plays but does not always stop! If your Puppy will not stop barking, click this button:}</label></text>
<vbox><button><input file>/usr/local/lib/X11/mini-icons/mini-stop.xpm</input><action>/usr/bin/killall aplay</action></button></vbox>
</hbox>
</frame>

<frame ${_M_3:-THREE: Multiple cards}>
<hbox>
<text><label>${_M_31:-Linux may have detected more than one audio interface or ´card´, and has set the wrong one as default. Run Kirk´s Multiple Sound Card Wizard to investigate this (note, a reboot is required for change to take effect):}</label></text>
<vbox><button><input file>${AUDIOICON}</input><action>/usr/bin/Multiple-Sound-Card-Wizard & </action></button></vbox>
</hbox>
</frame>

<text><label>${_M_4:-FOUR: After trying ONE, TWO, THREE above, sound still not working, click ´ALSA Wizard´ button:}</label></text>

<hbox>
<button>
<label>${_M_41:-ALSA Wizard}</label>
<action type=\"exit\">RUNALSA</action>
</button>
<button>
<label>${_M_42:-EXIT}</label>
<action type=\"exit\">EXIT</action>
</button>
</hbox>

</vbox>
</window>
"
RETVAL="`gtkdialog3 --program=ASKDIALOG 2>/dev/null`"
eval "$RETVAL"
[ "$EXIT" != "RUNALSA" ] && exit


#exec rxvt -e /usr/sbin/alsaconf
#rxvt -e /usr/sbin/alsaconf

#/usr/sbin/alsaconf #101015
rxvt -geometry 60x3 -bg orange -e /usr/sbin/alsaconf

#depmod
------------------------------
edited
I have changed
"ALSA Wizard"
to
´ALSA Wizard´
in above script /usr/sbin/alsawizard

----
another edit
add the missing $ in line 33 please. Sorry
Must be:
LANGPATH=${TEXTDOMAINDIR}/${LANG%.*}/$TEXTDOMAIN
Attachments
t12s.gz
move it to
/usr/sbin/t12s (without .gz)
(6.72 KiB) Downloaded 889 times
t12s_alsa.png
translated alsawizard using t12s
(51.48 KiB) Downloaded 2120 times
alsawizard.gz
move it to
/usr/share/locale/de/alsawizard (without .gz)
(1.21 KiB) Downloaded 831 times
Last edited by L18L on Thu 17 Nov 2011, 15:25, edited 2 times in total.

User avatar
shinobar
Posts: 2672
Joined: Thu 28 May 2009, 09:26
Location: Japan
Contact:

Re: Speed

#10 Post by shinobar »

Code: Select all

# time echo "$(gettext 'hello world')" 

hello world

real	0m0.014s
user	0m0.016s
sys	0m0.000s

# time echo “${_M_x:-hello world}
Downloads for Puppy Linux [url]http://shino.pos.to/linux/downloads.html[/url]

ferro10n
Posts: 106
Joined: Wed 15 Jun 2011, 20:18
Contact:

#11 Post by ferro10n »

Unfortunately I'm temporarily unable to full test these method. My computer seems to hate Wary 5.2! Especially trying to log in as fido :shock:

I was able to translate the askpass script, but when I run it I got a white window with a box and a button. I'm still willing to test, for it worked running Wary without save-file. Maybe there's something I didn't do properly.

From a beginner point of view, however, I have to agree with shinobar-san, this method is suitable for a bit more experienced people, and of course for those who aren't having a nightmare with a particular puppy version :lol:
Last edited by ferro10n on Thu 17 Nov 2011, 13:44, edited 1 time in total.
A beginner Puppy Linux user
Intel(R) Celeron(R) CPU 2.13GHz 512MB
LiveCD user

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

still willing to test

#12 Post by L18L »

ferro10n wrote:...
I was able to translate the askpass script, but when I run it I got a white window with a box and a button. I'm still willing to test, for it worked running Wary without save-file. Maybe there's something I didn't do properly.
..
Thank you for reporting and for your good will to continue :D

I agree, askpass might be too complicated for a beginner.

Therefore I suggest:
- Take any recent puppy, install yad if it is not contained.
- copy above t12s (renamed from t12s.gz)
- copy above alsawizard (renamed from alsawizard.gz)
- Start t12s:
-- choose /usr/sbin/alsawizard in first dialog
-- enter es as language in second dialog
-- translate just 1 item and click execute button: you should see this item translated.
...and so on
-- enter pt_BR as language in second dialog
...and so on

Please report:
- which puppy version (if there is a problem I will install it for me to reproduce your problem)
- maybe a screenshot of translated alsawizard?
- send your translation (open /usr/local/share/es/alsawizard in geany then copy and paste into forum post)
- any problems you might have :)

Thanks in advance
L

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: Speed

#13 Post by L18L »

shinobar wrote:...
Ah, you mean that.
...
Some Puppians use old computers...
Some Puppians will use new computers like this one... :)

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#14 Post by technosaurus »

using L18L's naming method, you can quickly autogenerate a template:

Code: Select all

#!/bin/bash
for x in $@ ; do
while read -d$ A || [ "$A" ]; do
case "$A" in
*{_M_*)B=_M${A##*_M};B=${B%%\}*}\";echo ${B//:-/=\"};;
esac
done < $x >$x.i18n
done
usage:
mki18n list of scripts

hmm, even though I used a bashism (read -d) it generates the entire template in less time than gettext takes to do a single translation

... it may be beneficial to change >$x.i18n to |sort -u >$x.i18n if you are planning to use a VAR multiple times
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

ferro10n
Posts: 106
Joined: Wed 15 Jun 2011, 20:18
Contact:

Re: still willing to test

#15 Post by ferro10n »

L18L wrote:
ferro10n wrote:...
I was able to translate the askpass script, but when I run it I got a white window with a box and a button. I'm still willing to test, for it worked running Wary without save-file. Maybe there's something I didn't do properly.
..
Thank you for reporting and for your good will to continue :D

I agree, askpass might be too complicated for a beginner.

Therefore I suggest:
- Take any recent puppy, install yad if it is not contained.
- copy above t12s (renamed from t12s.gz)
- copy above alsawizard (renamed from alsawizard.gz)
- Start t12s:
-- choose /usr/sbin/alsawizard in first dialog
-- enter es as language in second dialog
-- translate just 1 item and click execute button: you should see this item translated.
...and so on
-- enter pt_BR as language in second dialog
...and so on

Please report:
- which puppy version (if there is a problem I will install it for me to reproduce your problem)
- maybe a screenshot of translated alsawizard?
- send your translation (open /usr/local/share/es/alsawizard in geany then copy and paste into forum post)
- any problems you might have :)
Success this time around! Didn't have to change puppy version, it's Wary 5.2 running entirely from RAM. And I learned some German on the way :lol: Now testing pt-BR

Spanish locale generated for ALSA Wizard:

Code: Select all

_M_1="Asistente de Sonido"
_M_11="Bienvenid@ al Asistente de Sonido"
_M_12="Seguramente usted está aquí porque no le funciona el sonido. Si es así, hay cosas que debe probar antes de iniciar el Asistente ALSA completo"
_M_13="UNO: Ajustar niveles"
_M_14="Los problemas de sonido suelen ser cosa de des-silenciar (marcar una casilla) y/o elevar un nivel en el mezclador de audio. Pulse este botón para iniciar el mezclador:"
_M_2="DOS: Reproducir un sonido de prueba"
_M_21="Ajustados los niveles, pulse este botón para reproducir un sonido de prueba:"
_M_22="En algún hardware (muy raro por suerte) ¡el sonido se reproduce pero no siempre se detiene! Si su Puppy no para de ladrar, pulse este botón:"
_M_3="TRES: Tarjetas múltiples"
_M_31="Linux puede detectar más de una interface o ´tarjeta´, y ha ajustado la equivocada como predeterminada. Inicie el Asistente de Tarjetas de Sonido Múltiples de Kirk para investigar (nota, requiere reiniciar para activar el cambio):"
_M_4="CUATRO: Después de probar UNO, DOS, TRES arriba, aún no funciona el sonido, pulse el botón ´Asistente ALSA´:"
_M_41="Asistente ALSA"
_M_42="SALIR"

Attachments
t12s-alsawizard-spanish-full-translation.png
(182.13 KiB) Downloaded 863 times
t12s-alsawizard-spanish-success.png
(171.52 KiB) Downloaded 870 times
A beginner Puppy Linux user
Intel(R) Celeron(R) CPU 2.13GHz 512MB
LiveCD user

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: still willing to test

#16 Post by L18L »

ferro10n wrote:...
Success this time around! Didn't have to change puppy version, it's Wary 5.2 running entirely from RAM. And I learned some German on the way :lol: Now testing pt-BR
...
Don't be disappointed if something will not work with pt_BR
Then this will be my fault.
Be patient with me, I am a slow learner.

Muchas gracias :D :D :D

ferro10n
Posts: 106
Joined: Wed 15 Jun 2011, 20:18
Contact:

#17 Post by ferro10n »

Yeah, I forgot this isn't meant to work with other languages yet :lol: but despite I still saw the GUI in English, the locale for pt_BR was generated the same. I also noticed that when I was asked to select a locale it appeared as 'pt', not pt_BR. I can still test that part, and then Italian and that's all my knowledge. I'm glad to help wherever I can. :D
A beginner Puppy Linux user
Intel(R) Celeron(R) CPU 2.13GHz 512MB
LiveCD user

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

autogenerating

#18 Post by L18L »

technosaurus wrote:using L18L's naming method, you can quickly autogenerate a template:

Code: Select all

#!/bin/bash
for x in $@ ; do
while read -d$ A || [ "$A" ]; do
case "$A" in
*{_M_*)B=_M${A##*_M};B=${B%%\}*}";echo ${B//:-/="};;
esac
done < $x >$x.i18n
done
usage:
mki18n list of scripts

hmm, even though I used a bashism (read -d) it generates the entire template in less time than gettext takes to do a single translation

... it may be beneficial to change >$x.i18n to |sort -u >$x.i18n if you are planning to use a VAR multiple times
Technosaurus,
thank you, much appreciated :D

So this does confirm that we do not need to store English language files? They can be autogenerated very fast!

Having tried to really understand your mki18n I had to run it. :)
and "hacked" this variant:
#!/bin/bash
[ -f all_i18n ] && rm all_i18n # all in one
for x in $@ ; do
while read -d$ A || [ "$A" ]; do
case "$A" in
*{_M_*) B=_M${A##*_M};B=${B%%\}*}";echo ${x}:${B//:-/="};;
esac
done < $x |sort -u >$x.i18n >>all_i18n
done
# time mki18n askpass alsawizard

real 0m0.213s
user 0m0.076s
sys 0m0.024s
#

Stuff for thoughts...

Naming method
(for the record) _M_
short, unique, restricted to letters and underscore, easy to grep

Location of language files
Maybe a directory of their own is better?
M under /usr/share/locale/<language>
LANGPATH would become 2 bytes longer
But anything inside is _M_ method

I am thinking that "all in one" can be helpful for our PuppyMaster.
GUI: search a word and get all phrases containing this word
and maybe use an existing phrase in a new script...
...if so then 1 translation less

Or using just one language file for all the basic Puppy scripts...

The locale is really only needed when using date, time, currency..
Not for "just language"

I know that you know it (reminding your example of de_JA :D )

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

#19 Post by L18L »

ferro10n wrote:Yeah, I forgot this isn't meant to work with other languages yet :lol: but despite I still saw the GUI in English, the locale for pt_BR was generated the same. I also noticed that when I was asked to select a locale it appeared as 'pt', not pt_BR. I can still test that part, and then Italian and that's all my knowledge. I'm glad to help wherever I can. :D
Yes, this is Cutting Edge
I am working on pt_BR...or generally enabling "regional variants"

I will make versions (not soon, maybe tomorrow) and post on page 1 (that is the way one should do it from beginning :oops: )

Thank you and good night (it is late here in Europe now)
:)

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#20 Post by technosaurus »

I am posting from my Droid so the following syntax will be "off"

[ -f /.../$LANG/app ] && LOCALES=/.../$LANG/app ¦¦ [ -f /.../${LANG%%_*} ] && LOCALES=/.../${LANG%%_*}
. $LOCALES

Edit: haven't tested above because I was doing this:

Code: Select all

curl -A firefox \
  -F "file=@trans.txt;type=text/plain" \
  -F "sl=en" \
  -F "tl=es" \
  http://translate.googleusercontent.com/translate_f | while read A || [ "$A" ]; do
    case $A in 
      "<meta"*)continue;;
      *"<pre>"*)echo ${A##*"<pre>"};;
      *"</pre>"*)echo ${A%%"</pre>"*};;
      *)echo $A;;
    esac
  done
replace trans.txt with your english file and tl=es with tl=??
where ?? is
  • es>Spanish
    yi>Yiddish
    cy>Welsh
    separator disabled>—
    af>Afrikaans
    sq>Albanian
    ar>Arabic
    hy>Armenian
    az>Azerbaijani
    eu>Basque
    be>Belarusian
    bn>Bengali
    bg>Bulgarian
    ca>Catalan
    zh-CN>Chinese(Simplified)
    zh-TW>Chinese(Traditional)
    hr>Croatian
    cs>Czech
    da>Danish
    nl>Dutch
    en>English
    et>Estonian
    tl>Filipino
    fi>Finnish
    fr>French
    gl>Galician
    ka>Georgian
    de>German
    el>Greek
    gu>Gujarati
    ht>Haitian
    Creole
    iw>Hebrew
    hi>Hindi
    hu>Hungarian
    is>Icelandic
    id>Indonesian
    ga>Irish
    it>Italian
    ja>Japanese
    kn>Kannada
    ko>Korean
    la>Latin
    lv>Latvian
    lt>Lithuanian
    mk>Macedonian
    ms>Malay
    mt>Maltese
    no>Norwegian
    fa>Persian
    pl>Polish
    pt>Portuguese
    ro>Romanian
    ru>Russian
    sr>Serbian
    sk>Slovak
    sl>Slovenian
    es>Spanish
    sw>Swahili
    sv>Swedish
    ta>Tamil
    te>Telugu
    th>Thai
    tr>Turkish
    uk>Ukrainian
    ur>Urdu
    vi>Vietnamese
    cy>Welsh
    yi>Yiddish
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Post Reply