Author |
Message |
Argolance

Joined: 06 Jan 2008 Posts: 3255 Location: PORT-BRILLET (Mayenne - France)
|
Posted: Tue 06 Nov 2012, 09:26 Post subject:
Get .pot file from a 'gettexted' application script [SOLVED] |
|
Hello,
All is in the title...
Is there a command line which allows to get a pot file directly from a 'gettexted' application script?
Thank you for your attention.
Cordialement.
_________________

Last edited by Argolance on Tue 06 Nov 2012, 17:26; edited 2 times in total
|
Back to top
|
|
 |
musher0

Joined: 04 Jan 2009 Posts: 12075 Location: Gatineau (Qc), Canada
|
Posted: Tue 06 Nov 2012, 14:20 Post subject:
Re: How to get pot file from a gettexted script |
|
Argolance wrote: | Hello,
All is in the title...
Is there a command line which allows to get a pot file directly from a 'gettexted' script?
Thank you for your attention.
Cordialement. |
Allô, argolance.
How to get a "pot" file ?
As the above is written, if I was from the RCMP drug squad, I'd put a tail on you! What are you talking about? /
Comment obtenir un fichier de "pot" ?
Tel que ton message ci-dessus est écrit, si j'étais de l'escouade des stup. de la GRC, je te prendrais en filature ! De quoi tu parles, là ?
A+
_________________ musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
|
Back to top
|
|
 |
Argolance

Joined: 06 Jan 2008 Posts: 3255 Location: PORT-BRILLET (Mayenne - France)
|
Posted: Tue 06 Nov 2012, 15:05 Post subject:
|
|
Hello musher0,
Thank you for answering.
Quote: | As the above is written, if I was from the RCMP drug squad, I'd put a tail on you! What are you talking about? | This really made me burst of laughing... So, it is not a tail, but a spell you put on me!
When a script has to be internationalized with "gettext", it is consequently modified for. Ex: the chain "Do you smoke?" is changed as a gettext variable: Code: | $(gettext 'Do you smoke') |
All the chains (Ex: "Yes I do!" ) of the application are then written in a special file, Ex: my_application.pot from which is built a .po file, specific to a particular language, from which is created a .mo file, usually stored inside /usr/share/locale... This .pot file can be built manually. But it is sometimes long, boring, and especially precarious, because it is easy to make errors, making .mo files not to work properly.
I just would like to know if a command line could create the .pot file automatically directly from tlhe gettexted application script? Or perhaps a special simple application?
Cordialement.
_________________

Last edited by Argolance on Wed 07 Nov 2012, 05:03; edited 1 time in total
|
Back to top
|
|
 |
rodin.s
Joined: 22 Sep 2010 Posts: 340 Location: Ukraine
|
Posted: Tue 06 Nov 2012, 16:22 Post subject:
pot-file from script |
|
The command is (devx.sfs is needed):
Code: | xgettext -L shell file.sh -o file.pot |
or if you want to see it's content in terminal:
Code: | xgettext -L shell file.sh -o - |
|
Back to top
|
|
 |
Argolance

Joined: 06 Jan 2008 Posts: 3255 Location: PORT-BRILLET (Mayenne - France)
|
Posted: Tue 06 Nov 2012, 16:56 Post subject:
|
|
Thank you rodin.s!
Cordialement.
_________________

|
Back to top
|
|
 |
musher0

Joined: 04 Jan 2009 Posts: 12075 Location: Gatineau (Qc), Canada
|
Posted: Wed 07 Nov 2012, 16:39 Post subject:
|
|
Thanks for the explanation, argolance.
I'll recall Sgt. Preston and Rin-Tin-Tin to the station.
_________________ musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
|
Back to top
|
|
 |
vicmz

Joined: 15 Jan 2012 Posts: 1268
|
Posted: Thu 08 Nov 2012, 20:32 Post subject:
Re: pot-file from script |
|
rodin.s wrote: | The command is (devx.sfs is needed):
Code: | xgettext -L shell file.sh -o file.pot |
or if you want to see it's content in terminal:
Code: | xgettext -L shell file.sh -o - |
|
What if the script isn't gettexted yet? Is there a command to gettext a script?
_________________ Puppy Linux en español
|
Back to top
|
|
 |
rodin.s
Joined: 22 Sep 2010 Posts: 340 Location: Ukraine
|
Posted: Fri 09 Nov 2012, 14:13 Post subject:
command to gettext a script |
|
Would be nice but it has to be dome manually.
|
Back to top
|
|
 |
vicmz

Joined: 15 Jan 2012 Posts: 1268
|
Posted: Fri 09 Nov 2012, 15:53 Post subject:
Re: command to gettext a script |
|
rodin.s wrote: | Would be nice but it has to be dome manually. |
Let's say I want to gettext the script in this PET. What modifications should I do? Is it the same for all scripts or it depends on the type of script?
|
Back to top
|
|
 |
ASRI éducation

Joined: 09 May 2009 Posts: 3203 Location: France
|
Posted: Sat 10 Nov 2012, 07:17 Post subject:
Re: command to gettext a script |
|
vicmz wrote: | ...Let's say I want to gettext the script in this PET. What modifications should I do? Is it the same for all scripts or it depends on the type of script? |
I have exactly the same question.
|
Back to top
|
|
 |
ASRI éducation

Joined: 09 May 2009 Posts: 3203 Location: France
|
Posted: Sat 10 Nov 2012, 09:11 Post subject:
Re: command to gettext a script |
|
ASRI éducation wrote: | vicmz wrote: | ...Let's say I want to gettext the script in this PET. What modifications should I do? Is it the same for all scripts or it depends on the type of script? |
I have exactly the same question. |
I managed to translate wmswitcher, I will send the packet to 01micko to know what he thinks about.
Infos to translate /usr/share/doc/HOWTO-internatialization.htm
|
Back to top
|
|
 |
vicmz

Joined: 15 Jan 2012 Posts: 1268
|
Posted: Sat 10 Nov 2012, 11:19 Post subject:
Re: command to gettext a script |
|
ASRI éducation wrote: |
I managed to translate wmswitcher |
Me too. In fact, for apps such as wmswitcher, desksetup, pupshutdown, pmount, jwm config., etc., I've been translating the scripts directly, but this must be done with patience and care to avoid breaking the code, which will cause the app to not work. Also, if you manage to gettext an app you're giving others the chance to translate to their language by just installing it and using momanager. Another advantage is that the new gettexted apps are put into woof, then you just have to put the .mo file in the langpack. Official language packs are not meant to include any executables to ensure compatibility across Puppy versions, so the apps I translate by modifying the scripts have to be offered separately. If there are new versions of those apps, I have to translate the scripts again from scratch, while for gettexted apps you just have to update through momanager.
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Sat 10 Nov 2012, 12:05 Post subject:
wmswitcher |
|
Hello world
I do not know what you have been translating...
here is
wmswitcher internationalized
translatable now using momanager
cheers
/usr/sbin/wmswitcher wrote: | #!/bin/sh -a
#simple switcher for whatever WM and back
#01micko 2010 GPL see /usr/share/doc/legal/
#Backup /usr/bin/restartwm (and hide it)
#ver 0.1 #2010-07-11
#ver 0.3 #2010-07-12
#ver 0.4 #2010-07-25
#ver 0.5 #2010-08-01
#ver 0.6 #2010-10-17
#ver 0.7 #2010-10-28
#ver 0.7 #2010-10-31
#ver 0.10 #2010-11-04
#ver 0.11 #2010-11-06
#ver 0.12 #2010-11-06
#ver 0.13 #2010-11-07
#ver 0.14 #2010-11-09
#ver 0.16 #2011-01-03
#ver 0.17 #2011-06-11
#ver 0.18 #20120318
#ver 0.19 #20121110 internationalized
#set -x
ver="0.19"
export TEXTDOMAIN=wmswitcher
export OUTPUT_CHARSET=UTF-8
#find images for gui
IMGDIR="/usr/share/pixmaps"
CURRENTWM=`cat /etc/windowmanager`
#icewm changer
ICEWM(){
if [ -f $HOME/.gtkrc-2.0.bak ];then mv -f $HOME/.gtkrc-2.0.bak $HOME/.gtkrc-2.0
fi
echo 'icewm'> /tmp/nextwm
restartwm icewm
[ "$CURRENTWM" = "openbox" ]&& killall fbpanel
[[ "$CURRENTWM" = "startxfce4" || "$CURRENTWM" = "startfluxbox" || "$CURRENTWM" = "startkde" ]]&& killall X
}
#jwm changer
JWM(){
if [ -f $HOME/.gtkrc-2.0.bak ];then mv -f $HOME/.gtkrc-2.0.bak $HOME/.gtkrc-2.0
fi
echo 'jwm'> /tmp/nextwm
rm -f /tmp/wmswithcer
restartwm jwm
[ "$CURRENTWM" = "openbox" ]&& killall fbpanel
[[ "$CURRENTWM" = "startxfce4" || "$CURRENTWM" = "startfluxbox" || "$CURRENTWM" = "startkde" ]]&& killall X
}
#xfce4 changer #ditto icewm comment
XFCE(){
if [ -f $HOME/.gtkrc-2.0 ];then mv -f $HOME/.gtkrc-2.0 $HOME/.gtkrc-2.0.bak
fi
restartwm startxfce4
[ "$CURRENTWM" = "openbox" ]&& killall fbpanel
[[ "$CURRENTWM" = "startxfce4" || "$CURRENTWM" = "startfluxbox" || "$CURRENTWM" = "startkde" ]]&& killall X
}
#openbox
OPENBOX(){
if [ -f $HOME/.gtkrc-2.0.bak ];then mv -f $HOME/.gtkrc-2.0.bak $HOME/.gtkrc-2.0
fi
echo 'openbox'> /tmp/nextwm
restartwm openbox
[ "$CURRENTWM" = "openbox" ]&& killall fbpanel
[[ "$CURRENTWM" = "startxfce4" || "$CURRENTWM" = "startfluxbox" || "$CURRENTWM" = "startkde" ]]&& killall X
}
#fluxbox
FLUXBOX(){
if [ -f $HOME/.gtkrc-2.0.bak ];then mv -f $HOME/.gtkrc-2.0.bak $HOME/.gtkrc-2.0
fi
echo 'startfluxbox'> /tmp/nextwm
restartwm startfluxbox
[ "$CURRENTWM" = "openbox" ]&& killall fbpanel
[[ "$CURRENTWM" = "startxfce4" || "$CURRENTWM" = "startfluxbox" || "$CURRENTWM" = "startkde" ]]&& killall X
}
#kde
KDE(){
if [ -f $HOME/.gtkrc-2.0 ];then mv -f $HOME/.gtkrc-2.0 $HOME/.gtkrc-2.0.bak
fi
restartwm startkde
[ "$CURRENTWM" = "openbox" ]&& killall fbpanel
[[ "$CURRENTWM" = "startxfce4" || "$CURRENTWM" = "startfluxbox" || "$CURRENTWM" = "startkde" ]]&& killall X
}
#emerald changer
EMERALD(){
if [ -f $HOME/.gtkrc-2.0.bak ];then mv -f $HOME/.gtkrc-2.0.bak $HOME/.gtkrc-2.0
fi
echo 'dummy'> /tmp/nextwm
restartwm dummy
[ "$CURRENTWM" = "openbox" ]&& killall fbpanel
[[ "$CURRENTWM" = "startxfce4" || "$CURRENTWM" = "startfluxbox" || "$CURRENTWM" = "startkde" ]]&& killall X
}
#switch function
SWITCH(){
if [ $RADIOBUTTON1 = true ];then JWM
elif [ $RADIOBUTTON2 = true ];then ICEWM
elif [ $RADIOBUTTON3 = true ];then XFCE
elif [ $RADIOBUTTON4 = true ];then OPENBOX
elif [ $RADIOBUTTON5 = true ];then FLUXBOX
elif [ $RADIOBUTTON6 = true ];then KDE
elif [ $RADIOBUTTON7 = true ];then EMERALD
fi
}
#current window manager and radio button defaults
case $CURRENTWM in
jwm) RADIOBUTTON1=true
RADIOBUTTON2=false
RADIOBUTTON3=false
RADIOBUTTON4=false
RADIOBUTTON5=false
RADIOBUTTON6=false
RADIOBUTTON7=false
;;
icewm*) RADIOBUTTON2=true
RADIOBUTTON1=false
RADIOBUTTON3=false
RADIOBUTTON4=false
RADIOBUTTON5=false
RADIOBUTTON6=false
RADIOBUTTON7=false
;;
startxfce4*) RADIOBUTTON3=true
RADIOBUTTON2=false
RADIOBUTTON1=false
RADIOBUTTON4=false
RADIOBUTTON5=false
RADIOBUTTON6=false
RADIOBUTTON7=false
;;
openbox) RADIOBUTTON4=true
RADIOBUTTON2=false
RADIOBUTTON3=false
RADIOBUTTON1=false
RADIOBUTTON5=false
RADIOBUTTON6=false
RADIOBUTTON7=false
;;
startfluxbox) RADIOBUTTON5=true
RADIOBUTTON2=false
RADIOBUTTON3=false
RADIOBUTTON4=false
RADIOBUTTON1=false
RADIOBUTTON6=false
RADIOBUTTON7=false
;;
startkde) RADIOBUTTON6=true
RADIOBUTTON5=false
RADIOBUTTON2=false
RADIOBUTTON3=false
RADIOBUTTON4=false
RADIOBUTTON1=false
RADIOBUTTON7=false
;;
dummy) RADIOBUTTON7=true
RADIOBUTTON5=false
RADIOBUTTON2=false
RADIOBUTTON3=false
RADIOBUTTON4=false
RADIOBUTTON1=false
RADIOBUTTON6=false
;;
*)echo "woops, unsupported"; exit
;;
esac
#find window managers!
JWM_IS=`which jwm`
ICEWM_IS=`which icewm`
XFCE4_IS=`which xfwm4`
OPENBOX_IS=`which openbox`
FLUXBOX_IS=`which startfluxbox`
KDE_IS=`which startkde`
EMERALD_IS=`which dummy`
#GUI vars
if [[ "$JWM_IS" != "" ]];then JWMGUI="
<radiobutton>
<variable>RADIOBUTTON1</variable>
<label>\"JWM\"</label>
<default>$RADIOBUTTON1</default>
</radiobutton>
<pixmap><input file>$IMGDIR/jwm.png</input></pixmap>
"
fi
if [[ "$ICEWM_IS" != "" ]];then ICEWMGUI="
<radiobutton>
<variable>RADIOBUTTON2</variable>
<label>\"IceWM\"</label>
<default>$RADIOBUTTON2</default>
</radiobutton>
<pixmap><input file>$IMGDIR/icewm-logo.png</input></pixmap>
"
fi
if [[ "$XFCE4_IS" != "" ]];then XFCEGUI="
<radiobutton>
<variable>RADIOBUTTON3</variable>
<label>\"Xfce4\"</label>
<default>$RADIOBUTTON3</default>
</radiobutton>
<pixmap><input file>$IMGDIR/xfce4_xicon3.png</input></pixmap>
"
fi
if [[ "$OPENBOX_IS" != "" ]];then OPENBOXGUI="
<radiobutton>
<variable>RADIOBUTTON4</variable>
<label>\"Openbox\"</label>
<default>$RADIOBUTTON4</default>
</radiobutton>
<pixmap><input file>$IMGDIR/openbox1.png</input></pixmap>
"
fi
if [[ "$FLUXBOX_IS" != "" ]];then FLUXGUI="
<radiobutton>
<variable>RADIOBUTTON5</variable>
<label>\"Fluxbox\"</label>
<default>$RADIOBUTTON5</default>
</radiobutton>
<pixmap><input file>$IMGDIR/fluxbox.png</input></pixmap>
"
fi
if [[ "$KDE_IS" != "" ]];then KDEGUI="
<radiobutton>
<variable>RADIOBUTTON6</variable>
<label>\"Kde\"</label>
<default>$RADIOBUTTON6</default>
</radiobutton>
<pixmap><input file>$IMGDIR/kde.png</input></pixmap>
"
fi
if [[ "$EMERALD_IS" != "" ]];then EMERALDGUI="
<radiobutton>
<variable>RADIOBUTTON7</variable>
<label>\"Emerald-compiz\"</label>
<default>$RADIOBUTTON7</default>
</radiobutton>
<pixmap><input file>$IMGDIR/emerald.png</input></pixmap>
"
fi
#GUI
switcheroo="
<window title=\"$(gettext 'WM Switcher') $ver\" resizable=\"false\">
<vbox>
<frame $(gettext 'Choose the window manager you would like to use')>
<vbox>
$JWMGUI
$ICEWMGUI
$XFCEGUI
$OPENBOXGUI
$FLUXGUI
$KDEGUI
$EMERALDGUI
</vbox>
</frame>
<frame $(gettext 'Important Information')>
<text use-markup=\"true\" xalign=\"0\"><label>\"<b>$(gettext 'Restart X')</b> $(gettext 'will switch WMs and restart X now')\"</label></text>
<text use-markup=\"true\" xalign=\"0\"><label>\"<b>$(gettext 'Note:')</b><i> $(gettext 'Restarting X will kill all your open applications')</i>\"</label></text>
<text use-markup=\"true\"><label>\"<i>$(gettext 'Save your work before you continue')</i>\"</label></text>
</frame>
<hbox homogeneous=\"true\">
<button>
<label>$(gettext 'Restart X')</label>
<input file stock=\"gtk-apply\"></input>
<action>SWITCH</action>
<action>restartwm</action>
<action>EXIT:restartX</action>
</button>
</hbox>
</vbox>
</window>"
gtkdialog3 -p switcheroo
unset switcheroo
#END
|
|
Back to top
|
|
 |
ASRI éducation

Joined: 09 May 2009 Posts: 3203 Location: France
|
Posted: Sat 10 Nov 2012, 14:15 Post subject:
Re: wmswitcher |
|
L18L wrote: | Hello world
I do not know what you have been translating...
here is
wmswitcher internationalized
translatable now using momanager
cheers
|
Hello L18L,
I have translate ver 0.18
|
Back to top
|
|
 |
vicmz

Joined: 15 Jan 2012 Posts: 1268
|
Posted: Sat 10 Nov 2012, 15:02 Post subject:
Re: wmswitcher |
|
ASRI éducation wrote: | L18L wrote: | Hello world
I do not know what you have been translating...
here is
wmswitcher internationalized
translatable now using momanager
cheers
|
Hello L18L,
I have translate ver 0.18  |
Don't worry, it is the same code. L18L upgraded the script to version 0.19 because it is now gettexted, and also marked in red what has to be done in order to gettext a script. Thanks, L18L.
And thanks, rodin.s too, for the gettext commands.
Description |
WM Switcher internationalised by L18L
|

Download |
Filename |
wmswitcher-0.19.pet |
Filesize |
18.42 KB |
Downloaded |
354 Time(s) |
_________________ Puppy Linux en español
Last edited by vicmz on Thu 17 Jan 2013, 23:24; edited 2 times in total
|
Back to top
|
|
 |
|