Author |
Message |
zigbert

Joined: 29 Mar 2006 Posts: 6541 Location: Valåmoen, Norway
|
Posted: Mon 30 Jul 2012, 08:35 Post subject:
|
|
L18L
Waiting for response of Barry before updating pProcess to benefit of your MoManager improvements.
Sigmund
_________________ Stardust resources
|
Back to top
|
|
 |
don570

Joined: 10 Mar 2010 Posts: 4989 Location: Ontario
|
Posted: Mon 30 Jul 2012, 18:00 Post subject:
|
|
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
_____________________________________________________
|
Back to top
|
|
 |
shinobar

Joined: 28 May 2009 Posts: 2664 Location: Japan
|
Posted: Mon 30 Jul 2012, 19:21 Post subject:
Re: zigbert and gettext |
|
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. |
Great.
I guess we can convert your localization to gettext automatically. It will ensure the code always to be the latest.
_________________ Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Tue 31 Jul 2012, 16:21 Post subject:
Re: zigbert and gettext Subject description: converting simple things first |
|
zigbert wrote: | L18L wrote: | I am going to try converting Pfilesearch now. | Great. Version 1.30 is up to date |
It has been not so simple.
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: | # ./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
# |
Description |
|
Filesize |
40.57 KB |
Viewed |
961 Time(s) |

|
Description |
for testing only
|

Download |
Filename |
pfilesearch-1.31.pet |
Filesize |
11.99 KB |
Downloaded |
488 Time(s) |
|
Back to top
|
|
 |
shinobar

Joined: 28 May 2009 Posts: 2664 Location: Japan
|
Posted: Tue 31 Jul 2012, 18:39 Post subject:
Re: zigbert and gettext -automate Subject description: converting simple things first |
|
L18L wrote: | It has been not so simple.
gettext does not like messages starting with - (minus)
so I had to change the text, |
Yeh.
I have tried automatic conversion by next code against the locales file:
Code: | 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 |
Mostly it works. But some case, we need to modify the original...
_________________ Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Wed 01 Aug 2012, 15:27 Post subject:
Re: zigbert and gettext -automate Subject description: converting simple things first |
|
shinobar wrote: | Mostly it works. But some case, we need to modify the original... |
I have tested it with SOURCE=/usr/local/pfilesearch/locales
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
|
Back to top
|
|
 |
shinobar

Joined: 28 May 2009 Posts: 2664 Location: Japan
|
Posted: Wed 01 Aug 2012, 23:22 Post subject:
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]
Description |
Unzip, add executable, place at /root/applications/bin
|

Download |
Filename |
locale2gettext.gz |
Filesize |
1.11 KB |
Downloaded |
469 Time(s) |
_________________ Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Thu 02 Aug 2012, 08:52 Post subject:
Re: locale2gettext v0.1 |
|
shinobar wrote: | Full automation is difficult. But it will hopefully be an useful tool. |
Yes it is helpful, has been running successfully for pfilesearch
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: |
#!/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 !!! |
Feel free to add it (maybe change some variables) to your locale2gettext
I am going to convert pfind now. That is the most logical step after pfilesearch.
|
Back to top
|
|
 |
shinobar

Joined: 28 May 2009 Posts: 2664 Location: Japan
|
Posted: Thu 02 Aug 2012, 09:04 Post subject:
replace variables by gettext expression |
|
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")> |
Why we need it?
L18L wrote: | (easier to understand and to maintain) |
I am not sure.
_________________ Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
|
Back to top
|
|
 |
shinobar

Joined: 28 May 2009 Posts: 2664 Location: Japan
|
Posted: Thu 02 Aug 2012, 09:13 Post subject:
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 http://shino.pos.to/linux/downloads.html
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Thu 02 Aug 2012, 09:33 Post subject:
Re: replace variables by gettext expression |
|
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. |
yeah, that is true.
But new apps should be coded without the LOCxx variables
It is easier to use just gettext inside the script.
|
Back to top
|
|
 |
shinobar

Joined: 28 May 2009 Posts: 2664 Location: Japan
|
Posted: Thu 02 Aug 2012, 19:26 Post subject:
Re: replace variables by gettext expression |
|
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 it is not a good idea...
The script takes the older NLS if there are both old and new.
_________________ Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 6541 Location: Valåmoen, Norway
|
Posted: Fri 03 Aug 2012, 02:54 Post subject:
|
|
L18L wrote: | I am going to convert pfind now. That is the most logical step after pfilesearch. | Great!!!
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. | 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.
Sigmund
_________________ Stardust resources
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Fri 03 Aug 2012, 15:57 Post subject:
|
|
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: | # LOC200
msgid "Filename"
msgstr "Имя файла"
# LOC203
msgid "Last modified"
msgstr "Изменен"
# LOC204
msgid "Permissions"
msgstr "Разрешения"
# LOC205
msgid "User"
msgstr "Пользователь" |
Wait and see
Description |
LANGUAGE=auto:ru:de |
Filesize |
35.79 KB |
Viewed |
654 Time(s) |

|
|
Back to top
|
|
 |
rodin.s
Joined: 22 Sep 2010 Posts: 340 Location: Ukraine
|
Posted: Fri 03 Aug 2012, 17:35 Post subject:
Gettext in pBurn. Subject description: Not tested well. |
|
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...
Description |
Pburn with gettext. Not tested. Some mistakes possible.
|

Download |
Filename |
pburn_gtxt-3.7.3.pet |
Filesize |
71.67 KB |
Downloaded |
471 Time(s) |
Description |
partial Russian translation just for testing ... I will update it soon.
|

Download |
Filename |
MoManager-ru_UA-pburn-3.7.3.tar.gz |
Filesize |
3.69 KB |
Downloaded |
454 Time(s) |
|
Back to top
|
|
 |
|