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 Sun 21 Oct 2018, 00:26
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Gettext question...
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message
ITSMERSH


Joined: 02 May 2018
Posts: 360

PostPosted: Thu 19 Jul 2018, 18:31    Post subject:  Gettext question...
Subject description: Gettext doesn't translate when using a variable in string/text
 

Hi.

I have this on top of the script:
Quote:
QTRSUITEVERSION="18.06.17"
MYTITLE="QTR Suite $QTRSUITEVERSION"

# Gettext, multiple Variables in Message
[ "`which gettext.sh`" != "" ] && . gettext.sh

# Gettext localization
export TEXTDOMAIN="QTR-Suite"
export OUTPUT_CHARSET=UTF-8

# Install DE locale
LOCALS="$APPDIR"/gettext-locales/de/LC_MESSAGES/"QTR-Suite".mo
[ -f "$LOCALS" ] && cp -a -u "$LOCALS" /usr/share/locale/de/LC_MESSAGES/"QTR-Suite".mo


And this in the Menu:
Quote:
<menuitem label="'$(gettext "Archiving $MYTITLE RoxApp")'" icon="qtrsuite" accel-key="'$skey'" accel-mods="'$strgshiftkey'" tooltip-markup="'$(gettext " Archiving $MYTITLE RoxApp to save all Data, Songs and Mixdowns in a .tar.gz Archive.")'">
<action>'$APPDIR'/AppRun -MakeArchive &</action>
<action>SaveWindowGeometry "'$WINGEOCONFIG'"</action>
</menuitem>

And then I got this in the .po file:
Quote:
msgid "Archiving %s RoxApp"
msgstr "%s RoxApp archivieren"

Though, when starting the program, gettext doesn't translate

Archiving QTR Suite 18.06.17 RoxApp

to

QTR Suite 18.06.17 RoxApp archivieren

So, what am I doing wrong here?

Thanks in advance...

_________________
RSH
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 5161
Location: Ontario

PostPosted: Thu 19 Jul 2018, 19:13    Post subject:  

Solution is eval_gettext

Try the examples on this page
http://www.murga-linux.com/puppy/viewtopic.php?t=96326
__________________________________________________________
Back to top
View user's profile Send private message 
ITSMERSH


Joined: 02 May 2018
Posts: 360

PostPosted: Thu 19 Jul 2018, 21:47    Post subject:  

No, didn't get this to work. Crying or Very sad
_________________
RSH
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 5161
Location: Ontario

PostPosted: Mon 23 Jul 2018, 12:34    Post subject: example of eval_gettext  

I researched eval_gettext ....
It works well but I found that it needs strong quotes for momanager
to work . Here is the example I provided in attachment...
Read it and test in momanager.

Code:
`eval_gettext 'Bacon Recorder $VERSION'`


If I had used weak quotes the script would appear to work in terminal but momanager wouldn't make a po file.

If you still have problems then you should post the script here and
someone can do the gettext conversion for you.
_______________________________________________
example-eval-gettext.tar.gz
Description  example of eval_gettext
gz

 Download 
Filename  example-eval-gettext.tar.gz 
Filesize  1016 Bytes 
Downloaded  26 Time(s) 
Back to top
View user's profile Send private message 
ITSMERSH


Joined: 02 May 2018
Posts: 360

PostPosted: Mon 23 Jul 2018, 20:56    Post subject:  

Thanks.

I will try this.

Yes, I think I used weak quotes...

_________________
RSH
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [5 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
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.0540s ][ Queries: 13 (0.0090s) ][ GZIP on ]