The time now is Wed 19 Jun 2013, 01:00
All times are UTC - 4 |
|
Page 1 of 4 Posts_count |
Goto page: 1, 2, 3, 4 Next |
| Author |
Message |
L18L
Joined: 19 Jun 2010 Posts: 1800 Location: Burghaslach, Germany
|
Posted: Thu 06 Oct 2011, 15:49 Post_subject:
internationalization of initrd messages at bootup Sub_title: [was: internationalization of bootup messages] |
|
Wouldn't it be nice to see messages at bootup in your language?
Not just nice but often helpful.
I have started this using frugal installation of latest wary5.1.103
Now limited to available consolefonts lat1 and lat2, but it is a start
________________________________________
edited 2011-10-21-14:50 CEST
Now for all European languages, Arab and Hebrew.
edited 2011-10-23-20:32 CEST
Arab and Hebrew still not possible
-------------------------------------------------------------
init script splitted:
init:
| Code: |
#!/bin/sh
#(c) Copyright 2007 Barry Kauler, www.puppylinux.com
#2007 GPL licence v2 (/usr/share/doc/legal/gpl-2.0.txt)
#Aug 2007, init script in initramfs, for puppy v2.20, Sept: v3.00, Oct: v3.01
...
...
...
#/bin/hotplug2stdout_notimeout > /tmp/pup_event_uevents_initrd &
#translate rest of splitted script (= init2) to boot param plang #L18L
[ $plang -a -f /boot_msg/${plang} ] && mv /init2 /trans && sed -f /boot_msg/${plang} /trans > /init2 && rm /trans
. /init2
|
translation file see next post
EDIT: screenshots some posts down
Edited_times_total
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1800 Location: Burghaslach, Germany
|
Posted: Thu 06 Oct 2011, 15:52 Post_subject:
internationalization of progress messages at bootup Sub_title: translation template |
|
Translation is done by stream editor sed, delimiter is #
The following file for translation to German (de) is placed into initrd/boot_msg/de
Post other translations here please.
| Code: | #English#translation#
s#'save file' filesystem check, please wait...#'save file' Dateisystem-Check, bitte warten...#g
s#'${1}' filesystem check, please wait...#'${1}' Dateisystem-Check, bitte warten...#g
s#ERROR: Windows NTFS hibernated partition, cannot mount#FEHLER: Windows NTFS winterschlafende Partition, kann nicht einhängen#g
s#32mdone#32mgetan#g
s#failed#fehlgeschlagen#g
s#Dumping last lines of /tmp/bootinit.log...#Zeige letzte Zeilen vom /tmp/bootinit.log...#g
s#Dumping last lines of kernel log...#Zeige letzte Zeilen vom kernel log...#g
s#Pausing for 60 seconds...#Pausiere für 60 Sekunden...#g
s#PAUSE 5SEC: tried to mount /dev/${ONEDEV}, ${ONEFS} f.s.#PAUSE 5SEC: versuchte Dateisysteme /dev/${ONEDEV}, ${ONEFS} einzuhängen.#g
s#pausing#pausiere#g
s#RETRY FAILED: mounting /dev/${ONEDEV}, ${ONEFS} f.s.#2.VERSUCH FEHLSCHLAG: einhängen der /dev/${ONEDEV}, ${ONEFS} Dateisysteme.#g
s#Bypass looking for vmlinuz on $ONEDEV#Umgehe nachsehen, ob vmlinuz auf $ONEDEV ist#g
s#Loading '${PKEYS}' keyboard layout...#Lade '${PKEYS}' Tastatur-Layout...#g
s#Loading drivers needed to access disk drives#Lade Treiber für Zugriff auf Plattenlaufwerke#g
s#Searching for Puppy files...#Suche nach Puppy-Dateien...#g
s#${DROPOUT} not found. Dropping out to initial-ramdisk console...#${DROPOUT} nicht gefunden. Falle zurück auf initiale ramdisk Konsole...#g
s#Type a number to choose which personal file to use:#Tipp eine Ziffer zur Auswahl der zu verwendenden persönlichen Datei:#g
s#0 none#0 keine#g
s#Loading personal file $PUPSAVEFILE ($PUPSAVEDEV)...#Lade persönliche Datei $PUPSAVEFILE ($PUPSAVEDEV)...#g
s#Mounting encrypted $PUPSAVEFILE...#Hänge verschlüsselte Datei $PUPSAVEFILE ein...#g
s#Increasing $PUPSAVEFILE by $KILOBIG Kbytes, please wait...#Vergrößere $PUPSAVEFILE um $KILOBIG Kbytes, bitte warten...#g
s#NOTICE: As you type your password nothing will be displayed on the#HINWEIS: Bei der Eingabe des Paßworts wird nichts auf dem Bildschirm angezeigt #g
s#screen for absolute security. Just type it in then press ENTER key...#zur absoluten Sicherheit. Nur eingeben und dann die Enter-Taste drücken...#g
s#Password:#Paßwort:#g
s#...continuing with loading $PUPSAVEFILE...#...lade $PUPSAVEFILE weiter...#g
s#...successfully mounted#...erfolgreich eingehängt#g
s#Can't mount file, press ENTER key to try again, or#Kann Datei nicht einhängen, Enter-Taste für noch einen Versuch oder#g
s#any other char then ENTER for f.s. check then try again, or#irgendeine und dann Enter-Taste für Dateisystem-Check und noch einen Versuch, oder#g
s#for developers type 'quit' to drop out to console:#für Entwickler: tipp 'quit' für Konsole:#g
s#Increasing $PUPSAVEFILE by $KILOBIG Kbytes, please wait...#Vergrößere $PUPSAVEFILE um $KILOBIG Kbytes, bitte warten...#g
s#This save-file was last used with version $OLDDISTRO_VERSION of Puppy#Diese Sicherungsdatei wurde zuletzt benutzt mit Version $OLDDISTRO_VERSION von Puppy#g
s#Hit the ENTER key only if it is okay to upgrade this file, or to#Nur fie Enter-Taste drücken, wenn es OK ist, diese Date upzugraden, oder #g
s#not use it and boot up in RAM only type any other printable character.#um sie nicht zu benutzen, irgendeine druckbare Taste und dann die Enter-Taste.#g
s#ENTER only to upgrade:#Nur die Enter-Taste zum Upgrade:#g
s#Backing off, not using save-file, booting in RAM only, PUPMODE=5...#Ohne alte Daten, save-file nicht benutzt, booting in RAM only, PUPMODE=5...#g
s#The main Puppy file '${basepupsfs}' is being loaded off the optical disc.#Die Puppy-Hauptdatei '${basepupsfs}' wird jetzt vom optischen Medium geladen.#g
s#Very slow! Type ENTER key only to copy it to the same partition as the save-file#Sehr langsam! Nur die Enter-Taste drücken zum Kopieren auf dieselbe Partition wie die Sicherungsdatei#g
s#then on next boot it will load fast. Type any printable char not to copy it.#dann wird beim nächsten Neustart schneller geladen werden. Irgendein druckbares Zeichen zum Nichtkopieren.#g
s#ENTER key only to copy:#Nur Enter-Taste zum Kopieren:#g
s#'${basepupsfs}' now copying to hard drive (but only available next boot)...#'${basepupsfs}' wird jetzt auf die Festplatte kopiert (aber erst beim nächsten Neustart verfügbar)...#g
s#Folder $ONEFOLDER marked bad.#Folder $ONEFOLDER als schlecht markiert.#g
s#Loading folder $ONEFOLDER from CD/DVD...#Lade Verzeichnis $ONEFOLDER von CD/DVD...#g
s#RAM full#RAM voll#g
s#copying to ram#kopiere ins RAM#g
s#Loading the '${basepupsfs}' main file...#Lade die '${basepupsfs}' Hauptdatei...#g
s#Setting up the layered filesystem...#Richte das überlagernde Dateisystem ein...#g
s#Version update, restoring 'official' files, please wait...#Version update, restauriere 'offizielle' Dateien, bitte warten...#g
s#(with a slow CPU this may take sometime, please be patient)#(mit einer langsamen CPU kann das eine Weile dauern, bitte etwas Geduld)#g |
s#to#auf#g edited: very bad:use entire phrases
| Code: | s#You are upgrading Puppy ${OLDstr} ${NEWPVERSION}.#Du upgradest Puppy ${OLDstr} ${NEWPVERSION}.#g
s#Overwritten old files have been moved to /tmp/versioncleanup/#Überschriebene alte Dateien sind nach /tmp/versioncleanup/ verschoben worden#g
s#After bootup please examine this directory (before shutdown) for anything#Nach dem Start examiniere bitte dieses Verzeichnis (vor dem Herunterfahren) auf alles#g
s#that you might like to recover. Pausing 30 secs so you can read this msg...#was vielleicht erhalten werden soll. 30 Sekunden Pause zum Lesen dieser Meldung...#g
s#Overlaying preconfig files...#Überlagern der preconfig-Dateien...#g
s#Performing a 'switch_root' to the layered filesystem...#Führe ein 'switch_root' auf das überlagernde Dateisystem aus...#g
s#Dropped to initramfs shell. Type 'exec switch' to continue booting Puppy.#Zur initramfs shell gefallen. Tipp 'exec switch' zum Weiterstart von Puppy.#g
s#from version $xOLDPVERSION to#von Version $xOLDPVERSION auf#g
s#This is a simulated version upgrade, which performs a file cleanup.#Dies ist ein simuliertes Version-upgrade, das eine Dateisäuberung ausführt.#g
s#This is a radical file cleanup for broken systems, could alter some settings.#Dies ist eine radikale Dateisäuberung für defekte Systeme, könnte einige Einstellungen verändern.#g |
That is how this file has been created:
extracted init from itird.gz
marked 63 translatable lines by '#tr'
extract them:
grep '#tr$' init > translation
cat -n translation | cut -d '"' -f2 > tr
cat -n translation | cut -d '"' -f4 >>tr
cat -n translation | cut -d '"' -f6 >>tr
edit tr:
trimmed
delete double entries
delete empty lines
59 lines remaining
create sed file:
file=translated
echo '#English#translation#' > $file
while read LINE; do
echo "s#${LINE}#${LINE}#g" >> $file
done<tr
cp translated to boot_msg/de
edit boot_msg/de:
s#English message#German message#g
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1800 Location: Burghaslach, Germany
|
Posted: Fri 07 Oct 2011, 16:40 Post_subject:
internationalization of progress messages at bootup |
|
equivalent to xgettext
| Code: | #!/bin/sh
# create translate template from shell script
# lines containing translatable strings have to be marked by
# Syntax to use for automatic creation of translate template
# #tr2 -> grep tr.$ | cut -d '"' -f 2
# example:
# echo -n " 'save file' filesystem check, please wait..." >/dev/console #tr2
#
# #tr4 -> grep tr.$ | cut -d '"' -f 4
#
# #tr6 -> grep tr.$ | cut -d '"' -f 6
# example:
# [ "$xOLDPVERSION" != "0.0" ] && OLDstr="from version $xOLDPVERSION to" #tr6
#####################################################
infile=init2
outfile=template1
echo -n > ${outfile}
while read LINE ; do
case $LINE in
*tr2) x=`echo $LINE | cut -d '"' -f 2`
[ "$x" = "$LINE" ] && x=`echo $LINE | cut -d "'" -f 2`
echo $x >> ${outfile} ;;
*tr4) x=`echo $LINE | cut -d '"' -f 4`
[ "$x" = "$LINE" ] && x=`echo $LINE | cut -d "'" -f 4`
echo $x >> ${outfile} ;;
*tr6) x=`echo $LINE | cut -d '"' -f 6`
[ "$x" = "$LINE" ] && x=`echo $LINE | cut -d "'" -f 6`
echo $x >> ${outfile} ;;
*tr8) x=`echo $LINE | cut -d '"' -f 8`
[ "$x" = "$LINE" ] && x=`echo $LINE | cut -d "'" -f 8`
echo $x >> ${outfile} ;;
esac
done < ${infile}
sort --uniq ${outfile} >${outfile}_uniq
|
check ${outfile}_uniq
then create sed file (see above post)
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1800 Location: Burghaslach, Germany
|
Posted: Sat 08 Oct 2011, 15:10 Post_subject:
internationalization of initrd messages at bootup Sub_title: internationalization of initrd messages at bootup |
|
And here is how it looks (was the most difficult part without photo)
| Description |
boot param plang for language |
| Filesize |
37.56 KB |
| Viewed |
950 Time(s) |

|
| Description |
initrd messages dynamically translated |
| Filesize |
20.52 KB |
| Viewed |
940 Time(s) |

|
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1800 Location: Burghaslach, Germany
|
Posted: Sun 09 Oct 2011, 07:34 Post_subject:
internationalization of initrd messages at bootup Sub_title: bugfix |
|
Reviewing screenshot now...
mishmash of deutsch english in performing a 'switch_root' ....
Reason: translation of 'to'
Fix:
# OLDstr='to'
# [ "$xOLDPVERSION" != "0.0" ] && OLDstr="from version $xOLDPVERSION to"
[ "$xOLDPVERSION" != "0.0" ] && OLDstr="from version $xOLDPVERSION"
echo "You are upgrading Puppy ${OLDstr} to ${NEWPVERSION}." >/dev/console
This will cause 'to' to NOT be in the translation template
_______________________
German translation:
getan is
erledigt appeared to be better but too long (last letter in next line)
fertig will be in next version
Any suggestions for better translations ?
...Zugriff auf Plattenlaufwerke ???
Lade die 'puppy_wary...' Hauptdatei...
oder besser?:
Lade die Hauptdatei 'puppy_wary...'...
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1800 Location: Burghaslach, Germany
|
Posted: Mon 10 Oct 2011, 03:35 Post_subject:
internationalization of initrd messages at bootup Sub_title: script manually marked for translation |
|
Barry,
I have thought uploading this could be useful too
| Description |
|

Download |
| Filename |
init2_int_marked.gz |
| Filesize |
21.21 KB |
| Downloaded |
229 Time(s) |
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1800 Location: Burghaslach, Germany
|
Posted: Wed 19 Oct 2011, 09:15 Post_subject:
internationalization of initrd messages at bootup Sub_title: demo using 2 different consolefonts |
|
Howto display UTF-8 in console?
Here is a little demo made in wary 5.2
Extract attached console_i18n_demo.tar.gz where you like to
Here is a screenshot of executing script i18n
If it does not display properly for every language you might install
ucs-fonts-target3.pet
busybox in initrd does NOT have setfont
so I could not use it where it should be used: in initrd
Anyone able to add fontset to busybox of initrd?
edited:
using loadfont now which is included in busybox of initrd (thanks Technosaurus)
| Description |
|
| Filesize |
9.22 KB |
| Viewed |
867 Time(s) |

|
| Description |
|

Download |
| Filename |
console_i18n_demo.tar.gz |
| Filesize |
27.77 KB |
| Downloaded |
223 Time(s) |
Edited_time_total
|
|
Back to top
|
|
 |
Moose On The Loose

Joined: 24 Feb 2011 Posts: 283
|
Posted: Wed 19 Oct 2011, 10:52 Post_subject:
Re: internationalization of initrd messages at bootup Sub_title: internationalization of initrd messages at bootup |
|
| L18L wrote: | | And here is how it looks (was the most difficult part without photo) |
The picture brings up a couple of interesting questions:
Is "Wary" a bad word in anybodies language?
Some cultures, German is one as is English, calling someone or something a dog has a meaning. Is there anything bad about the word puppy?
The puplets like "bigdog" may have an issue in some languages too.
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1800 Location: Burghaslach, Germany
|
Posted: Wed 19 Oct 2011, 12:17 Post_subject:
Re: internationalization of initrd messages at bootup Sub_title: internationalization of initrd messages at bootup |
|
| Moose On The Loose wrote: | | Is "Wary" a bad word in anybodies language? | This word is not used in German. (but: make love not war was popular once upon a time...)
| Moose On The Loose wrote: | | Some cultures, German is one as is English, calling someone or something a dog has a meaning. Is there anything bad about the word puppy? |
Calling someone a dog can be a compliment in Bavaria
The word puppy in German is unknown
Depending on its pronountiation it is either a doll or daddy
So nothing bad
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3845
|
Posted: Wed 19 Oct 2011, 23:39 Post_subject:
|
|
here is the fastest/easiest method that I have found, it doesn't require bashisms or any outside shell stuff like sed/grep/cut/tr ....
but more importantly, the translation files are raw text that _any_ user can modify
here is a basic template:
| Code: | case $LANG in
de*|be*|br*|dk*|es*|fi*|fr*|it*|no*|se*|sv*|pt*)
modprobe nls_cp850
CODEPAGE="850"
zcat /lib/consolefonts/lat1-12.psfu.gz | loadfont
;;
cz*|hu*|pl*|ro*|sk*|cr*|sl*)
modprobe nls_cp852
modprobe nls_iso8859-2
CODEPAGE="852"
zcat /lib/consolefonts/lat2-12.psfu.gz | loadfont
;;
esac
case $LANG in
#uncomment locales as they are added
# de*). /etc/locale/de/init;;
# be*). /etc/locale/be/init;;
# br*). /etc/locale/br/init;;
# dk*). /etc/locale/dk/init;;
# es*). /etc/locale/es/init;;
# fi*). /etc/locale/fi/init;;
# fr*). /etc/locale/fr/init;;
# it*). /etc/locale/it/init;;
# no*). /etc/locale/no/init;;
# se*). /etc/locale/se/init;;
# sv*). /etc/locale/sv/init;;
# pt*). /etc/locale/pt/init;;
# cz*). /etc/locale/cz/init;;
# hu*). /etc/locale/hu/init;;
# pl*). /etc/locale/pl/init;;
# ro*). /etc/locale/ro/init;;
# sk*). /etc/locale/sk/init;;
# cr*). /etc/locale/cr/init;;
# sl*). /etc/locale/sl/init;;
*)echo $LANG not yet supported, please help us translate >/dev/console
esac
#each file in /etc/locale/*/init will contain localized string variables like:
# VAR1='Some translated string'
# ...
# VARZ='Last translated string'
#NOTE: use a variable name that makes sense for translating for the template
# instead of VAR1='', use PERFORMING_SWITCHROOT=''
echo ${VAR1:-Default English Message Here} >/dev/console
#more code here
echo ${PERFORMING_SWITCHROOT:-Performing Switchroot} >/dev/console
|
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1800 Location: Burghaslach, Germany
|
Posted: Thu 20 Oct 2011, 14:50 Post_subject:
internationalization of initrd messages at bootup |
|
Technosaurus,
One question about your localized string variables
Can they contain variables?
For example how would you make
| Code: | | s#Increasing $PUPSAVEFILE by $KILOBIG Kbytes, please wait...#Vergrößere $PUPSAVEFILE um $KILOBIG Kbytes, bitte warten...#g |
Your script has given the solution for my font problem using loadfont instead of setfont now.
| Code: | case $plang in
el) zcat /lib/consolefonts/LatGrkCyr-8x16.psfu.gz | loadfont # greek
*) zcat /lib/consolefonts/LatArCyrHeb-16.psfu.gz | loadfont
esac |
Tested, it works, booted wary52 Russian (just the first 2 phrases)
That is my solution for now.
Thanks for your input
L
| Description |
photograph of console_i18n_demo running in console |
| Filesize |
82.61 KB |
| Viewed |
850 Time(s) |

|
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3845
|
Posted: Thu 20 Oct 2011, 19:42 Post_subject:
Re: internationalization of initrd messages at bootup |
|
| L18L wrote: | Technosaurus,
One question about your localized string variables
Can they contain variables?
For example how would you make
| Code: | | s#Increasing $PUPSAVEFILE by $KILOBIG Kbytes, please wait...#Vergrößere $PUPSAVEFILE um $KILOBIG Kbytes, bitte warten...#g |
L | since they are variables, I wouldn't (there is a way, but would increase code complexity) ... instead, use multiple small variables:
echo ${INCREASING:-Increasing} $PUPSAVEFILE ${BY:-by} $KILOBIG Kbytes, ${PLSWAIT:-please wait...} >/dev/console
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
Moose On The Loose

Joined: 24 Feb 2011 Posts: 283
|
Posted: Thu 20 Oct 2011, 22:17 Post_subject:
Perhaps a useful trick for language selection Sub_title: If we make the file name match the language it is easier |
|
[quote="technosaurus"]
| Code: |
case $LANG in
#uncomment locales as they are added
# de*). /etc/locale/de/init;;
# be*). /etc/locale/be/init;;
# br*). /etc/locale/br/init;;
# dk*). /etc/locale/dk/init;;
|
how about:
| Code: |
if test -e /etc/locale/${LANG}/init ; then
. /etc/locale/${LANG}/init
fi
|
If you make a file with the right name it gets used.
The mere addition of a file causes the new translation to happen
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3845
|
Posted: Fri 21 Oct 2011, 00:21 Post_subject:
|
|
i had done it like this:
[ -e /etc/locale/${LANG}/init ] && . /etc/locale/${LANG}/init
but realized that sometimes it may be something like de_DE (thus the case statement)
but now that you mentioned it, it could be
| Code: |
[ -e /etc/locale/${LANG:0:2}/init ] && . /etc/locale/${LANG:0:2}/init |
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
BarryK
Puppy Master

Joined: 09 May 2005 Posts: 6874 Location: Perth, Western Australia
|
Posted: Fri 21 Oct 2011, 05:36 Post_subject:
|
|
Hi guys,
This is interesting stuff. I'm a bit pre-occupied right now, but intend to come back and read this thread properly later.
One quick question. L18L, I see that you propose "plang=de", but Puppy already supports "pkeys=de" -- couldn't we just have the one, to simplify things? Perhaps "plang=de" could also imply keyboard layout is "de". Or, maybe they do need to remain separate.
_________________ http://bkhome.org/blog2/
|
|
Back to top
|
|
 |
|
|
Page 1 of 4 Posts_count |
Goto page: 1, 2, 3, 4 Next |
|
|
Rules_post_cannot Rules_reply_cannot Rules_edit_cannot Rules_delete_cannot Rules_vote_cannot You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|