Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 18 Sep 2014, 11:48
All times are UTC - 4
 Forum index » Advanced Topics » Puppy Projects » Localization Project
zigbert and gettext
Moderators: Lobster, MU, raffy
Post new topic   Reply to topic View previous topic :: View next topic
Page 3 of 5 [72 Posts]   Goto page: Previous 1, 2, 3, 4, 5 Next
Author Message
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Sat 04 Aug 2012, 14:24    Post subject: pfind
Subject description: alpha
 

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.......
pfind_changeLANGUAGE.png
 Description   
 Filesize   7.97 KB
 Viewed   692 Time(s)

pfind_changeLANGUAGE.png

pfind-NLS.pet
Description  Russian (to be completed) and German
pet

 Download 
Filename  pfind-NLS.pet 
Filesize  8.45 KB 
Downloaded  356 Time(s) 
pfind-5.02.pet
Description 
pet

 Download 
Filename  pfind-5.02.pet 
Filesize  18.72 KB 
Downloaded  364 Time(s) 
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Sat 04 Aug 2012, 14:35    Post subject: Re: Gettext in pBurn.
Subject description: Not tested well.
 

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

Hope you understand my solution in pfind ( used it in ymount some time ago Laughing ) Search for LANGUAGE NEW_LANGUAGE and LANGUAGES

Sorry I cannot help very much with testing because I do NOT have CD burner
Back to top
View user's profile Send private message 
shinobar


Joined: 28 May 2009
Posts: 2630
Location: Japan

PostPosted: Sun 05 Aug 2012, 07:05    Post subject: zigbert2gettext-0.1  

zigbert wrote:
Gettext has the advantage of making the code more readable (also for me Very Happy ). 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.

OK, the first trial to place gettext inline the code.
But for multiple lines, i think we are better to stay the substitution method, that is:
Code:
export LOCXXX=$(gettext "First line
Second lne")
export DIALOG="<text><input>echo -n \"\$LOCXXX\"</inout></text>"


Extract the attached, add executable, place it at /root/my-applications/bin.
# 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.
zigbert2gettext.gz
Description  Unzip, add executable, place at /root/my-applications/bin.
gz

 Download 
Filename  zigbert2gettext.gz 
Filesize  2.3 KB 
Downloaded  386 Time(s) 

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
Back to top
View user's profile Send private message Visit poster's website 
zigbert


Joined: 29 Mar 2006
Posts: 5723
Location: Valåmoen, Norway

PostPosted: Sun 05 Aug 2012, 07:18    Post subject:  

Hi guys
I am a bit out of time for Puppy right now.
I will try to catch up within a few days.


Thank you all for your effort to push Puppy forward.
Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
rodin.s

Joined: 22 Sep 2010
Posts: 338
Location: Ukraine

PostPosted: Sun 05 Aug 2012, 09:42    Post subject: 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.
pburn_gtxt2-3.7.3.pet
Description  Updated pBurn
pet

 Download 
Filename  pburn_gtxt2-3.7.3.pet 
Filesize  71.7 KB 
Downloaded  336 Time(s) 
MoManager-ru_UA-pburn-3.7.3.tar.gz
Description  Full Russian translation this time.
gz

 Download 
Filename  MoManager-ru_UA-pburn-3.7.3.tar.gz 
Filesize  14.14 KB 
Downloaded  323 Time(s) 
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Sun 05 Aug 2012, 14:11    Post subject: ptiming
Subject description: simple things first
 

L18L wrote:
...Next I will try to convert the other languages.......


done
using shinobar's locale2gettext in
Code:
#!/bin/sh
#
# convert translation file "Zigbert" to "Gettext"
# convert /usr/local/app/locals/LANG to /usr/share/locale/language/app.mo
#   which then can be checked/modified using momanager
# 20120805 by L18L

apps="`find /usr/local -name locals | cut -d'/' -f4`" # pburn pfind pfilesearch ...
apps="ptiming" # no, just pvd for now

for app in $apps; do
 [ "$app" = "pfind" ] && continue
 [ "$app" = "pfilesearch" ] && continue
 SOURCE=/usr/local/$app/locales
 [ -f "$SOURCE" ]  ||  SOURCE=/usr/local/$app/locals/en_US:english
 [ -f "$SOURCE" ]  ||  continue                   # nothing to translate here
 echo " converting /usr/local/$app ..."

 # locale2gettext usage: $APPNAME [PATH_TO_LOCALE_FILE] [TEXT_DOMAIN]"
 [ -f "$SOURCE.converted" ] || locale2gettext $SOURCE
 # $SOURCE.converted has LOCxxx=$(gettext "bla bla")
 
 langs=`ls /usr/local/$app/locals | cut -d'_' -f1 | sort -u`
 for lang in $langs; do # for each language
  [ "$lang" = "en" ] && continue
  echo "       from /usr/local/$app/locals/$lang ..."
  # input
  TEMPLfile=$SOURCE.converted
  # we know just ru and must say ru_RU
  LOCfile=`ls /usr/local/$app/locals/$lang* | head -n1`
  # output
  LOCfilePO=$LOCfile.po
 
echo '#, fuzzy
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
' > $LOCfilePO

  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
        [ "`echo $LINE | grep '^set'`" ]                   && continue     # skip
        [ "${LINE:0:7}" = "export " ] && LINE="${LINE//export }"           # delete 'export '
     
        LINEid=`echo $LINE | cut -d '=' -f1`
        msgid=`echo $LINE  | cut -d '"' -f2`
        msgstr=`grep $LINEid $LOCfile | cut -d '"' -f2 | head -n1`
       
        [ "`grep $LINEid $LOCfilePO`" ] && continue                         # avoid douplicates
        #echo "# $LINEid"
        #echo "msgid \"$msgid\""
        echo "msgstr \"$msgstr\""
        #echo ""

        echo "# $LINEid" >> $LOCfilePO
        echo "msgid \"$msgid\"" >> $LOCfilePO
        echo "msgstr \"$msgstr\"" >> $LOCfilePO
        echo "" >> $LOCfilePO

        ;;
   esac
  done < $TEMPLfile
 
  # create mo file and delete po file
  if [ "`msgfmt -o /usr/share/locale/$lang/LC_MESSAGES/$app.mo $LOCfilePO`" ]; then
   echo could not create /usr/share/locale/$lang/LC_MESSAGES/$app.mo
  else
   rm $LOCfilePO
   echo /usr/share/locale/$lang/LC_MESSAGES/$app.mo created
  fi
  echo ''
 done # lang
 echo " ... $app converted"
 rm $SOURCE.converted
done # app
echo "finished

You can edit the translations using momanager
"
exit 0

And in the created /usr/local/ptiming-converted just change this:
Code:
##set language
#. $APPDIR/locals/en_US:english #always run to fill gaps in translation
#LANGUAGE="`ls -1 $APPDIR/locals/ | grep ${LANG%.*}`"
##fallback to macrolanguage if available (ISO 639-1 two letter code: en, es, fr, etc.)
#if [ -z $LANGUAGE ]; then LANGUAGE="`ls -1 $APPDIR/locals/ | grep ${LANG%_*}:`"; fi
#[ "$LANGUAGE" != "en_US:english" ] && . $APPDIR/locals/$LANGUAGE 2> /dev/null
#
ptiming_converted.png
 Description   
 Filesize   30.03 KB
 Viewed   633 Time(s)

ptiming_converted.png

Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5723
Location: Valåmoen, Norway

PostPosted: Fri 10 Aug 2012, 02:28    Post subject:  

Pburn is updated with gettext - thanks a lot.

I have some time today - let's see what I get done..... will be back after the weekend


Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Fri 10 Aug 2012, 06:54    Post subject: pburn
Subject description: version
 

zigbert wrote:
Pburn is updated with gettext

downloaded version 3.7.4 shows as 3.7.3

Anyhow, I have converted all languages to pburn.mo using rodin.s `s version above.

So everyone will have to start not from zero


---

edit
going to test version now
pburn_NLS.pet
Description  some locals converted to pburn.mo
pet

 Download 
Filename  pburn_NLS.pet 
Filesize  48.96 KB 
Downloaded  373 Time(s) 
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5723
Location: Valåmoen, Norway

PostPosted: Fri 10 Aug 2012, 07:09    Post subject: Re: pfind
Subject description: alpha
 

L18L wrote:
Please test version 5.02

$TEXTDOMAIN=pfilesearch in your pFind. I guess it's because there only can be one text domain, and code from pFilesearch is embedded into pFind.

That means NLS files for pFilesearch will contain gettext-strings for both pFind and pFilesearch? Not the best solution for those who uses only pFilesearch as a backend for pBurn/pMusic.... My intention is to separate the backend and frontend.

What is the downside of having an unique $TEXTDOMAIN=pfind?


Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Fri 10 Aug 2012, 07:48    Post subject: Re: pfind
Subject description: alpha -> beta
 

zigbert wrote:
$TEXTDOMAIN=pfilesearch in your pFind. I guess it's because there only can be one text domain, and code from pFilesearch is embedded into pFind.

Good guess!
That was before Barry changed momanager.
Now everything is possible:
I will separate them and make a version 5.03
TEXTDOMAIN=pfind
and pfilesearch using TEXTDOMAIN=pfilesearch containing the messages from pfilesearch only.
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5723
Location: Valåmoen, Norway

PostPosted: Fri 10 Aug 2012, 08:11    Post subject: Re: pfind
Subject description: alpha -> beta
 

L18L wrote:
zigbert wrote:
$TEXTDOMAIN=pfilesearch in your pFind. I guess it's because there only can be one text domain, and code from pFilesearch is embedded into pFind.

Good guess!
That was before Barry changed momanager.
Now everything is possible:
I will separate them and make a version 5.03
TEXTDOMAIN=pfind
and pfilesearch using TEXTDOMAIN=pfilesearch containing the messages from pfilesearch only.
Thank you.
I will be back Tuesday (probably).


Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Fri 10 Aug 2012, 10:06    Post subject: Re: pfind
Subject description: beta
 

L18L wrote:
I will separate them and make a version 5.03
TEXTDOMAIN=pfind

done
included is german pfind.mo so you can test changinging of GUI language

for testers only, delete /root/.pfind/pfindrc Arrow

a lot of warnings like:
/usr/local/pfind/func: line 4: /tmp/pfind-TREE6413: Datei oder Verzeichnis nicht gefunden <-- not found
cat: /tmp/pfind-treeitems6413: Datei oder Verzeichnis nicht gefunden <-- not found
pfind-5.03.pet
Description  TEXTDOMAIN=pfind
was pfilesearch before
pet

 Download 
Filename  pfind-5.03.pet 
Filesize  23.33 KB 
Downloaded  323 Time(s) 
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5723
Location: Valåmoen, Norway

PostPosted: Mon 13 Aug 2012, 05:23    Post subject:  

Ok, updated stuff


Thank you guys
Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
zigbert


Joined: 29 Mar 2006
Posts: 5723
Location: Valåmoen, Norway

PostPosted: Sat 18 Aug 2012, 04:18    Post subject:  

I have started on the next cycle of pMusic, and will add gettext to it
_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
rodin.s

Joined: 22 Sep 2010
Posts: 338
Location: Ukraine

PostPosted: Sun 26 Aug 2012, 15:51    Post subject: pburn  

Pburn doesn't switch to Russian automatically. But it does when 'ru' is selected in Preferences. Usually gettext doesn't need this manual language switching. The language of an application is defined by global locale settings of the system.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 3 of 5 [72 Posts]   Goto page: Previous 1, 2, 3, 4, 5 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Puppy Projects » Localization Project
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0987s ][ Queries: 12 (0.0038s) ][ GZIP on ]