Page 1 of 1

Get .pot file from a 'gettexted' application script [SOLVED]

Posted: Tue 06 Nov 2012, 13:26
by Argolance
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.

Re: How to get pot file from a gettexted script

Posted: Tue 06 Nov 2012, 18:20
by musher0
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! :D 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 ! :D De quoi tu parles, là ? :)

A+

Posted: Tue 06 Nov 2012, 19:05
by Argolance
Hello musher0,
Thank you for answering.
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?
:lol: :lol: :lol: 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: Select all

$(gettext 'Do you smoke')
All the chains (Ex: "Yes I do!" :wink: ) 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.

pot-file from script

Posted: Tue 06 Nov 2012, 20:22
by rodin.s
The command is (devx.sfs is needed):

Code: Select all

xgettext -L shell file.sh -o file.pot
or if you want to see it's content in terminal:

Code: Select all

xgettext -L shell file.sh -o -

Posted: Tue 06 Nov 2012, 20:56
by Argolance
Thank you rodin.s!

Cordialement.

Posted: Wed 07 Nov 2012, 20:39
by musher0
Thanks for the explanation, argolance.
I'll recall Sgt. Preston and Rin-Tin-Tin to the station. :P

Re: pot-file from script

Posted: Fri 09 Nov 2012, 00:32
by vicmz
rodin.s wrote:The command is (devx.sfs is needed):

Code: Select all

xgettext -L shell file.sh -o file.pot
or if you want to see it's content in terminal:

Code: Select all

xgettext -L shell file.sh -o -
What if the script isn't gettexted yet? Is there a command to gettext a script?

command to gettext a script

Posted: Fri 09 Nov 2012, 18:13
by rodin.s
Would be nice but it has to be dome manually.

Re: command to gettext a script

Posted: Fri 09 Nov 2012, 19:53
by vicmz
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?

Re: command to gettext a script

Posted: Sat 10 Nov 2012, 11:17
by ASRI éducation
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.

Re: command to gettext a script

Posted: Sat 10 Nov 2012, 13:11
by ASRI éducation
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

Re: command to gettext a script

Posted: Sat 10 Nov 2012, 15:19
by vicmz
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.

wmswitcher

Posted: Sat 10 Nov 2012, 16:05
by L18L
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

Re: wmswitcher

Posted: Sat 10 Nov 2012, 18:15
by ASRI éducation
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 :(

Re: wmswitcher

Posted: Sat 10 Nov 2012, 19:02
by vicmz
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. :D
And thanks, rodin.s too, for the gettext commands.

Re: wmswitcher

Posted: Sun 11 Nov 2012, 02:35
by ASRI éducation
vicmz wrote:...
Thanks, L18L. :D
Yes, thanks L18L.

Posted: Mon 12 Nov 2012, 13:35
by L18L
Thank you all for the thanks :lol: