Question about gettext! [SOLVED]

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

Question about gettext! [SOLVED]

#1 Post by Argolance »

Hello,
How to make gettext working while compiling an application from source files? => For example
This application (retrovol) is built to generate locales directories when "fr" or any language is specified in ./po/LINGUAS file. I created a po file from pot, then a French mo file called retrovol.mo that I copied into /usr/share/locale/fr/LC_MESSAGES/ but nothing happens :cry: .
Something else has to be done, of course... but what?
Thank you for your help.

Cordialement.
Last edited by Argolance on Sat 28 Jan 2012, 18:24, edited 3 times in total.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#2 Post by amigo »

YOu need to add your translations to the sources and re-generate the po/mo files to have them available into the binary.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#3 Post by Argolance »

Hello amigo,
Thank you a lot for replying
YOu need to add your translations to the sources...
What do you exactly mean, please? I already tried to copy my translation files (po and mo) inside the po directory. Sorry but I need a bit more explanation :oops:

Thank you for your attention.

Cordialement.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#4 Post by Argolance »

Hello,
I found `ABOUT-NLS' file inside source files directory: I assume that the distributed package of retrovol does use GNU `gettext' internally. So I tried this:
./configure --with-included-gettext
configure: WARNING: unrecognized options: --with-included-gettext
... as result in console :?
Where do I copy the mo and po files (generated with poeditor).

Regards.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#5 Post by amigo »

They go wherever the other po files are, but the Makefiles must be altered to add them to the mix.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#6 Post by Argolance »

Hello,
How do I call these po and mo files: fr.po and fr.mo or retrovol.po and retrovol.mo? Perhaps is it wrong names which make the compilation missing them?

Regards.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: Question about gettext!

#7 Post by L18L »

Argolance wrote:... retrovol.mo that I copied into /usr/share/locale/fr/LC_MESSAGES/ but nothing happens...
I have copied into /usr/local/share/locale/fr/LC_MESSAGES/ and it works!

I think this TEXTDOMAINDIR /usr/local/share/locale is set in the configuration.

Happy New Year :)
Attachments
retrovol_german.png
"Volume" translated to "Lautstärke"
(2.62 KiB) Downloaded 633 times

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

Question about gettext!

#8 Post by RSH »

I do have another problem - or better two.

1. Some of the .mo files are empty, if i open them to edit - while others opens as they should.

2. What do i have to put into the code to use GETTEXT in my own programs?

RSH
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#9 Post by Argolance »

Hello,
@RSH
1. Some of the .mo files are empty, if i open them to edit - while others opens as they should.
They only seem to be empty but are not: this sort of mo files are directly created from po files and cannot be opened and modified through a text editor.

@L18L
:D I will see that when I am back home... Don't you think anyway it should be better the mo files to be copied into /usr/share/locale and if this is configurable, TEXTDOMAINDIR to be modified?

Thank you a lot!

Best regards.

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#10 Post by RSH »

I do use msgunfmt in the devx.sfs. I use my own GUI to do this. If i am opening such files and running the GUI in the terminal, msgunfmt sends an error message of: unknown format.

Do you mean these files?

L18L told me, it is necessary to load the devx to edit .mo files, because of msgunfmt inside the devx.

How do you open and edit these "error"-files?

What else is needed instead of msgunfmt? :?
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Question about gettext!

#11 Post by L18L »

Argolance wrote:...Don't you think anyway it should be better the mo files to be copied into /usr/share/locale and if this is configurable, TEXTDOMAINDIR to be modified?...
I agree, that would be better for Pizzasgood´s pet.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

#12 Post by L18L »

RSH wrote: L18L told me, it is necessary to load the devx to edit .mo files, because of msgunfmt inside the devx.
.mo files cannot be edited.
msgunfmt converts a .mo file to an editable .po file and
msgfmt can convert a .po file back to a .mo file.

If a .po file contains only empty msgstr´s, that is if no translation was made, then the resulting .mo file is empty of course.
HTH

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#13 Post by RSH »

L18L wrote:.mo files cannot be edited.
msgunfmt converts a .mo file to an editable .po file and
msgfmt can convert a .po file back to a .mo file.
Thank you for displaying the correct way to edit the files. I did not wrote it correctly, but did mean it like you described. I just tought, this would be clear, because this is really not a "how-to-shoe-shopping" topic. :wink:
L18L wrote:If a .po file contains only empty msgstr´s, that is if no translation was made, then the resulting .mo file is empty of course.
These files do not have empty msgstr's. They have nothing! No text, 0 bytes!

As i have had written before: The msgunfmt sends an error message of: unknown format.

However, this gives no answer to my questions!
RSH wrote:1. Some of the .mo files are empty, if i open them to edit - while others opens as they should.

2. What do i have to put into the code to use GETTEXT in my own programs?
F.E.: icewm could be translated to german etc using gettext, but how do i tell icewm which .po file to load and read?
RSH wrote:How do you open and edit these "error"-files?

What else is needed instead of msgunfmt?
It only gives more questions:

Why are there empty or not yet edited/translated .mo files to some programs?

Did the kb-savers get drunk at that time? :lol:

---

Nice to be corrected, but nicer to get answered - because of knowledge. :wink:
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: Question about gettext!

#14 Post by L18L »

L18L wrote:
Argolance wrote:...Don't you think anyway it should be better the mo files to be copied into /usr/share/locale and if this is configurable, TEXTDOMAINDIR to be modified?...
I agree, that would be better for Pizzasgood´s pet.
I have to correct myself now.
Pizzasgood´s pet is OK.

I have deleted my /usr/local/share/locale/de/retrovol.mo
/usr/share/locale/de/retrovol.mo is still existing.

Configured as adviced by pizzasgood

Code: Select all

./configure --prefix=/usr 
And localization is working :D

(Before I had used just configure without option)

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

#15 Post by L18L »

RSH wrote:...
L18L wrote:If a .po file contains only empty msgstr´s, that is if no translation was made, then the resulting .mo file is empty of course.
These files do not have empty msgstr's. They have nothing! No text, 0 bytes!

As i have had written before: The msgunfmt sends an error message of: unknown format.

However, this gives no answer to my questions!
RSH wrote:1. Some of the .mo files are empty, if i open them to edit - while others opens as they should.

2. What do i have to put into the code to use GETTEXT in my own programs?
F.E.: icewm could be translated to german etc using gettext, but how do i tell icewm which .po file to load and read?
RSH wrote:How do you open and edit these "error"-files?

What else is needed instead of msgunfmt?
It only gives more questions:

Why are there empty or not yet edited/translated .mo files to some programs?

Did the kb-savers get drunk at that time? :lol:

---

Nice to be corrected, but nicer to get answered - because of knowledge. :wink:
I have no idea what you are talking about and so cannot reproduce your problem:
Some of the .mo files are empty, if i open them to edit - while others opens as they should.

Are you talking about retrovol 0.11?
These files, do they have a name?

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#16 Post by Argolance »

Hello,
Not sure but I think I am understanding what RSH means (??):
If an application is localized with the shinobar's simple script based on MU for example, mo files can be simply created with any text editor and later edited with! These mo files have got the same extension and are copied in the same places but are not of the same sort than those which are directly created to work with gettext from po file. So, inside /usr/share/locale directories, one can find mo files that can be edited, and the others that cannot be and seem to be empty when edited though!

Cordialement.

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#17 Post by RSH »

Question about gettext!

What do i have to put into the code to use GETTEXT in my own programs?
L18L wrote:I have no idea what you are talking about and so cannot reproduce your problem:
Some of the .mo files are empty, if i open them to edit - while others opens as they should.
Title: GUI for editing .mo files
http://murga-linux.com/puppy/viewtopic.php?t=73321
RSH wrote:Hello,

i have created a little GUI to edit the .mo files. Drag & drop the .mo file into the textfield at the GUI and the .mo file will be converted to .po file and automatically loaded into geany or leafpad (if geany is not available).

You can get the tool right here. It has got an english GUI and a german GUI.
http://murga-linux.com/puppy/viewtopic. ... 538#581538

I hope, this is a useful tool to you. I have enjoyed to create this little pet.

My best wishes,

RSH
@L18L:
You have seen this already - then.
BarryK wrote:RSH,
That is a very useful tool, I will put it into Racy and Wary I reckon (well, I have to try it first!)
@L18L:
You have seen this already - also then.

---

So, i think it is absolutely clear:

Talking or writing about editing the .mo files does mean: convert the .mo to .po and load the .po into a texteditor (geany, notepad etc.).

Except: you are running human language under the rules of programming languages!

F.E. (to eat some): stand up. leave the room were you are actually in. go to the Out house. open the refrigerator. take what you want. eat.

Or in assemmbler: move your arms. push your body up and get on the feet. move right feet 40cm forward. step down. move left feet...

Mein Gott!

I think you are doing a little bit of HAARSPALTEREI here? :wink:

I will search the files and reproduce what i wanted to describe and get a solution for in here. I will make notes and screenshots and come back to this point when it's done.

Thanks

RSH


Edit:
Argolance wrote:So, inside /usr/share/locale directories, one can find mo files that can be edited, and the others that cannot be and seem to be empty when edited though!
Right!

Thank you.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#18 Post by Argolance »

Hello,
(out of subject)
HAARSPALTEREI! French are used to say: "Couper les cheveux en quatre" (and sometimes somewhat more coarse! :D) and English: "Hairsplitting"!
I rather think things are quite difficult to explain or understand for non English speaking guys...

Cordialement.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#19 Post by Argolance »

Hello,
Thank you L18L: Perfect!
I should say almost perfect: My mo file is taken in account and French words are displayed in the application :D.
The problem now (problem that I already encountered several times and which made me unfortunately be a bit... wary with gettext because I finally could not solve it and gave up!) The problem now is accentuation... I tried UTF-8, ISO-8859-1... but didn't succeed to get accents.

This time, I would have liked to understand what's going wrong and solve this problem for good!

Cordialement!

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#20 Post by Argolance »

Hello,
This time, I would have liked to understand what's going wrong and solve this problem for good!
End of this little saga: This problem appears only with Puppy/Toutou 4.31 and as long as it was not possible to compile (retrovol in particular and other applications in general) with Wary 5.2.2 (=> BarryK made a pet package to correct this issue, posted on 9 Dec 2011), I could not test and diagnose that my French translation was finally working as well as possible!

Cordialement.

Post Reply