Translated: "Welcome, this is the first time you run ....."

For efforts in internationalising Puppy and solving problems in this area
Message
Author
User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: "Welcome, this is the first time you run ....."

#21 Post by L18L »

L18L wrote:Pointers to actual code will always be in 2nd post of this thread besides a 32bit executable.
...done

Changes:
gray outed button
larger screen (640x480) for language choice

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

#22 Post by L18L »

Some other languages would be nice :)

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

#23 Post by vicmz »

Portuguese (from mariojrmatos' langpack)
Italian (my Italian is somewhat correct, but a native speaker's check would be great).
Attachments
welcome1stboot_it_woof-ce.tar.gz
Italiano
(2.41 KiB) Downloaded 314 times
welcome1stboot_pt_woof-ce.tar.gz
Português
(3.6 KiB) Downloaded 298 times
[url=http://murga-linux.com/puppy/viewtopic.php?t=76948]Puppy Linux en español[/url]

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

#24 Post by L18L »

vicmz wrote:Portuguese (from mariojrmatos' langpack)
Italian (my Italian is somewhat correct, but a native speaker's check would be great).
I did not forget you.
Thank you very much.

...and here is the 100-liner that created the image

Code: Select all

#!/bin/sh
# let user choose a language from installed mo files for app
# was implemented in welcome1stboot.bac
# but as shell script here now
# L18L March 2014 GPL
#

version=0.1

die() { echo $1; exit 1;}

usage()
{
 echo "
 usage: $0 textdomain [ app ]
 
 app only needed if different from textdomain
 choose a language from available textdomains
 app will be launched in chosen language
 
 -h this help 
 -v version
 " 	
}

[ $1 = '-h' ] && { usage; exit 0; }
[ $1 = '-v' ] && { echo ${0##*/} version $version; exit 0; }

textdomain=$1 && [ $textdomain ] || die "which textdomain?"
app=$2 && [ "$app" ] || app=$textdomain

# some files
all_language_names=/usr/share/i18n/lang_names
[ -f $all_language_names ] || all_language_names=lang_names
[ -f $all_language_names ] || die "missing file lang_names, exiting"
these_languages=/dev/shm/language_names
chosen_lang=/dev/shm/chosen_lang_code

# English plus all other available languages for textdomain
langs="en `find /usr/share/locale/*/LC_MESSAGES/${textdomain}.mo|cut -d'/' -f5`"
num_languages="`echo $langs | wc -w`"
echo -n '' > $these_languages
for x in $langs;do echo "`grep ^$x $all_language_names`">>$these_languages;done

# GUI ========================================================================
num_cols=2 # number of columns
[ $num_languages -gt 4 ] && num_cols=3
[ $num_languages -gt 6 ] && num_cols=4

choose_language='
<window title="'$textdomain'" icon-name="gtk-preferences" window-position="1">
<vbox space-expand="true" space-fill="true">
 <vbox spacing="10" space-expand="true" space-fill="true">
 <frame ? ? ?>
  <hbox spacing="10" homogeneous="true" space-expand="true" space-fill="true">
'
x=0
col=0
while [ $x -lt $num_languages ] ; do 
 x=$(($x + 1))
 col=$(($col + 1))
 read language_name             #ex: de:Deutsch  
 lang_code=${language_name%:*}  #ex: de
 lang_name=${language_name#*:} #ex: Deutsch
 choose_language=${choose_language}'
    <button image-position="2">
     <label>"'$lang_name'"</label>
     '"`/usr/lib/gtkdialog/xml_button-icon reboot.svg huge`"'
     <action>echo '$lang_code' > chosen_lang</action>
     <action>exit:exit</action>
    </button>'
 if [ $col -ge $num_cols ]; then
  col=0
  choose_language=${choose_language}'
   </hbox>
   <hbox spacing="10" homogeneous="true" space-expand="true" space-fill="true">'
 fi
done < $these_languages
choose_language=${choose_language}'
   </hbox>
  </frame>
 </vbox>
</vbox>
</window>'
# /GUI ========================================================================

export choose_language
eval `gtkdialog -p choose_language`
chosen_lang_code=`cat chosen_lang` 
#echo chosen_lang_code=`cat chosen_lang`   #example: "nl"

#prepend chosen_lang_code to envirinment variable LANGUAGE
#echo LANGUAGE=$LANGUAGE                   #example: "fr:de:"
[ "$LANGUAGE" ] && LANGUAGE=":${LANGUAGE}" #example: ":fr:de:"
LANGUAGE="${chosen_lang_code}${LANGUAGE}"  #example: "nl:fr:de:"
export LANGUAGE

$app & #launch application
exit 0 #end
Attachments
welcome_2014-03-28_195118.png
...a work in progress
(12.79 KiB) Downloaded 191 times

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

#25 Post by L18L »

Script in previous post works in slacko only I think.

Script development continued in cutting edge.
There is a pet you can use to run any application in any installed language. that is use it for welcome1stboot or geany or (even) xwin 8)

Should work with Brazilian and Chinese tooo...

Post Reply