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 Wed 23 Jul 2014, 02:07
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 1 of 9 [132 Posts]   Goto page: 1, 2, 3, ..., 7, 8, 9 Next
Author Message
droope


Joined: 31 Jul 2008
Posts: 814
Location: Uruguay, Mercedes

PostPosted: Wed 04 Feb 2009, 10:48    Post subject:  Localizing scripts
Subject description: To make them translate-able. (is that correct? :|)
 

Hi people,

I am going to bother you all again on this same issue, only that now in a separate thread.
The intention of this proyect, is, that before version 4.2 is launched, we can have all scripts fetch language files from a directory. (As done here)


Progress done:
Connect wizard (updated droope's corrected version)
Xwin
XorgWizard (Updated to Mu's corrected version)
Remasterpup2
Chooselocale
Bootmanager
Cups Shell
Petget.
Applications directory localized

Outdated
Updated 18/03/09. Smile

Last edited by droope on Thu 14 May 2009, 20:56; edited 5 times in total
Back to top
View user's profile Send private message 
esmourguit


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

PostPosted: Thu 05 Feb 2009, 12:50    Post subject:  

Bonjour,

I tried to localize xorgwizard how did Mu for a test. But it does not work.
As soon as I brought this:

Quote:
#-- simple localization for scripts by MU
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


The script would not work.
The beginnings are difficult.
Cordialement Wink

_________________
Toutou Linux - Pets francisés
Back to top
View user's profile Send private message 
droope


Joined: 31 Jul 2008
Posts: 814
Location: Uruguay, Mercedes

PostPosted: Thu 05 Feb 2009, 17:43    Post subject:  

That's interesting, but, i don't think it will be that easy, i mean, you have to create the file first, and modify the Script's text variables to be looked for in the text file,


I GUESS... LOL.

Maybe we can try and do this, what do you think?

Yes!

Check this

Mu's version of some output:
Quote:

<hbox spacing=\"10\">
<text use-markup=\"true\"><label>\"<b>$LINTERFACE</b>
$INTERFACE_INTERFACE\"</label></text>
<text use-markup=\"true\"><label>\"<b>$TYPE</b>
$INTERFACE_INTTYPE\"</label></text>
<text use-markup=\"true\"><label>\"<b>$MODULE</b>
$INTERFACE_FI_DRIVER\"</label></text>
<text use-markup=\"true\"><label>\"<b>$BUS</b>
$INTERFACE_BUS\"</label></text>
<text use-markup=\"true\"><label>\"<b>$DESCRIPTION</b>
$INTERFACE_INFO\"</label></text>
</hbox>




Idon'tknowwhos:
Quote:
<hbox spacing=\"10\">
<text use-markup=\"true\"><label>\"<b>Interface</b>
$INTERFACE_INTERFACE\"</label></text>
<text use-markup=\"true\"><label>\"<b>Type</b>
$INTERFACE_INTTYPE\"</label></text>
<text use-markup=\"true\"><label>\"<b>Module</b>
$INTERFACE_FI_DRIVER\"</label></text>
<text use-markup=\"true\"><label>\"<b>Bus</b>
$INTERFACE_BUS\"</label></text>
<text use-markup=\"true\"><label>\"<b>Description</b>
$INTERFACE_INFO\"</label></text>
</hbox>


I would like to know if anyone knows of a program that'd let me to know the exact diferences between a file and another. It would save a lot of work for me.
Back to top
View user's profile Send private message 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Thu 05 Feb 2009, 18:26    Post subject:  

Quote:
The script would not work.


Not enough info Wink
If you run it in a console, you usually get error-messages.
You should paste them here.

Or start with a new script.

Code:
#!/bin/bash
#-- simple localization for scripts by MU
mo=mytest.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

echo "${L_TEST}"


save it as "/usr/bin/mytest".
Make it executable:
chmod 755 /usr/bin/mytest

Then create 2 localized files:
/usr/share/locale/en/LC_MESSAGES/mytest.mo

Code:
L_TEST="hello world!"


/usr/share/locale/fr/LC_MESSAGES/mytest.mo

Code:
L_TEST="salut monde!"


The best will be to create them in leafpad.
To save them, choose "save as" and activate the charactercoding "UTF-8" in the "save as" dialog.

Then test it:
export LANG=en_US.utf8
mytest
export LANG=fr_FR.utf8
mytest


This should print:
hello world1
salut monde!


Mark

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Thu 05 Feb 2009, 18:40    Post subject:  

To compare files:
from Puppy 3:
gtkdiff-0.7.0
But it requires to install also Gtk 1.2 and Glib 1.2.

Maybe someone posted also a pet for a "diff" program, that has less dependencies.

Or use the console:
diff --help

Mark

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
droope


Joined: 31 Jul 2008
Posts: 814
Location: Uruguay, Mercedes

PostPosted: Thu 05 Feb 2009, 19:10    Post subject:  

MU wrote:
Quote:
The script would not work.


Not enough info Wink
If you run it in a console, you usually get error-messages.
You should paste them here.

Or start with a new script.

Code:
#!/bin/bash
#-- simple localization for scripts by MU
mo=mytest.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

echo "${L_TEST}"


save it as "/usr/bin/mytest".
Make it executable:
chmod 755 /usr/bin/mytest

Then create 2 localized files:
/usr/share/locale/en/LC_MESSAGES/mytest.mo

Code:
L_TEST="hello world!"


/usr/share/locale/fr/LC_MESSAGES/mytest.mo

Code:
L_TEST="salut monde!"


The best will be to create them in leafpad.
To save them, choose "save as" and activate the charactercoding "UTF-8" in the "save as" dialog.

Then test it:
export LANG=en_US.utf8
mytest
export LANG=fr_FR.utf8
mytest


This should print:
hello world1
salut monde!


Mark


Why are you using "L_TEST="salut monde!"" in the mo and mytest in the code? I'll try to do an example as you did.
Back to top
View user's profile Send private message 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Thu 05 Feb 2009, 19:20    Post subject:  

mytest is the filename.

simplified:
Code:
mo=mytest.mo
. "/usr/share/locale/en/LC_MESSAGES/$mo"


So the script will "source" (the . means to read a file) this languagefile:
/usr/share/locale/en/LC_MESSAGES/mytest.mo

In mytest.mo you define the variable L_TEST.
It will be good practice, to start localized variables with "L_", so that they can easily be found in a script. I did not do that in my first scripts, and later it was hard, to find them again.
Code:
L_TEST="hello world!"


Then in your script, this variable is available too, as it was just "sourced" from the languagefile.
So you can print it now:
Code:
echo "${L_TEST}"



Sidenote:
I use ${L_TEST} and not $L_TEST, as like this, it can be put in other words.
works not:
echo "$L_TESTis my first test."
works:
echo "${L_TEST}is my first test."

Mark

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
droope


Joined: 31 Jul 2008
Posts: 814
Location: Uruguay, Mercedes

PostPosted: Thu 05 Feb 2009, 21:25    Post subject:  

Thank you, this post has helped a lot.

I was thinking of using what you localized so as not to waste effort. So i thought I could compare the version you localized (before localization) and current version, but I need you to tell me exactly which version it is you translated, so as not to make the script any older by accident.

After you and the current developers of scripts answer, I should be able to start working. It shouldn't be a lot of work, i think.

DOn't know if the scripts have changed a lot, tho.
Back to top
View user's profile Send private message 
HairyWill


Joined: 26 May 2006
Posts: 2949
Location: Southampton, UK

PostPosted: Fri 06 Feb 2009, 01:29    Post subject:  

to compare files on the command line use
diff file1 file2
puppy 4 contains the graphical diff program xfdiff in the utility menu, I usually start it from the prompt, ie
xfdiff file1 file2

_________________
Will
contribute: community website, screenshots, puplets, wiki, rss
Back to top
View user's profile Send private message 
esmourguit


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

PostPosted: Fri 06 Feb 2009, 03:49    Post subject:  

Bonjour,

Sorry for the inconvenience, but in fact it was missing the file /usr/share/locale/en/LC_MESSAGES/xorgwizard.mo. But not sure it was the issue.
Then it works.
Attached file xorgwizard4.2-localized and connectwizard-420loc for test and english and french files

Cordialement Wink
connectwizard-420Loc.tar.gz
Description 
gz

 Download 
Filename  connectwizard-420Loc.tar.gz 
Filesize  3.07 KB 
Downloaded  750 Time(s) 
xorgwizard4.2-localized.tar.gz
Description 
gz

 Download 
Filename  xorgwizard4.2-localized.tar.gz 
Filesize  20.03 KB 
Downloaded  615 Time(s) 

_________________
Toutou Linux - Pets francisés

Last edited by esmourguit on Mon 23 Feb 2009, 03:50; edited 2 times in total
Back to top
View user's profile Send private message 
droope


Joined: 31 Jul 2008
Posts: 814
Location: Uruguay, Mercedes

PostPosted: Fri 06 Feb 2009, 13:58    Post subject:  

I am testing it, the only issue until now, it's that in the name of the window, when using EN locales, i get Assistant de conexion, or something similar.

I think the problem is in the .mo, tho.

I will try to localize it in french, and if it works, i'll translate it into spanish. Smile As soon as we have all scripts set up on 4.2.

This should be included on 4.2, do you want me to tell whodo?

We should send him one or a few MP's Razz So as not to lose localizated scripts again.

Edit: It's not working Sad I chose fr_BR, is that correct?
Is it fully localized?
Back to top
View user's profile Send private message 
esmourguit


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

PostPosted: Sat 07 Feb 2009, 06:22    Post subject:  

Bonjour,
No it is not completely localized. I is just a test.
The french locale is fr_FR
But there is an issue in xorgwizard4.2-loc, line 777.
Quote:
echo ' --no-collapse --title "Puppy Video Wizard" --ok-label "OK" --extra-label "TEST" --cancel-label "EXIT" --menu "$choosevideomode

it doesn't show the "choosevideomode" text. I don't know why. Maybe MU could help us.
Cordialement Wink

_________________
Toutou Linux - Pets francisés
Back to top
View user's profile Send private message 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Sat 07 Feb 2009, 08:02    Post subject:  

esmourguit wrote:
Bonjour,
No it is not completely localized. I is just a test.
The french locale is fr_FR
But there is an issue in xorgwizard4.2-loc, line 777.
Quote:
echo ' --no-collapse --title "Puppy Video Wizard" --ok-label "OK" --extra-label "TEST" --cancel-label "EXIT" --menu "$choosevideomode

it doesn't show the "choosevideomode" text. I don't know why. Maybe MU could help us.
Cordialement Wink


It seems, I had made the same mistake in Muppy with the old translated xorgwizard.
You might need this syntax:

Code:
echo " --no-collapse --title \"Puppy Video Wizard\" --ok-label \"OK\" --extra-label \"TEST\" --cancel-label \"EXIT\" --menu \"$choosevideomode
" >> /tmp/choosexmodedlg


The reason is, that a variable in single quotes is not resolved.
Try this in a console to see the difference:
Code:
a=test
echo "$a"
echo '$a'


With replacing ' with ", also the " within that quote must be replaced with \"

Mark

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
esmourguit


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

PostPosted: Sat 07 Feb 2009, 10:57    Post subject:  

Bonjour,
Thank you Mark for your help. Now it works.
Here the dotpet whith the french locale files for test.
Cordialement Wink
xorgwizard-loc-4.2.pet
Description 
pet

 Download 
Filename  xorgwizard-loc-4.2.pet 
Filesize  59.5 KB 
Downloaded  612 Time(s) 

_________________
Toutou Linux - Pets francisés
Back to top
View user's profile Send private message 
maddox

Joined: 28 Sep 2007
Posts: 453
Location: sometimes in France

PostPosted: Sat 07 Feb 2009, 17:25    Post subject:
Subject description: Puppy 4.2 localizing questions
 

Hi all,
Hope I posted this in the correct Topic.

It's really great news to see an effort to localize Puppy scripts.
If I may, I've got a few questions concerning gettext (po files), translation and puppy 4.2.

1: If Puppy is going to be completely translated, i.e. all scripts will use gettext and po files,
Could there be a problem, kernel or other wise, using so many extra variables for translation (a limit to the nber of variables used) and also could this impact Puppy's performance ?
... Some scripts use over a 100 translation variables and might call other scripts with extra translation variables.
performance drop i.e : .. number of translation variables and parsing the po file(s) to find the correct variable entry.

2: Has the community set-up any standard rules/guidelines to localise variables in a script : i.e preset variable names inside scripts or rules to define the variable names for translation.
.. There doesn't seem to be any real consistancy in the variable naming process.
frame -> $frame1 and in a completely different hbox/vbox $frame2 .. I can elaborate a bit more if needed.

3: What do you do about a Title, Label, Button or other forgotten bits that have no translation in a script ?
i.e. <button OK> or button cancel or Title ...dialup modem, MB/KB to Mo/Ko ..
Do we change the english script and submit the english modification.. but then, where to post the proposed change ?

4: Can All the text messages be translated with a po file in any script ? (except of course initrd.gz : language specific manual translation must be done)
i.e... echo "blabla" > /dev/console or echo "blabla" > 2&1
and indirectly, does X have to be running for gettext to work ?

Translation part:
5: Has anybody found an equivalent to yaf-splash ?
As it only correctly displays english characters, no matter what the encoding used.

6: Dialog doesn't seem to like accents -> shutdown/save script and others
The displayed box has holes punched in it using accents (incorrectly displayed) and the right edge is completely distorted.

7: From what I understand, the Puppy 4.2 will keep to UTF-8 encoding for scripts,
but then, we (French Toutou 4.1.2 ) had to encode some scripts into ISO-8859-1 for them to display the accents correctly.
MU kindly gave us a partial solution, his gxmessage and the switch "-encoding UTF-8", thanks MU.

The info I've found about UTF-8 is that english characters are 1 byte encoded and french characters are 2 byte encoded
Using the ISO-8859-1 encoding the french characters are 1 byte encoded.
This makes it difficult for us and probally others : we have to test each script and if necessary modify the script and adapt the encoding accordingly.

Sorry about the mostly questions post and the numerous edits.

Thanks in advance to all the worldwide puppy users.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 9 [132 Posts]   Goto page: 1, 2, 3, ..., 7, 8, 9 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Puppy Projects » Localization Project
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


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