Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 21 Sep 2014, 20:19
All times are UTC - 4
 Forum index » Advanced Topics » Puppy Projects » Localization Project
Localizing scripts
Moderators: Lobster, MU, raffy
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 9 of 9 Posts_count   Goto page: Previous 1, 2, 3, ..., 7, 8, 9
Author Message
shinobar


Joined: 28 May 2009
Posts: 2630
Location: Japan

PostPosted: Wed 22 Jul 2009, 01:16    Post_subject: localization of xorgwizard  

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:
#-- 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:
#-- 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

Edited_time_total
Back to top
View user's profile Send_private_message Visit_website 
esmourguit


Joined: 17 Nov 2006
Posts: 1288
Location: Sur l'ile aux oiseaux.

PostPosted: Fri 31 Jul 2009, 02:44    Post_subject:  

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 Wink
chooselocale_Loc.pet
Description 
pet

 Download 
Filename  chooselocale_Loc.pet 
Filesize  4.79 KB 
Downloaded  780 Time(s) 
xorgwizard417-loc.pet
Description 
pet

 Download 
Filename  xorgwizard417-loc.pet 
Filesize  23.48 KB 
Downloaded  739 Time(s) 

_________________
Toutou Linux - Pets francisés
Back to top
View user's profile Send_private_message 
shinobar


Joined: 28 May 2009
Posts: 2630
Location: Japan

PostPosted: Mon 24 Aug 2009, 21:43    Post_subject: xorgwizard revised
Sub_title: around xvidtune revised
 

found bug around xvidtune ....fixed.
fix keyboard model for jp106.
with japanese translation.
xorgwizard423-loc.pet
Description  xorgwizard I18N
pet

 Download 
Filename  xorgwizard423-loc.pet 
Filesize  26.24 KB 
Downloaded  599 Time(s) 
Back to top
View user's profile Send_private_message Visit_website 
ljfr

Joined: 23 Apr 2009
Posts: 176

PostPosted: Thu 22 Oct 2009, 18:27    Post_subject: Script localization  

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,
Back to top
View user's profile Send_private_message 
shinobar


Joined: 28 May 2009
Posts: 2630
Location: Japan

PostPosted: Fri 23 Oct 2009, 08:04    Post_subject: Re: Script localization  

ljfr wrote:

Do you know gettext could be used inside bash script:

Maybe Puppy Linux Chinese version does.
http://puppy.cnbits.com/
Back to top
View user's profile Send_private_message Visit_website 
ljfr

Joined: 23 Apr 2009
Posts: 176

PostPosted: Wed 28 Oct 2009, 14:28    Post_subject: localization with gettext  

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:
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:
echo "Hello world"

becomes:
Code:
echo "`gettext \"Hello world\"`"


2-extract text abstract to be translated:
Code:
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:
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:
È      È     È     È     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/mirroring/bashfaq/098
http://tldp.org/LDP/abs/html/localization.html
http://www.poedit.net
poedit1.png
 Description   
 Filesize   250.76 KB
 Viewed   583 Time(s)

poedit1.png

xorgwizard431-loc.pet
Description 
pet

 Download 
Filename  xorgwizard431-loc.pet 
Filesize  31.12 KB 
Downloaded  583 Time(s) 
Back to top
View user's profile Send_private_message 
esmourguit


Joined: 17 Nov 2006
Posts: 1288
Location: Sur l'ile aux oiseaux.

PostPosted: Mon 02 Nov 2009, 05:46    Post_subject:  

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 Wink
xorgwizard431-loc-bugfixed.pet
Description 
pet

 Download 
Filename  xorgwizard431-loc-bugfixed.pet 
Filesize  33.39 KB 
Downloaded  577 Time(s) 

_________________
Toutou Linux - Pets francisés
Back to top
View user's profile Send_private_message 
ljfr

Joined: 23 Apr 2009
Posts: 176

PostPosted: Tue 08 Dec 2009, 04:44    Post_subject: pootle  

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,
Back to top
View user's profile Send_private_message 
Aitch


Joined: 04 Apr 2007
Posts: 6825
Location: Chatham, Kent, UK

PostPosted: Tue 08 Dec 2009, 21:20    Post_subject:  

ljfr

Pootle looks very useful, thanks

Aitch Smile
Back to top
View user's profile Send_private_message 
shinobar


Joined: 28 May 2009
Posts: 2630
Location: Japan

PostPosted: Fri 25 Dec 2009, 20:24    Post_subject: xorgwizard update  

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

Edited_times_total
Back to top
View user's profile Send_private_message Visit_website 
shinobar


Joined: 28 May 2009
Posts: 2630
Location: Japan

PostPosted: Fri 25 Dec 2009, 22:50    Post_subject: bug in localized xorgwizard  

think all xorgwizard by ljfr, esmourguit and mine do not work.
checking them up.
Back to top
View user's profile Send_private_message Visit_website 
shinobar


Joined: 28 May 2009
Posts: 2630
Location: Japan

PostPosted: Sat 26 Dec 2009, 01:03    Post_subject: bugfixed localized xorgwizard  

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
xorgwizard-091226-2.tar.gz
Description 
gz

 Download 
Filename  xorgwizard-091226-2.tar.gz 
Filesize  20.91 KB 
Downloaded  674 Time(s) 
Back to top
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 9 of 9 Posts_count   Goto page: Previous 1, 2, 3, ..., 7, 8, 9
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Puppy Projects » Localization Project
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0826s ][ Queries: 13 (0.0060s) ][ GZIP on ]