Author |
Message |
MU

Joined: 24 Aug 2005 Posts: 13648 Location: Karlsruhe, Germany
|
Posted: Wed 10 May 2006, 01:57 Post subject:
Discussion: translating Puppys System-tools |
|
This is difficult.
A program like Gnumeric can easily be localized, for 2 reasons:
1. the lanuage is stored in external gnumeric.mo -files in /usr/share/locale/LANGUAGE/.
2. gnumeric.mo -files already exist for maybe 20 languages.
Puppys tools are different.
Each word is hardcoded in the program itself.
So a "proper" localization would require 4 steps:
1. Replace each word with a variable
2. Add a function, that detects the LANG -environment-variable set with the "chooselocale"-utility.
3. "source" a /usr/share/locale/LANGUAGE/PROGRAM.mo -file to fill the variables with words.
4. Add as many different .mo -files as possible.
So we need coders that start adding the functions, and later users (without programming-experience) to translate .mo -files.
Mark
|
Back to top
|
|
 |
Nathan F

Joined: 08 Jun 2005 Posts: 1760 Location: Wadsworth, OH (occasionally home)
|
Posted: Wed 10 May 2006, 09:46 Post subject:
|
|
After 109 releases I could possibly help with adding the variables you mentioned. I think once the first script has had such a conversion it could be used as a model or template, and all the rest would go that much quicker.
This is really something I want to help with because I've already got a lot of people interested in Grafpup from other parts of the world, and in fact the only reviews of Grafpup that have been anything less than positive come from overseas and focus on this issue.
It will of course be up to those who can speak and write a foreign language to add the actual translations. My German and Spanish are so rusty I avoid showing my ignorance
Nathan
_________________ Bring on the locusts ...
|
Back to top
|
|
 |
rarsa

Joined: 29 May 2005 Posts: 3053 Location: Kitchener, Ontario, Canada
|
Posted: Wed 10 May 2006, 13:32 Post subject:
|
|
First, I hope that when you say 'word' you mean 'sentence' or 'code snippets'.
Second,
I really think that we should use something like gettext
It's a de-fact standard. It may speed up the implementation and help us avoid headaches.
The implementation is quite easy and small and it's already included in Puppy.
_________________ http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
|
Back to top
|
|
 |
GuestToo
Puppy Master
Joined: 04 May 2005 Posts: 4078
|
Posted: Wed 10 May 2006, 23:02 Post subject:
|
|
would gettext work something like this?
export TEXTDOMAIN=dotpuphandler
MSG1=`gettext "File not found:"`
MSG2=`gettext "File integrity ERROR:"`
from what i can understand from a quick read of the getttext docs, this should translate those strings if gettext finds an approriate translation file, otherwise it should just set the variable to the string
this seems like it would be easy to implement in a script
however, i tried it with an icewm.po file in /usr/share/locale/fr/LC_MESSAGES/ like this:
# export LANG=fr_FR
# export TEXTDOMAIN="icewm"
# gettext "Error checking mailbox."
Error checking mailbox.
#
and it doesn't seem to work ... i think this should print:
Échec de vérification de la boîte à lettre.
but maybe i don't have the syntax quite right ... is TEXTDOMAIN the variable that holds the programs name? (i exported the variables just to make sure they would be what gettext would use)
anyway, it looks like a simple thing to do, if i figure out the right syntax
|
Back to top
|
|
 |
MU

Joined: 24 Aug 2005 Posts: 13648 Location: Karlsruhe, Germany
|
Posted: Wed 10 May 2006, 23:54 Post subject:
|
|
yes, sentences instead of words.
Sorry I don't write much concerning localisation at moment.
I'm tracking down Bugs in the 3D-wizard, and Puppy2 now has one with the backgroundsetter.
And we finally have summer, today I was swimming in the Elbe-river, and after 6 hours in the sun I currently look as red as a boiled crustean
But i'm happy first people try to find solutions already
Mark
|
Back to top
|
|
 |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15238 Location: Paradox Realm
|
Posted: Thu 11 May 2006, 01:01 Post subject:
Swim, use Puppy, be happy ;) |
|
MU wrote: |
And we finally have summer, today I was swimming in the Elbe-river, and after 6 hours in the sun I currently look as red as a boiled crustean
|
Good news. Hope you are not over cooked. The sun is (some say) better than the traditional RGB monitor and LCD backlight tanning indulged in by some geeks . . .
Warning for our black Puppys - do not use sun block labled "Micheal Jackson Sun Screen" - you could end up anywhere . . .
Probably the only safe place for sun bathing is China (they never see the sun) My sister was there a few years back and the country is under constant greyness from industrialisation . . .
What a world . . .
Swim, use Puppy, be happy
_________________ YinYana AI Buddhism
|
Back to top
|
|
 |
puppian

Joined: 18 Jul 2005 Posts: 538 Location: PuppyLand
|
Posted: Thu 11 May 2006, 13:55 Post subject:
|
|
A bit busy and haven't been around these days. Good to see this new I18n forum section being developed
Gettext should be useful:
http://en.wikipedia.org/wiki/Gettext
Programs like Abiword and patched Dillo support gettext, but do Puppy's wizards and other apps (e.g those Tk/Tcl ones) support gettext too?
And we need a dotpup of this too:
http://www.poedit.org/
"poEdit is cross-platform gettext catalogs (.po files) editor..."
_________________ Puppylinux.org - Community home page of Puppy Linux hosted by Barry (creator of Puppy), created and maintained by the Puppy Linux Foundation since 2005
|
Back to top
|
|
 |
rarsa

Joined: 29 May 2005 Posts: 3053 Location: Kitchener, Ontario, Canada
|
Posted: Thu 11 May 2006, 14:52 Post subject:
|
|
puppian wrote: | but do Puppy's wizards and other apps (e.g those Tk/Tcl ones) support gettext too? | They are not. This project should include internationalizing such scripts.
puppian wrote: | And we need a dotpup of this too:
http://www.poedit.org/
"poEdit is cross-platform gettext catalogs (.po files) editor..." | Lets try different tools and see which ones are a better match for puppy.
_________________ http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
|
Back to top
|
|
 |
GuestToo
Puppy Master
Joined: 04 May 2005 Posts: 4078
|
Posted: Thu 11 May 2006, 22:43 Post subject:
|
|
Quote: | do Puppy's wizards and other apps (e.g those Tk/Tcl ones) support gettext too? |
it should be easy to modify scripts and tcl/tk wizards and programs to use gettext
as i said in an earlier post, it should be as easy as something like this in a bash script:
export TEXTDOMAIN=dotpuphandler
MSG1=`gettext "File not found:"`
MSG2=`gettext "File integrity ERROR:"`
this should set the MSGx strings to the value in quotes, but if the locale is set and there is a localization file, it should automatically translate the text
i used msgfmt to create an icewm.mo file from my icewm.po file, and that seems to be what was needed to get it to work:
# TEXTDOMAIN=icewm
# LANG=fr_FR gettext "Error checking mailbox."
Échec de vérification de la boîte à lettre.
#
Quote: | And we need a dotpup of this too:
http://www.poedit.org/ |
the .po files seem to be extremely simple (though they can be complicated when strings are created that change word order to fit the syntax of the language) ... .po files seem to be just strings of text and the translations ... a simple text editor might be adequate in many cases ... for example:
msgid "hello"
msgstr "bonjour"
msgid "goodbye"
msgstr "au revoir"
msgid "Back"
msgstr "Retour"
msgid "Unknown action"
msgstr "Action inconnue"
|
Back to top
|
|
 |
rarsa

Joined: 29 May 2005 Posts: 3053 Location: Kitchener, Ontario, Canada
|
Posted: Fri 12 May 2006, 09:57 Post subject:
|
|
Here is a good guide to start with gettext. It shows the basic utilities and commands needed.
http://www.linuxvalley.it/encyclopedia/ldp/guide/abs/localization.html
It actually clarified to me what the TEXTDOMAIN value means.
By The way. What's the default localization path for Puppy?
/usr/local/share/locale/
or
/usr/share/locale/ ?
_________________ http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
|
Back to top
|
|
 |
GuestToo
Puppy Master
Joined: 04 May 2005 Posts: 4078
|
Posted: Fri 12 May 2006, 23:38 Post subject:
|
|
Quote: | What's the default localization path |
from a few experiments, i think it's necessary to explicitly set both TEXTDOMAIN and TEXTDOMAINDIR in a bash script for it to work ... but i think TEXTDOMAINDIR could be exported from /etc/profile
|
Back to top
|
|
 |
rarsa

Joined: 29 May 2005 Posts: 3053 Location: Kitchener, Ontario, Canada
|
Posted: Sat 13 May 2006, 14:39 Post subject:
|
|
_________________ http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
|
Back to top
|
|
 |
GuestToo
Puppy Master
Joined: 04 May 2005 Posts: 4078
|
Posted: Sat 13 May 2006, 18:34 Post subject:
|
|
gettext seems to work ... what i couldn't get to work was $"a text string" ... bash is supposed to treat a text string starting with $ as a short syntax to translate a string ... like this:
TEXTDOMAIN=test1
echo $"hello"
if TEXTDOMAINDIR and LANG and an appropriate .mo file is setup, this is supposed to translate "hello" to the language set by LANG ... it works when i explicitly use gettext, but $"hello" does not work
maybe bash was compiled without NLS support? ... it's also possible that LANG is not set when $"hello" is executed ... it might be necessary to kill X or even reboot to properly set LANG ... by the way, this might be the problem if you are having trouble with gettext, i found that for testing, i had to begin a line with LANG=fr_FR or whatever language you choose, or it would use the LANG that was set when you booted, which in my case is en_US (not that i'm in the us), which means there would be no translation
|
Back to top
|
|
 |
GuestToo
Puppy Master
Joined: 04 May 2005 Posts: 4078
|
Posted: Sat 13 May 2006, 19:37 Post subject:
|
|
i made a simple demo for using gettext in a bash script ... see
http://www.murga.org/~puppy/viewtopic.php?t=7996
|
Back to top
|
|
 |
rarsa

Joined: 29 May 2005 Posts: 3053 Location: Kitchener, Ontario, Canada
|
Posted: Sun 14 May 2006, 01:35 Post subject:
|
|
I know what my problem was.
I was selecting LANG=es instead of LANG=es_ES.
I was also using the $"text" format instead of the explicit form. gettext...
Now it's working. I'll try internationalizing the Network wizard so it can be localized.
Oh, and you don't need to set the LANG in every line.
_________________ http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
|
Back to top
|
|
 |
|