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 Fri 28 Nov 2014, 03:01
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
localizing-shell-scripts-without bashisms, gettext or ...
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 5 [63 Posts]   Goto page: 1, 2, 3, 4, 5 Next
Author Message
L18L

Joined: 19 Jun 2010
Posts: 2579
Location: www.eussenheim.de/

PostPosted: Mon 14 Nov 2011, 16:51    Post subject:  localizing-shell-scripts-without bashisms, gettext or ...
Subject description: for example: askpass 5 messages and NEW: alsawizard
 

Inspired by technosaurus' work on this, see

http://bashismal.blogspot.com/2011/10/localizing-shell-scripts-without.html

I have been working on an example just a little bit larger then “hello world”.

It is the script /usr/sbin/askpass which is needed in installations for non-privileged user fido.

There are just 5 message strings that can be translated.

The first one is:
This application wants to run:
This is replaced by:
${_M_1:-This application wants to run:}

I have chosen to mark the variables by names starting _M_ and number. _M_ is a unique identifier used for creation of some files.

Here is the script using this method for internationalization
Quote:

#!/bin/sh
#Barry Kauler 2011, GPL3 (/usr/share/doc/legal)
#specified in /etc/sudoers or /etc/sudo.conf, gui-helper for sudo. (path compiled-in to my sudo PET)
#110513 display name of app that is requesting to run.
#111112 i18n by L18L using Technosaurus' method <smile>
# /dev/console: write permission for users required !!!

LANGPATH=/usr/share/locale/${LANG%_*}/askpass
[ -f $LANGPATH ] && . $LANGPATH


PSALL="`ps`"
CALLEDAPP="`echo "$PSALL" | grep -o ' sudo \-A .*' | tr -s ' ' | cut -f 4 -d ' '`"
if [ "$CALLEDAPP" ];then
INSERTMSG=" <text><label>${_M_1:-This application wants to run:}</label></text>
<text><label>${CALLEDAPP}</label></text>
<text><label>${_M_2:-The administrator password is required:}</label></text>
"
else
INSERTMSG="<text><label>${_M_3:-Please enter the administrator password required to run this application:}</label></text>"
fi

if [ $DISPLAY ];then
export ASKDIALOG="
<window title=\"AskPass\" decorated=\"false\" window_position=\"1\" skip_taskbar_hint=\"true\">
<vbox>
<frame>
${INSERTMSG}
<entry invisible_char=\"x\" visibility=\"false\" width_chars=\"25\">
<variable>ADMINPASSWORD</variable>
</entry>

<hbox>
<button ok></button>
</hbox>
</frame>
</vbox>
</window>
"
RETVAL="`gtkdialog3 --program=ASKDIALOG 2>/dev/null`"
eval "$RETVAL"
else
echo >/dev/console
echo -n "${_M_4:-Type admin password required to run this app: }" >/dev/console
read -t 30 ADMINPASSWORD
[ "$ADMINPASSWORD" = "" ] && echo "${_M_5:-...failed}" >/dev/console
fi

#echo "$RETVAL"

echo "$ADMINPASSWORD" #return password to sudo.
###END###


Localization using attached script t12s (translate one to several)

Just start it!

At first dialog choose askpass (the one and only script that can be used for now)
No English language file needed

Start your own translation
and report bugs and success please

Enjoy
L

-------------
Edited 2011-11-15

Sorry, this description was a little terse Embarassed
Read next 2 posts before installing please Smile
t12s_translate.png
 Description   That is not really Spanish
but it works
 Filesize   23.25 KB
 Viewed   1901 Time(s)

t12s_translate.png

t12s.gz
Description  klick to unzip it
and move it to ~/my-applications/bin
or /usr/sbin
gz

 Download 
Filename  t12s.gz 
Filesize  2.14 KB 
Downloaded  422 Time(s) 

Last edited by L18L on Wed 16 Nov 2011, 16:17; edited 2 times in total
Back to top
View user's profile Send private message 
ferro10n

Joined: 15 Jun 2011
Posts: 106

PostPosted: Mon 14 Nov 2011, 18:47    Post subject:  

Awesome! Very Happy Do I have to run as fido instead of root to use this?
Also, the screenshot seems to be from Wary 5.2, how about other puppies?

_________________
A beginner Puppy Linux user
Intel(R) Celeron(R) CPU 2.13GHz 512MB
LiveCD user
Back to top
View user's profile Send private message Visit poster's website 
L18L

Joined: 19 Jun 2010
Posts: 2579
Location: www.eussenheim.de/

PostPosted: Tue 15 Nov 2011, 05:32    Post subject:  

ferro10n,
thanks for reporting Smile

Answering your questions:
1: which puppy
This was made in wary 5.2.190 and should work in all puppies that have yad installed. Test this by entering yad in a console. If 'command not found then' then install yad from repo puppy-common.

2: which user
- To reproduce the screenshot you must run as root.
- To install askpass copy above script into /usr/sbin/askpass (you might copy the original askpass to askpass.orig before)
- To make a translation just start the script t12s. You will be asked for administrator's password if you are not root, and you will requested to enable utf8 if it is disabled.

To test the script completely you must do this as fido or spot.
I have run it in a real console (CTRL-ALT-F2, switch back to X by CTRL-ALT-F4):
login as root, then
su fido
pmount
This will ask for administrator's password using your translation.

Note,
Doing this I have found a small bug in permission of /dev/console.
/dev/console is writable by root only. That is wrong!
Fix it now by:
Code:
chgrp users /dev/console
chmod g+w /dev/console


Looking forward to your translations Smile
edited:
start with es only
I will have to make some changes that pt_BR will work too
t12s_start.png
 Description   
 Filesize   20.46 KB
 Viewed   1798 Time(s)

t12s_start.png

Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2579
Location: www.eussenheim.de/

PostPosted: Tue 15 Nov 2011, 09:48    Post subject: askpass
Subject description: translatable for pt_BR, en_AU,....
 

L18L wrote:
...
edited:
start with es only
I will have to make some changes that pt_BR will work too


Just apply red marked changes to above /usr/sbin/askpass script
Quote:
#!/bin/sh
#Barry Kauler 2011, GPL3 (/usr/share/doc/legal)
#specified in /etc/sudoers or /etc/sudo.conf, gui-helper for sudo. (path compiled-in to my sudo PET)
#110513 display name of app that is requesting to run.
#111112 i18n by L18L using Technosaurus' method <smile>
#111114 expanding Technosaurus' method to enable en_AU, pt_BR,...
# /dev/console: write permission for users required !!!

#LANGPATH=/usr/share/locale/${LANG%_*}/askpass #111114
LANGPATH=/usr/share/locale/${LANG%.*}/askpass #111114
[ ! -f $LANGPATH ] && LANGPATH=/usr/share/locale/${LANG%_*}/askpass #111114

[ -f $LANGPATH ] && . $LANGPATH

PSALL="`ps`"
Back to top
View user's profile Send private message 
shinobar


Joined: 28 May 2009
Posts: 2631
Location: Japan

PostPosted: Tue 15 Nov 2011, 19:55    Post subject: Is it easier?
Subject description: i think gettext is more simple and easy.
 

As a conclusion, i do not think it is easier than using gettext.
gettext '.po' file can be edited by text editors. The original message is associated on the 'po' file.
But using the smert tools like poedit is more easier.

The way you discuss is the way MU did and now zigbert do.
There are some traps:
1. locale file path
MU placed the translation files at '/usr/share/locale/LANGAGE_CODE/LC_MESSAGES/APPNAME.mo'.
The place and the extention makes problem because they are not actually '.mo' files.
Zigbert places the translation files at /usr/local/APPNAME/locals with the file name as 'LANGUAGE_CODE:LANGUAGE_NAME'.
Therefore the translation files are here and there, so it takes a bit work to make a collection of NLS.
To place the translation files '/usr/share/locale/LANGAGE_CODE/APPNAME' is nice.

2. incomplete translations
The translation s are not always fully done.
When the programer add new messages, the old translations are lacking the messages.
If some messages are lacking, the program may fail.
Technosaulus proposes 'echo ${VAR:-default message}'. It is a solution but seems complax for me.
Another way is to make a default message file. But the program fails without the default message file.
I prefer to place the default messages at the top of the program. Like;
Code:
VAR="default message"
echo ${VAR}


3. searching path of the translation file from the language code
it can be 'pl' and/or 'pl_BR'.
Here is a code using a default message file, '/usr/share/locale/C/APPNAME':
Code:
LOCALEDIR=/usr/share/locale
LOCALEFILE=$(basename $0)
for D in C ${LANG%_*} ${LANG%.*}; do
  F="$LOCALEDIR/$D/$LOCALEFILE"
  [ -f "$F" ] && . "$F"
done


4. finding original messages
If the messages are in lines of the program code, it is a hard work to find the original messages to make the translations.
It is a hard work for the programmer if he offers a default messages as a file.
It is a hard work to replace the messages with making the variable names.
The xgettext automatically makes '.po' file with the message id's.

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
Back to top
View user's profile Send private message Visit poster's website 
L18L

Joined: 19 Jun 2010
Posts: 2579
Location: www.eussenheim.de/

PostPosted: Wed 16 Nov 2011, 09:06    Post subject: Re: Is it easier?
Subject description: it is all about speed
 

shinobar,
thanks for your input.

First:
- I like translations
- I like different methods
- I like to use the best available
- I like gettext. It is not out!

shinobar wrote:
As a conclusion, i do not think it is easier than using gettext.


The goal is: faster than gettext

First time I was fascinated by speed see
http://murga-linux.com/puppy/viewtopic.php?t=70804 please

shinobar wrote:
gettext '.po' file can be edited by text editors. The original message is associated on the 'po' file.


The file '/usr/share/locale/LANGAGE_CODE/APPNAME' can be edited by text editors though without original message. My little GUI ‘t12s’ shows original message at translating. These are taken from a temporary file. No need to save it anywhere!

shinobar wrote:
But using the smert tools like poedit is more easier.


Maybe. Let us wait if and how ferro10n will succeed translating to es and pt_BR.


shinobar wrote:
The way you discuss is the way MU did and now zigbert do.


Sorry, I do not understand this. But I will try to recomment further.

shinobar wrote:
There are some traps:
1. locale file path
MU placed the translation files at '/usr/share/locale/LANGAGE_CODE/LC_MESSAGES/APPNAME.mo'.
The place and the extention makes problem because they are not actually '.mo' files.

That is the very sad truth. [joke]better call them MU[/joke]

shinobar wrote:
Zigbert places the translation files at /usr/local/APPNAME/locals with the file name as 'LANGUAGE_CODE:LANGUAGE_NAME'.
Therefore the translation files are here and there, so it takes a bit work to make a collection of NLS.


You know it is more than a bit.


shinobar wrote:
To place the translation files '/usr/share/locale/LANGAGE_CODE/>APPNAME' is nice.


To place the translation files '/usr/share/locale/LANGAGE_CODE/APPNAME'
was technosaurus’ idea.

shinobar wrote:
2. incomplete translations
The translation s are not always fully done.
When the programer add new messages, the old translations are lacking the messages.


New messages always have to be translated new. Where is the problem? Just work to translate and update.


shinobar wrote:
If some messages are lacking, the program may fail.


No. The original English message is shown.


shinobar wrote:
Technosaulus proposes 'echo ${VAR:-default message}'. It is a solution but seems complax for me.


Seemed the same to me at the beginning. But using it now it is more than just OK. We all need time to learn new things.


shinobar wrote:
Another way is to make a default message file. But the program fails without the default message file.


That is why a default message file is NOT needed, so no fail.


shinobar wrote:
I prefer to place the default messages at the top of the program. Like;
Code:

VAR="default message"
echo ${VAR}



And I prefer to have the message there where it is used.
Simplest example:
echo “$(gettext ’hello worls‘)”
or
echo “${_M_x:-hello world}
better than
echo “$LOC_x”

shinobar wrote:
3. searching path of the translation file from the language code
it can be 'pl' and/or 'pl_BR'.
Here is a code using a default message file, '/usr/share/locale/C/APPNAME':

Code:

LOCALEDIR=/usr/share/locale
LOCALEFILE=$(basename $0)
for D in C ${LANG%_*} ${LANG%.*}; do
F="$LOCALEDIR/$D/$LOCALEFILE"
[ -f "$F" ] && . "$F"
done



#111114 expanding Technosaurus' method to enable en_AU, pt_BR,...
Did it not work for you?


shinobar wrote:
4. finding original messages
If the messages are in lines of the program code, it is a hard work to find the original messages to make the translations.


grep _M_ APPNAME

or producing VAR=”...“

grep _M_ APPNAME | cut -d "{" -f 2- | rev | cut -d "}" -f 2- | rev \
| sed -r 's/:-/="/g' | sed -r 's/$/"/g' > anywhere/t12s_${APPNAME}_en

That was not yet published (my work in progress) and will hopefully enable use of variables in a message using t12s.
See http://murga-linux.com/puppy/viewtopic.php?t=73041 please.

shinobar wrote:
It is a hard work for the programmer if he offers a default messages as a file.
It is a hard work to replace the messages with making the variable names.


Yes. Until now I did not think to change any existing internationalized script to this method. Just made one, /usr/sbin/askpass, new, that was easy. If this new method will be accepted I could think about making a script for conversion.

shinobar wrote:
The xgettext automatically makes '.po' file with the message id's.

I also can easily create automatically .po file if that makes sense.

Smile
Back to top
View user's profile Send private message 
shinobar


Joined: 28 May 2009
Posts: 2631
Location: Japan

PostPosted: Wed 16 Nov 2011, 10:07    Post subject: Re: Is it easier?
Subject description: it is all about speed
 

L18L wrote:
The goal is: faster than gettext

How the
Code:
echo “${_M_x:-hello world}”

can be faster or easier than
Code:
echo “$(gettext ’hello worls‘)”

Gettext method is already established and there are many smart tools.
How can it be faster without gettext?
Consider making rules(for example the variable, _M_x, naming or numbering rule), making tools and learning how to.

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
Back to top
View user's profile Send private message Visit poster's website 
L18L

Joined: 19 Jun 2010
Posts: 2579
Location: www.eussenheim.de/

PostPosted: Wed 16 Nov 2011, 12:32    Post subject: Re: Is it easier?
Subject description: it is all about speed
 

shinobar wrote:
...
How can it be faster without gettext?


Technosauraus has explained how.
I can only show that it is faster.

Code:
# time echo "$(gettext 'hello world')"

hello world

real   0m0.014s
user   0m0.016s
sys   0m0.000s

# time echo “${_M_x:-hello world}”
“hello world”

real   0m0.000s
user   0m0.000s
sys   0m0.000s
#


Surely it is not easier maybe because it is only some days old and gettext is about 10 years old.
Smile
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2579
Location: www.eussenheim.de/

PostPosted: Wed 16 Nov 2011, 15:54    Post subject: localizing-shell-scripts-without bashisms, gettext or ...
Subject description: another example
 

It is fast!

Another script /usr/sbin/alsawizard prepared translated and tested in 1 hour. Here it is:

Quote:
#!/bin/sh
#Lesser GPL licence v2 (/usr/share/doc/legal/lgpl-2.1.txt). 2007 www.puppylinux.com

#if [ "`/etc/rc.d/rc.alsa status | grep "not loaded"`" = "" ];then
# Xdialog --title "ALSA sound Wizard" --yesno "ALSA sound modules are currently loaded and active.\n
#If you answer Yes here, modules will be unloaded,\nand the Wizard will continue.\nAnswer No, Wizard will exit..." 0 0
# [ ! $? -eq 0 ] && exit
# /etc/rc.d/rc.alsa stop
#fi

#...above not necessary, alsaconf does it.

#100501 weird, nvidia xorg pet pkg seems to need the files created by busybox depmod,
#however alsaconf has been modified to run depmod-FULL. so, rerun busybox depmod after...

#110513 put up a preliminary dlg...
AUDIOICON='/usr/local/lib/X11/mini-icons/mini-speaker.xpm'
[ -f /usr/share/retrovol/images/working.png ] && AUDIOICON='/usr/share/retrovol/images/working.png'
#/usr/local/apps/ROX-Filer/ROX/MIME/audio.png

# <frame THREE: Reboot>
# <text><label>It is unusual, but presuming that you have booted Puppy for the first time, sometimes you have to shutdown (and create a session save-file) and reboot for sound to work. Various peripherals, especially modems, may have conflicting kernel sound driver requirements, which might not get sorted out until the second boot. If you played with the mixer settings but your sound is still not working, it is recommended that you still do not run the ALSA Wizard, instead choose to reboot (see menu). Recommend click 'EXIT' button below.</label></text>
# </frame>

#111116 i18n using _ M _ method L18L
# note, simple quote (') inside message is not allowed, used (´) instead
OUTPUT_CHARSET=UTF-8
export OUTPUT_CHARSET
TEXTDOMAINDIR=/usr/share/locale
TEXTDOMAIN=`basename $0`

LANGPATH=${TEXTDOMAINDIR}/${LANG%.*}/$TEXTDOMAIN
[ ! -f $LANGPATH ] && LANGPATH=${TEXTDOMAINDIR}/${LANG%_*}/$TEXTDOMAIN
[ -f $LANGPATH ] && . $LANGPATH
#

export ASKDIALOG="
<window title=\"${_M_1:-Sound Wizard}\" window_position=\"1\">
<vbox>

<text use-markup=\"true\"><label>\"<big>${_M_11:-Welcome to the Sound Wizard}</big>\"</label></text>
<text><label>${_M_12:-Presumably you are here because your sound does not work? If so, there are things that you should try before running the full ALSA Wizard}</label></text>

<frame ${_M_13:-ONE: Adjust levels}>
<hbox>
<text><label>${_M_14:-Often non-working sound is just a matter of unmuting (tick a checkbox) and/or bring up a level in the audio mixer. Click this button to run the mixer:}</label></text>
<vbox><button><input file>${AUDIOICON}</input><action>/usr/local/bin/defaultaudiomixer & </action></button></vbox>
</hbox>
</frame>

<frame ${_M_2:-TWO: Play test sound}>
<hbox>
<text><label>${_M_21:-Having adjusted the levels, click this button to play a test sound:}</label></text>
<vbox><button><input file>${AUDIOICON}</input><action>/usr/bin/aplay /usr/share/audio/2barks.au & </action></button></vbox>
</hbox>
<hbox>
<text><label>${_M_22:-On some hardware (very rare fortunately) sound plays but does not always stop! If your Puppy will not stop barking, click this button:}</label></text>
<vbox><button><input file>/usr/local/lib/X11/mini-icons/mini-stop.xpm</input><action>/usr/bin/killall aplay</action></button></vbox>
</hbox>
</frame>

<frame ${_M_3:-THREE: Multiple cards}>
<hbox>
<text><label>${_M_31:-Linux may have detected more than one audio interface or ´card´, and has set the wrong one as default. Run Kirk´s Multiple Sound Card Wizard to investigate this (note, a reboot is required for change to take effect):}</label></text>
<vbox><button><input file>${AUDIOICON}</input><action>/usr/bin/Multiple-Sound-Card-Wizard & </action></button></vbox>
</hbox>
</frame>

<text><label>${_M_4:-FOUR: After trying ONE, TWO, THREE above, sound still not working, click ´ALSA Wizard´ button:}</label></text>

<hbox>
<button>
<label>${_M_41:-ALSA Wizard}</label>
<action type=\"exit\">RUNALSA</action>
</button>
<button>
<label>${_M_42:-EXIT}</label>
<action type=\"exit\">EXIT</action>
</button>
</hbox>

</vbox>
</window>
"
RETVAL="`gtkdialog3 --program=ASKDIALOG 2>/dev/null`"
eval "$RETVAL"
[ "$EXIT" != "RUNALSA" ] && exit


#exec rxvt -e /usr/sbin/alsaconf
#rxvt -e /usr/sbin/alsaconf

#/usr/sbin/alsaconf #101015
rxvt -geometry 60x3 -bg orange -e /usr/sbin/alsaconf

#depmod

------------------------------
edited
I have changed
"ALSA Wizard"
to
´ALSA Wizard´
in above script /usr/sbin/alsawizard

----
another edit
add the missing $ in line 33 please. Sorry
Must be:
LANGPATH=${TEXTDOMAINDIR}/${LANG%.*}/$TEXTDOMAIN
t12s.gz
Description  move it to
/usr/sbin/t12s (without .gz)
gz

 Download 
Filename  t12s.gz 
Filesize  6.72 KB 
Downloaded  377 Time(s) 
t12s_alsa.png
 Description   translated alsawizard using t12s
 Filesize   51.48 KB
 Viewed   1706 Time(s)

t12s_alsa.png

alsawizard.gz
Description  move it to
/usr/share/locale/de/alsawizard (without .gz)
gz

 Download 
Filename  alsawizard.gz 
Filesize  1.21 KB 
Downloaded  356 Time(s) 

Last edited by L18L on Thu 17 Nov 2011, 11:25; edited 2 times in total
Back to top
View user's profile Send private message 
shinobar


Joined: 28 May 2009
Posts: 2631
Location: Japan

PostPosted: Wed 16 Nov 2011, 20:59    Post subject: Re: Speed
Subject description: you mean excution speed, but is it a problem?
 

Code:
# time echo "$(gettext 'hello world')"

hello world

real   0m0.014s
user   0m0.016s
sys   0m0.000s

# time echo “${_M_x:-hello world}”
“hello world”

real   0m0.000s
user   0m0.000s
sys   0m0.000s
#

Ah, you mean that.
It is not my interest.

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
Back to top
View user's profile Send private message Visit poster's website 
ferro10n

Joined: 15 Jun 2011
Posts: 106

PostPosted: Wed 16 Nov 2011, 23:32    Post subject:  

Unfortunately I'm temporarily unable to full test these method. My computer seems to hate Wary 5.2! Especially trying to log in as fido Shocked

I was able to translate the askpass script, but when I run it I got a white window with a box and a button. I'm still willing to test, for it worked running Wary without save-file. Maybe there's something I didn't do properly.

From a beginner point of view, however, I have to agree with shinobar-san, this method is suitable for a bit more experienced people, and of course for those who aren't having a nightmare with a particular puppy version Laughing
t12s-spanish-blankbox.png
Description 
png

 Download 
Filename  t12s-spanish-blankbox.png 
Filesize  217.95 KB 
Downloaded  372 Time(s) 

_________________
A beginner Puppy Linux user
Intel(R) Celeron(R) CPU 2.13GHz 512MB
LiveCD user

Last edited by ferro10n on Thu 17 Nov 2011, 09:44; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
L18L

Joined: 19 Jun 2010
Posts: 2579
Location: www.eussenheim.de/

PostPosted: Thu 17 Nov 2011, 04:53    Post subject: still willing to test
Subject description: alsawizard
 

ferro10n wrote:
...
I was able to translate the askpass script, but when I run it I got a white window with a box and a button. I'm still willing to test, for it worked running Wary without save-file. Maybe there's something I didn't do properly.
..

Thank you for reporting and for your good will to continue Very Happy

I agree, askpass might be too complicated for a beginner.

Therefore I suggest:
- Take any recent puppy, install yad if it is not contained.
- copy above t12s (renamed from t12s.gz)
- copy above alsawizard (renamed from alsawizard.gz)
- Start t12s:
-- choose /usr/sbin/alsawizard in first dialog
-- enter es as language in second dialog
-- translate just 1 item and click execute button: you should see this item translated.
...and so on
-- enter pt_BR as language in second dialog
...and so on

Please report:
- which puppy version (if there is a problem I will install it for me to reproduce your problem)
- maybe a screenshot of translated alsawizard?
- send your translation (open /usr/local/share/es/alsawizard in geany then copy and paste into forum post)
- any problems you might have Smile

Thanks in advance
L
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2579
Location: www.eussenheim.de/

PostPosted: Thu 17 Nov 2011, 05:16    Post subject: Re: Speed
Subject description: you mean excution speed, but is it a problem?
 

shinobar wrote:
...
Ah, you mean that.
...

Some Puppians use old computers...
Some Puppians will use new computers like this one... Smile
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4380

PostPosted: Thu 17 Nov 2011, 07:57    Post subject:  

using L18L's naming method, you can quickly autogenerate a template:
Code:
#!/bin/bash
for x in $@ ; do
while read -d$ A || [ "$A" ]; do
case "$A" in
*{_M_*)B=_M${A##*_M};B=${B%%\}*}\";echo ${B//:-/=\"};;
esac
done < $x >$x.i18n
done

usage:
mki18n list of scripts

hmm, even though I used a bashism (read -d) it generates the entire template in less time than gettext takes to do a single translation

... it may be beneficial to change >$x.i18n to |sort -u >$x.i18n if you are planning to use a VAR multiple times

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
ferro10n

Joined: 15 Jun 2011
Posts: 106

PostPosted: Thu 17 Nov 2011, 10:19    Post subject: Re: still willing to test
Subject description: alsawizard
 

L18L wrote:
ferro10n wrote:
...
I was able to translate the askpass script, but when I run it I got a white window with a box and a button. I'm still willing to test, for it worked running Wary without save-file. Maybe there's something I didn't do properly.
..

Thank you for reporting and for your good will to continue Very Happy

I agree, askpass might be too complicated for a beginner.

Therefore I suggest:
- Take any recent puppy, install yad if it is not contained.
- copy above t12s (renamed from t12s.gz)
- copy above alsawizard (renamed from alsawizard.gz)
- Start t12s:
-- choose /usr/sbin/alsawizard in first dialog
-- enter es as language in second dialog
-- translate just 1 item and click execute button: you should see this item translated.
...and so on
-- enter pt_BR as language in second dialog
...and so on

Please report:
- which puppy version (if there is a problem I will install it for me to reproduce your problem)
- maybe a screenshot of translated alsawizard?
- send your translation (open /usr/local/share/es/alsawizard in geany then copy and paste into forum post)
- any problems you might have Smile


Success this time around! Didn't have to change puppy version, it's Wary 5.2 running entirely from RAM. And I learned some German on the way Laughing Now testing pt-BR

Spanish locale generated for ALSA Wizard:
Code:

_M_1="Asistente de Sonido"
_M_11="Bienvenid@ al Asistente de Sonido"
_M_12="Seguramente usted está aquí porque no le funciona el sonido. Si es así, hay cosas que debe probar antes de iniciar el Asistente ALSA completo"
_M_13="UNO: Ajustar niveles"
_M_14="Los problemas de sonido suelen ser cosa de des-silenciar (marcar una casilla) y/o elevar un nivel en el mezclador de audio. Pulse este botón para iniciar el mezclador:"
_M_2="DOS: Reproducir un sonido de prueba"
_M_21="Ajustados los niveles, pulse este botón para reproducir un sonido de prueba:"
_M_22="En algún hardware (muy raro por suerte) ¡el sonido se reproduce pero no siempre se detiene! Si su Puppy no para de ladrar, pulse este botón:"
_M_3="TRES: Tarjetas múltiples"
_M_31="Linux puede detectar más de una interface o ´tarjeta´, y ha ajustado la equivocada como predeterminada. Inicie el Asistente de Tarjetas de Sonido Múltiples de Kirk para investigar (nota, requiere reiniciar para activar el cambio):"
_M_4="CUATRO: Después de probar UNO, DOS, TRES arriba, aún no funciona el sonido, pulse el botón ´Asistente ALSA´:"
_M_41="Asistente ALSA"
_M_42="SALIR"

t12s-alsawizard-spanish-full-translation.png
Description 
png

 Download 
Filename  t12s-alsawizard-spanish-full-translation.png 
Filesize  182.13 KB 
Downloaded  353 Time(s) 
t12s-alsawizard-spanish-success.png
Description 
png

 Download 
Filename  t12s-alsawizard-spanish-success.png 
Filesize  171.52 KB 
Downloaded  342 Time(s) 

_________________
A beginner Puppy Linux user
Intel(R) Celeron(R) CPU 2.13GHz 512MB
LiveCD user
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 5 [63 Posts]   Goto page: 1, 2, 3, 4, 5 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
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.1778s ][ Queries: 13 (0.0127s) ][ GZIP on ]