zigbert and gettext
Puppy backup which is an improved clone of pmirror
is finished.
Pmirror can and should be forgotten.
Localized with Zigbert's method.
Yaf-splash is now used to indicate activity.
I've gone as far as I can with this one.
http://murga-linux.com/puppy/viewtopic.php?t=77685
_____________________________________________________
is finished.
Pmirror can and should be forgotten.
Localized with Zigbert's method.
Yaf-splash is now used to indicate activity.
I've gone as far as I can with this one.
http://murga-linux.com/puppy/viewtopic.php?t=77685
_____________________________________________________
Re: zigbert and gettext
Great.zigbert wrote:If someone out there wants to help out converting apps to use gettext (like L18L did for pClock), that is no problem to fix. The only thing we need to keep track of is that you work on the latest code.
I guess we can convert your localization to gettext automatically. It will ensure the code always to be the latest.
Downloads for Puppy Linux [url]http://shino.pos.to/linux/downloads.html[/url]
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Re: zigbert and gettext
It has been not so simple.zigbert wrote:Great. Version 1.30 is up to dateL18L wrote:I am going to try converting Pfilesearch now.
gettext does not like messages starting with - (minus)
so I had to change the text, see picture
But using the new momanager_enhanced was fun.
I have made 1.31.pet ( containing de also )
Code: Select all
# ./pfilesearch -h
Optionen
-b als backend benutzen. Keine Suchergebnisse anzeigen
-bb Nicht 'Keine Dateien gefunden!' anzeigen
-bbb Nicht 'Suche...' anzeigen
-c [STRING] Stumme Suche. Kein GUI
-d [DIR] In einem spezifischen Ordner suchen
-e Embedded laufen - gtkdialog code is pointed to stdout
-ee Embedded laufen - Optionen überspringen
-f [FILTER] Nur durchsuchen nach Dateigruppen:
documents Dokumente
pictures Bilder
music Musik
videos Videos
emails E-Mails
compressed_files Komprimierte Dateien
code_files Code-Dateien
-i Konfigurationsdateien installieren und beenden
-h Diese Hilfe anzeigen
-p Einstellungen GUI bei Start anzeigen
-t [STRING] Standard-Suchtext definieren
-v Version von Pfilesearch anzeigen
#
- Attachments
-
- pfilesearch.png
- (40.57 KiB) Downloaded 985 times
-
- pfilesearch-1.31.pet
- for testing only
- (11.99 KiB) Downloaded 594 times
Re: zigbert and gettext -automate
Yeh.L18L wrote:It has been not so simple.
gettext does not like messages starting with - (minus)
so I had to change the text,
I have tried automatic conversion by next code against the locales file:
Code: Select all
sed -e 's/\([^=\]\)"\([ ]*#.*$\)/\1")\2/' -e 's/\([^=\]\)"[ ]*$/\1")/' -e 's/^\([A-Z][0-9A-Z_]*\)="/\1=$(gettext "/' -e "s/\\([^=\\]\\)'\\([ ]*#.*\$\\)/\\1')\\2/" -e "s/\\([^=\\]\\)'[ ]*\$/\\1')/" -e "s/^\\([A-Z][0-9A-Z_]*\\)='/\\1=\$(gettext '/" $SOURCE > $DEST
Downloads for Puppy Linux [url]http://shino.pos.to/linux/downloads.html[/url]
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Re: zigbert and gettext -automate
I have tested it with SOURCE=/usr/local/pfilesearch/localesshinobar wrote:Mostly it works. But some case, we need to modify the original...
Does convert half (just the trailing ) ) for
export ....
and more than 1 liners
Examples:
export LOC_NO="No")
LOC_QUIT=$(gettext "Quit")
Missing
'$(gettext '
can easily be inserted manually.
------
Converting also the existing translations would be great
locale2gettext v0.1
Full automation is difficult. But it will hopefully be an useful tool.
Unzip the attached, add executable, place at /root/applications/bin or somewhere under the $PATH.
# locale2gettext --help
locale2gettext 0.1
Convert locales of zigbert into gettext version.
usage: locale2gettext [PATH_TO_LOCALE_FILE] [TEXT_DOMAIN]
Unzip the attached, add executable, place at /root/applications/bin or somewhere under the $PATH.
# locale2gettext --help
locale2gettext 0.1
Convert locales of zigbert into gettext version.
usage: locale2gettext [PATH_TO_LOCALE_FILE] [TEXT_DOMAIN]
- Attachments
-
- locale2gettext.gz
- Unzip, add executable, place at /root/applications/bin
- (1.11 KiB) Downloaded 554 times
Downloads for Puppy Linux [url]http://shino.pos.to/linux/downloads.html[/url]
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Re: locale2gettext v0.1
Yes it is helpful, has been running successfully for pfilesearchshinobar wrote:Full automation is difficult. But it will hopefully be an useful tool.
I have tried to put the gettext into the script
(easier to understand and to maintain)
Does not work with multi line messages
But I got pfilesearch running with this:
Code: Select all
#!/bin/sh
# replace variables by gettext expression
# example:
# LOC_OPTIONS=$(gettext "Options") # line in locales.converted
# line in script:
# <frame $LOC_OPTIONS>
# will become:
# <frame $(gettext "Options")>
#
input_file=locales.converted
# create sed file
conversion_file=locales.sed
delimiter='@' # not used in script ???
echo "#sed expressions for conversion of pfilesearch" > $conversion_file
while read LINE; do
case "$LINE" in
\#*) continue # skip comments
;;
*) [ -z "$LINE" ] && continue # skip blank lines
[ "`echo $LINE | grep '^export TEXTDOMAIN='`" ] && continue # skip
[ "`echo $LINE | grep '^export OUTPUT_CHARSET='`" ] && continue # skip
[ "${LINE:0:7}" = "export " ] && LINE="${LINE//export }" # delete 'export '
LINE="${LINE//=\$\(/$delimiter\$(}" # s#FROM${delimiter}TO#
[ "${LINE:0:3}" = "LOC" ] && LINE="s${delimiter}${LINE//\$}" # s${delimiter}FROM#TO#
[ "`echo $LINE | grep -E '"\)$'`" ] && LINE="${LINE}${delimiter}" # s#FROM$#TO${delimiter}
;;
esac
echo $LINE >> $conversion_file
done < $input_file
echo finished $conversion_file
# delete multiliners
cat $conversion_file | grep -E "^s${delimiter}LOC" | grep -E "${delimiter}$" > $conversion_file.1liners
echo finished $conversion_file.1liners
# replace $LOCxxx by gettext (....)
sed -f $conversion_file.1liners pfilesearch > pfilesearch.converted
echo finished pfilesearch.converted
chmod +x pfilesearch.converted
echo run converted script in console to see errors !
echo some errors can be fixed by escaping quotes !!
echo do not forget to the muliliners !!!
I am going to convert pfind now. That is the most logical step after pfilesearch.
replace variables by gettext expression
Why we need it?L18L wrote:# replace variables by gettext expression
# example:
# LOC_OPTIONS=$(gettext "Options") # line in locales.converted
# line in script:
# <frame $LOC_OPTIONS>
# will become:
# <frame $(gettext "Options")>
I am not sure.L18L wrote:(easier to understand and to maintain)
Downloads for Puppy Linux [url]http://shino.pos.to/linux/downloads.html[/url]
Re: replace variables by gettext expression
If we convert only the file 'locales' and do not change any of others, it allows backward compatibility, i mean we can use old NLS as is.
Downloads for Puppy Linux [url]http://shino.pos.to/linux/downloads.html[/url]
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Re: replace variables by gettext expression
yeah, that is true.shinobar wrote:If we convert only the file 'locales' and do not change any of others, it allows backward compatibility, i mean we can use old NLS as is.
But new apps should be coded without the LOCxx variables
It is easier to use just gettext inside the script.
Re: replace variables by gettext expression
But it is not a good idea...shinobar wrote:If we convert only the file 'locales' and do not change any of others, it allows backward compatibility, i mean we can use old NLS as is.
The script takes the older NLS if there are both old and new.
Downloads for Puppy Linux [url]http://shino.pos.to/linux/downloads.html[/url]
Great!!!L18L wrote:I am going to convert pfind now. That is the most logical step after pfilesearch.
Gettext has the advantage of making the code more readable (also for me ). That is a good thing for the community. Converting the locales-file would sure be good for backward compatibility, but for moving the project further, I think updating the code itself is the way to go.shinobar wrote:If we convert only the file 'locales' and do not change any of others, it allows backward compatibility, i mean we can use old NLS as is.
Sigmund
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
zigbert wrote:updating the code itself is the way to go.
There is always something to learn and something to improve.
Generating po files from the old locals is also possible.
Code: Select all
# LOC200
msgid "Filename"
msgstr "Им
- Attachments
-
- pfind_semi_ru.png
- LANGUAGE=auto:ru:de
- (35.79 KiB) Downloaded 678 times
Gettext in pBurn.
I have added gettext to pBurn but haven't tested it well yet. Just tested main GUI and have made partial Russian translation for testing. I haven't change set-language section of pburn script so translation only works if I choose or type in 'ru' language in Preferences.
I also didn't know what to do with line 398 of func_gui_options.
New MoManager finds all files and creates proper pot-file.
I didn't internationalize file func_man since it didn't have '$LOC' before...
I also didn't know what to do with line 398 of func_gui_options.
New MoManager finds all files and creates proper pot-file.
I didn't internationalize file func_man since it didn't have '$LOC' before...
- Attachments
-
- pburn_gtxt-3.7.3.pet
- Pburn with gettext. Not tested. Some mistakes possible.
- (71.67 KiB) Downloaded 555 times
-
- MoManager-ru_UA-pburn-3.7.3.tar.gz
- partial Russian translation just for testing ... I will update it soon.
- (3.69 KiB) Downloaded 551 times
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
pfind
Please test version 5.02
NLS has German (of course) and Russian (converted from old system)
So you can change between de, ru and English
Next I will try to convert the other languages.......
NLS has German (of course) and Russian (converted from old system)
So you can change between de, ru and English
Next I will try to convert the other languages.......
- Attachments
-
- pfind_changeLANGUAGE.png
- (7.97 KiB) Downloaded 814 times
-
- pfind-NLS.pet
- Russian (to be completed) and German
- (8.45 KiB) Downloaded 659 times
-
- pfind-5.02.pet
- (18.72 KiB) Downloaded 698 times
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Re: Gettext in pBurn.
Hope you understand my solution in pfind ( used it in ymount some time ago ) Search for LANGUAGE NEW_LANGUAGE and LANGUAGESrodin.s wrote:...I haven't change set-language section of pburn script so translation only works if I choose or type in 'ru' language in Preferences....
Sorry I cannot help very much with testing because I do NOT have CD burner
zigbert2gettext-0.1
OK, the first trial to place gettext inline the code.zigbert wrote:Gettext has the advantage of making the code more readable (also for me ). That is a good thing for the community. Converting the locales-file would sure be good for backward compatibility, but for moving the project further, I think updating the code itself is the way to go.
But for multiple lines, i think we are better to stay the substitution method, that is:
Code: Select all
export LOCXXX=$(gettext "First line
Second lne")
export DIALOG="<text><input>echo -n "\$LOCXXX"</inout></text>"
# zigbert2gettext --help
zigbert2gettext 0.1
Convert zigbert apps into gettext version.
usage: zigbert2gettext [PATH_TO_MAIN_SCRIPT] [TEXT_DOMAIN]
PATH_TO_MAIN_SCRIPT - example: /usr/local/pburn/pburn
But still you need to remove manually some code, loading the locales file, from the converted main script.
- Attachments
-
- zigbert2gettext.gz
- Unzip, add executable, place at /root/my-applications/bin.
- (2.3 KiB) Downloaded 693 times
Downloads for Puppy Linux [url]http://shino.pos.to/linux/downloads.html[/url]
pBurn updated
I did some tests on pBurn. Tried to burn CD-R. Seems OK. I have also completed translation of mo-file: just have copied lines from old locale file in Poedit with some modifications.
I have also made some changes to previous pet: commented out set-locale this time.
I changed some translation lines for example:
Blank Disc - To blank the disc
and
Blank Disc - The disc is blank
have different translation so I have added whitespace to 'Blank Disc ' in func.
Same with 'Burn ISO-image' button in GUI: to burn and the burn have different translations.
I have also made some changes to previous pet: commented out set-locale this time.
I changed some translation lines for example:
Blank Disc - To blank the disc
and
Blank Disc - The disc is blank
have different translation so I have added whitespace to 'Blank Disc ' in func.
Same with 'Burn ISO-image' button in GUI: to burn and the burn have different translations.
- Attachments
-
- pburn_gtxt2-3.7.3.pet
- Updated pBurn
- (71.7 KiB) Downloaded 613 times
-
- MoManager-ru_UA-pburn-3.7.3.tar.gz
- Full Russian translation this time.
- (14.14 KiB) Downloaded 603 times