Discussion: translating Puppys System-tools

For efforts in internationalising Puppy and solving problems in this area
Message
Author
User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

Discussion: translating Puppys System-tools

#1 Post by MU »

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

User avatar
Nathan F
Posts: 1764
Joined: Wed 08 Jun 2005, 14:45
Location: Wadsworth, OH (occasionally home)
Contact:

#2 Post by Nathan F »

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

Nathan
Bring on the locusts ...

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#3 Post by rarsa »

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.
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#4 Post by GuestToo »

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:


User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#5 Post by MU »

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

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

Swim, use Puppy, be happy ;)

#6 Post by Lobster »

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 ;)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
puppian
Posts: 537
Joined: Tue 19 Jul 2005, 03:58
Location: PuppyLand
Contact:

#7 Post by puppian »

A bit busy and haven't been around these days. Good to see this new I18n forum section being developed :D

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..."
[url=http://puppylinux.org]Puppylinux.org - Community home page of Puppy Linux[/url] hosted by Barry (creator of Puppy), created and maintained by the [url=http://puppylinux.org/user/readarticle.php?article_id=8]Puppy Linux Foundation[/url] since 2005

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#8 Post by rarsa »

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.
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#9 Post by GuestToo »

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."

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#10 Post by rarsa »

Here is a good guide to start with gettext. It shows the basic utilities and commands needed.

http://www.linuxvalley.it/encyclopedia/ ... ation.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/ ?
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#11 Post by GuestToo »

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

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#12 Post by rarsa »

I've been trying to test the get text translation without luck.

I change the locale and follow http://www.linuxvalley.it/encyclopedia/ ... ation.html

but the strings don't get translated.

What am I missing? It seems that it should be straight forward.
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#13 Post by GuestToo »

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

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#14 Post by GuestToo »

i made a simple demo for using gettext in a bash script ... see
http://www.murga.org/~puppy/viewtopic.php?t=7996

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#15 Post by rarsa »

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.
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#16 Post by GuestToo »

i can't get $"text" to work either ... that's why i put LANG= on each line, to be absolutely sure LANG was set when the line executed

except, the way bash works, i think it substitutes all $"text" strings before any line in the script executes, so to work properly (for demo purposes), LANG variables should be set and exported before ever calling the script

also, gettext uses LANG, but i think bash uses LC_ALL ... but i still couldn't get $"text" to work

maybe it's the way bash was compiled ... maybe it was compiled without NLS support?

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#17 Post by rarsa »

GuestToo wrote:so to work properly (for demo purposes), LANG variables should be set and exported before ever calling the script
I just wanted to make sure that other readers understand that when implementing gettext in their scripts they should rely on the locale set for the system.

Thanks for your demo.
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

User avatar
nyu
Posts: 110
Joined: Tue 14 Mar 2006, 15:30
Location: good earth

Re: Discussion: translating Puppys System-tools

#18 Post by nyu »

MU wrote:
So we need coders that start adding the functions, and later users (without programming-experience) to translate .mo -files.

Mark
I am not a coder but I can translate English to Traditional Chinese :lol:
Can someone help me to translate Dillo-0.5.8-i18n-misc into zh_TW.UTF-8
environment under Puppy?
Thanks,
nyu

Kingskid
Posts: 4
Joined: Sun 22 Jan 2006, 07:16
Location: Czech Republic, Kladno
Contact:

Rosetta

#19 Post by Kingskid »

Hi there!
Does anyone know if there is a way to upload all the texts into Rosetta to easier internationalize Puppy?
If you never heard about it just check www.launchpad.net. Its a great tool for translating.
Another question: How can Linux beginner extract the texts from Puppy to translate it? And later put them back translated? Maybe some experienced user could do the extraction for others who don't know how & later help to load them back? What do you think?

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#20 Post by GuestToo »

Can someone help me to translate Dillo-0.5.8-i18n-misc into zh_TW.UTF-8
i think it is already translated to zh_TW ... does the font that is used make a difference? ... if it does, then you should be able to get the zh_TW.po file from the source and adapt it ... zh_TW.po already seems to be a UTF8 text file

maybe you need to add a locale named zh_TW.UTF-8 in /usr/local/share/locale/ ? ... it could probably be a copy or a symlink to the zh_TW locale

source:
http://www.murga.org/~puppy/viewtopic.php?t=7473

i do not know if the Puppy unleased package is significantly different from MU's

Post Reply