Page 7 of 7

localization of xorgwizard

Posted: Wed 22 Jul 2009, 05:16
by shinobar
tnx for testing smourguit.

your xorgwizard417-loc.pet works with np as for 2-letter langage codes.
i think the code from MU can be expanded for more precise language selection.

line 38-45 (code from MU)

Code: Select all

#-- simple localization for scripts by MU. Localized JJ Moulinier July 2009
mo=xorgwizard.mo
lng=`echo $LANG | sed "s/\(..\).*/\1/"`
#echo $lng
. "/usr/share/locale/en/LC_MESSAGES/$mo"
if [ -f "/usr/share/locale/$lng/LC_MESSAGES/$mo" ];then
  . "/usr/share/locale/$lng/LC_MESSAGES/$mo"
fi
my code as described before: (the priority between 'en' and 'C' changed on 25 aug)

Code: Select all

#-- simple localization for scripts by Shinobar based on MU.
mo=xorgwizard.mo
# set locale
for lng in C $(echo $LANGUAGE|cut -d':' -f1) $LC_ALL $LANG;do :;done   # ex.    ja_JP.UTF-8
# search locale file
lng1=$(echo $lng|cut -d'.' -f1)      # ex.   ja_JP
lng2=$(echo $lng|cut -d'_' -f1)   # ex.   ja
LOCALEDIR=/usr/share/locale
[ "$mo" ] || mo=$(basename $0).mo
for D in en C $lng2 $lng1 $lng
do
   F="$LOCALEDIR/$D/LC_MESSAGES/$mo"
   [ -f "$F" ] && . "$F"
done

Posted: Fri 31 Jul 2009, 06:44
by esmourguit
Bonjour à tous,
Here are xorgwizard_417 and chooselocale scripts localized (french and english .po files) with shinobar improvements.
Hope B. Kauler will place them in future releases.
Cordialement ;)

xorgwizard revised

Posted: Tue 25 Aug 2009, 01:43
by shinobar
found bug around xvidtune ....fixed.
fix keyboard model for jp106.
with japanese translation.

Script localization

Posted: Thu 22 Oct 2009, 22:27
by ljfr
Hi,

Do you know gettext could be used inside bash script:
http://tldp.org/LDP/abs/html/localization.html
Could this be usefull?

I just tried on simple examples (pure output text and gtkdialog box), and it worked fine.

regards,

Re: Script localization

Posted: Fri 23 Oct 2009, 12:04
by shinobar
ljfr wrote: Do you know gettext could be used inside bash script:
Maybe Puppy Linux Chinese version does.
http://puppy.cnbits.com/

localization with gettext

Posted: Wed 28 Oct 2009, 18:28
by ljfr
Hi,

Regarding the use of gettext, here is a example on Xorgwizard
-localized in french, if you update your "dialog" utility, everything could work fine, otherwise you may have some issue with UTF-8 french characters.

Process applied to build the localized xorgwizard:
1-Modification of /usr/sbin/xorgwizard:
-at the begining of the script insertion of:

Code: Select all

TEXTDOMAINDIR=/usr/share/locale
TEXTDOMAIN=xorgwizard
export TEXTDOMAINDIR
export TEXTDOMAIN
-then every text to be translated is called with gettext,
as in the example:

Code: Select all

echo "Hello world"
becomes:

Code: Select all

echo "`gettext \"Hello world\"`"
2-extract text abstract to be translated:

Code: Select all

xgettext --language=shell -o - /usr/sbin/xorgwizard > ~/xorgwizard.po
3-translate , for that you can edit the po file with your prefered editor.
But you could use any tool specialized for po catalogs such as poedit which can be compiled with gtkspell -with wxwidgets as dependency. poedit also builds the mo file everytime the po file is saved. ... You get a nice GUI, and translation tools.

4-build the mo file from the po file and put it in your language folder:

Code: Select all

msgfmt -o /usr/share/locale/fr/LC_MESSAGES/xorgwizard.mo ~/xorgwizard.po
You will find the resulting pet package in attachment. the po file in the root folder is useless, it's just here for the example.

Note that french special characters are displayed ok,
some were not (uppercase ones),
and the right edge of the "dialog" frame was distorted as reported by maddox,
but updating dialog solved almost all these problem (thanks MU)
- I took the version inside the slackware 12.2 repository, just a
remaining issue with this one

Code: Select all

È   	È  	È  	È  	Capital E-grave

Afterward, if some modifications are made to the script,
you have to extract the new text field in a new file:
xgettext --language=shell -o - /usr/sbin/xorgwizard > ~/xorgwizard.pot
and merge it with your previous translation:
msgmerge --update ~/xorgwizard.po ~/xorgwizard.pot
and you will keep your previous translation inside the po file, plus the
extra fields and notification on modified ones, then you can start again from translation step 3, above.

This is just an example, they are surely few mistakes in it, and I just tried in french, so probably still few issues unmet and then unsolved.


infomation mostly extracted from:
http://bash-hackers.org/wiki/doku.php/m ... ashfaq/098
http://tldp.org/LDP/abs/html/localization.html
http://www.poedit.net

Posted: Mon 02 Nov 2009, 09:46
by esmourguit
Bonjour à tous,
Merci ljfr pour cette bonne nouvelle.
Here is the xorgwizard-loc you've modified with gettext in which i added the pizzasgood's fix.
Cordialement ;)

pootle

Posted: Tue 08 Dec 2009, 08:44
by ljfr
Hi,

Since puppy scripts could be localized with usual po files (see previous post),
regarding standardized translation tools, Pootle could also be usefull: "Pootle is an online translation management tool with translation interface" quoted from http://en.wikipedia.org/wiki/Pootle
on example of pootle server (wordpress):
http://pootle.locamotion.org/projects/wordpress/

regards,

Posted: Wed 09 Dec 2009, 01:20
by Aitch
ljfr

Pootle looks very useful, thanks

Aitch :)

xorgwizard update

Posted: Sat 26 Dec 2009, 00:24
by shinobar
DOES NOT WORK! The attachment removed.
attached xorgwizard using gettext updated, merged with 431JP and quirky-002.

#091119 pizzasgood: patch for multiple monitors.
# 28Oct09 - 17nov09 I18N using gettext by ljfr and esmourguit
#091125 if no Xvesa, do not display dlg that offers to choose it.
# 25dec09 use KBDMODEL, xvidtune, tapping enabled for Synaptics Mouse, from v420JP,v431JP

bug in localized xorgwizard

Posted: Sat 26 Dec 2009, 02:50
by shinobar
think all xorgwizard by ljfr, esmourguit and mine do not work.
checking them up.

bugfixed localized xorgwizard

Posted: Sat 26 Dec 2009, 05:03
by shinobar
shinobar wrote:think all xorgwizard by ljfr, esmourguit and mine do not work.
checking them up.
sorry xorgwizard-091226-1 was missing 'XkbdModel'.
new attached xorgwizard-091226-2 may work.


#091119 pizzasgood: patch for multiple monitors.
# 28Oct09 - 17nov09 I18N using gettext by ljfr and esmourguit
#091125 if no Xvesa, do not display dlg that offers to choose it.
# 25dec09 merge with v420JP,v431JP
# use KBDMODEL, tapping enabled for Synaptics Mouse
# xvidtune message ,Generic_driver dialog label
# 26dec09 bugfix choosexmodedlg using gettext