MoManager tips for gettext translations

For efforts in internationalising Puppy and solving problems in this area
Post Reply
Message
Author
User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#16 Post by don570 »

Your white space between Pmusic and Playlist is not ASCII.

I did a lot of copying of text using the clipboard, since this reduced the
number of spelling mistakes and speeded up the process of writing the script.

Maybe Zigbert put in whitespace with hard spaces(the alt key).
This is something I would never do.

When I typed out the 'Add to pmusic playlist' menu item it solved the
problem.

Fortunately the US-keyboard layout does a good job at showing
the characters that programmers use.


______________________________________________________

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#17 Post by don570 »

I did French and German translation of puppy-rsync

I found that using poedit would result in an error message,
but momanager would still create the various translation files (pot,po,mo)

However whenever I tried to launch poedit again I would get errors
reported. I discovered an interesting line in the po file indicating that
ASCII was the text format used which was obviously wrong.

My method to fix was following

1) use momanager and launch translation with geany rather than poedit
2)geany opens the script for tranlation. Using clipboard
I transfer previous translations made in poedit to geany.
I make a change of the following line to UTF-8

Code: Select all

"Content-Type: text/plain; charset=UTF-8\n"
3) Save and quit geany. There is message that says that mo file
is created. When I check this mo file has few or no flaws in it :lol:
so it is useful.


Here is the beginning of po file for reference....

Code: Select all

msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-08-06 06:59-0400\n"
"PO-Revision-Date: 2013-08-06 06:19-0400\n"
"Last-Translator: root <don570@hotmail.com>\n"
"Language-Team: German <translation-team-de@lists.sourceforge.net>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
_______________________________________________

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#18 Post by don570 »

I was converting several scripts from the old fashioned Zigbert's method
of localization to gettext locallization and I found that the only way I
could make the scripts work properly was to put 'set -a' near beginning of
script. This allows the variable values to be sent to functions??

I found in the script baconrecorder that set -a had to be written before
the gettext.sh script is loaded like this...

Code: Select all

set -a
. gettext.sh
I don't know why but that is the order required.

__________________________


Another tip ---> Be sure that all non- ascii characters are removed from script.

You can test the script you've written with this command . Of course
devx file must be loaded to execute this command.

Code: Select all

xgettext -L shell some_script.sh -o -
__________________________________________

Another tip---> When using eval_gettext --->
Don't forget to put three slashes in front of dollar sign which represents
the contents of a variable.

Code: Select all

`eval_gettext \"Bacon Recorder \\\$VERSION\"; echo`
__________________________________________

Another tip: Don't confuse the dollar sign when it's being used
as the contents of a variable with the results of a command.

In that case the three slashes doesn't work (apparently)

For an example ---> the result of a date command ---> $( date )
must be loaded into another variable ----> TIME_START

Code: Select all

TIME_START="$( date )"
...
...
echo "`eval_gettext \"The recording started at \\\$TIME_START\"; echo`"    >>  $WORKDIR/log
Then that new variable can be treated as standard variable containing
data i.e. a string, so I now put three slashes in front of dollar sign.




_________________________________________________

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#19 Post by don570 »

Another tip :

If you accidentally make a mo file for de_CH rather than de locale,
it's easy to make the change. Just drag mo file over to the
equivalent mo folder i.e. /usr/share/locale/de/LC_MESSAGES/
Then launch momanager and choose the script again --->

It will read 'de' beside the script name rather than de_CH

Do a 'Save' then 'Quit' in poeditor and the corrected mo file will be created
(including in /root/ and /tmp/)

_________________________________________

Post Reply