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 21 Aug 2014, 00:38
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
gettext: escape single quotes... and other goodies [SOLVED]
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 2 [19 Posts]   Goto page: Previous 1, 2
Author Message
L18L

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

PostPosted: Wed 13 Feb 2013, 13:46    Post subject: gettext: escape single quotes inside a chain? [SOLVED]
Subject description: title
 

Argolance wrote:
... this thread became a very useful "tutorial"...


+1 Very Happy

Argolance,
maybe you add something to the title like
..and other goodies
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 1825
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Wed 13 Feb 2013, 13:51    Post subject:  

L18L wrote:
maybe you add something to the title like
..and other goodies

Done!

Last edited by Argolance on Thu 14 Feb 2013, 04:41; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
don570


Joined: 10 Mar 2010
Posts: 3250
Location: Ontario

PostPosted: Wed 13 Feb 2013, 15:19    Post subject:  

...continuing the tutorial Wink

I tested eval_gettext using the instructions HERE

You can use the echoed text in useful situations. Here's an example with
yaf-splash. Take the echo of eval_gettext command
Code:

eval_gettext "Remaining files: \$filecount"; echo


... and put backquotes around it to make a command's output text
and stick it in a standard yaf-splash line.

Code:

yaf-splash -close box -fontsize large -bg orange -fb black \
-text  "`eval_gettext \"Remaining files: \\\$filecount\"; echo`"


Notes:

1) Double quote character( " ) needs to be escaped i.e. \

2) The dollar sign character($) needs three 'Escapes' i.e. \\\


Here is the output of localised script in German...



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


Joined: 10 Mar 2010
Posts: 3250
Location: Ontario

PostPosted: Sat 16 Feb 2013, 15:54    Post subject:  

Here's another useful example this time with an Xdialog command
with multiple lines of text in the action line of a button.

First define a variable 'MESSAGE'

Warning ! 'Export' of variable must be used.

Code:
export MESSAGE=$(gettext "John's message\\nin the office")



Here is the action line of the button...

Code:
<action>Xdialog  --ok-label "$BTN4" --backtitle "\n\n    $MESSAGE  "  --msgbox  "" 0 0</action>


Here is the output if translated to French...




.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 2 [19 Posts]   Goto page: Previous 1, 2
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.0531s ][ Queries: 12 (0.0045s) ][ GZIP on ]