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

For efforts in internationalising Puppy and solving problems in this area
Post Reply
Message
Author
User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

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

#1 Post 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.
Last edited by Argolance on Tue 06 Nov 2012, 21:26, edited 2 times in total.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

Re: How to get pot file from a gettexted script

#2 Post 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+
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#3 Post 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.
Last edited by Argolance on Wed 07 Nov 2012, 09:03, edited 1 time in total.

rodin.s
Posts: 344
Joined: Wed 22 Sep 2010, 19:50
Location: Ukraine

pot-file from script

#4 Post 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 -

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#5 Post by Argolance »

Thank you rodin.s!

Cordialement.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#6 Post by musher0 »

Thanks for the explanation, argolance.
I'll recall Sgt. Preston and Rin-Tin-Tin to the station. :P
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
vicmz
Posts: 1262
Joined: Sun 15 Jan 2012, 22:47

Re: pot-file from script

#7 Post 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?
[url=http://murga-linux.com/puppy/viewtopic.php?t=76948]Puppy Linux en español[/url]

rodin.s
Posts: 344
Joined: Wed 22 Sep 2010, 19:50
Location: Ukraine

command to gettext a script

#8 Post by rodin.s »

Would be nice but it has to be dome manually.

User avatar
vicmz
Posts: 1262
Joined: Sun 15 Jan 2012, 22:47

Re: command to gettext a script

#9 Post 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?

User avatar
ASRI éducation
Posts: 3197
Joined: Sat 09 May 2009, 12:10
Location: France
Contact:

Re: command to gettext a script

#10 Post 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.

User avatar
ASRI éducation
Posts: 3197
Joined: Sat 09 May 2009, 12:10
Location: France
Contact:

Re: command to gettext a script

#11 Post 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

User avatar
vicmz
Posts: 1262
Joined: Sun 15 Jan 2012, 22:47

Re: command to gettext a script

#12 Post 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.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

wmswitcher

#13 Post 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

User avatar
ASRI éducation
Posts: 3197
Joined: Sat 09 May 2009, 12:10
Location: France
Contact:

Re: wmswitcher

#14 Post 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 :(

User avatar
vicmz
Posts: 1262
Joined: Sun 15 Jan 2012, 22:47

Re: wmswitcher

#15 Post 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.
Attachments
wmswitcher-0.19.pet
WM Switcher internationalised by L18L
(18.42 KiB) Downloaded 464 times
Last edited by vicmz on Fri 18 Jan 2013, 03:24, edited 2 times in total.
[url=http://murga-linux.com/puppy/viewtopic.php?t=76948]Puppy Linux en español[/url]

User avatar
ASRI éducation
Posts: 3197
Joined: Sat 09 May 2009, 12:10
Location: France
Contact:

Re: wmswitcher

#16 Post by ASRI éducation »

vicmz wrote:...
Thanks, L18L. :D
Yes, thanks L18L.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

#17 Post by L18L »

Thank you all for the thanks :lol:

Post Reply