internationalization of initrd messages at bootup

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

multi-byte char ↓ (arrow down) in initrd

#31 Post by L18L »

amigo wrote:They should remain separate -I have a 'de' keyboard but use English and I imagine there are others that do similar.
Sorry, I have no idea what you wanted to tell me :roll:
In his blog BarryK wrote:However, 'echo' strings would probably have to stay as ascii only, as I have not yet configured Busybox as multi-byte aware (I did experiment with that awhile back but rolled back).
This was meant to be just a little demonstration of using a multi-byte char in busybox successfully :)
Last edited by L18L on Tue 13 Dec 2011, 18:07, edited 1 time in total.

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

little chunks

#32 Post by L18L »

technosaurus wrote:also you can use read -t <seconds>

but here is are a couple little chunks

Code: Select all

cd $DIR
i=0; for x in *; do i=$(($i+1)) && echo "( $i ) $x"; done

read -t 10 x
echo * |awk '{print $'${x:-$defaultvalue}'}'
I will be able to use them as replacements for ls and pause :)
Thank you.

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

internationalization of initrd messages at bootup

#33 Post by L18L »

# pwd
/initrd/mnt/dev_save/racy5225
# ls -l initrd.gz*
-rw-r--r-- 1 root root 3477530 2012-02-13 13:51 initrd.gz
-rw-r--r-- 1 root root 3475506 2012-02-09 12:00 initrd.gz.orig
#

What was added?

usr/share/locales/de/init (complete)
usr/share/locales/ru/init (just some automatically translated phrases)

# pwd
/initrd/mnt/dev_save/racy5225/puppy-init/usr/share/locales/ru
# cat init
#Pу
Attachments
addition_to_initrd.tar.gz
(33.02 KiB) Downloaded 603 times
Last edited by L18L on Tue 14 Feb 2012, 13:08, edited 1 time in total.

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

internationalization of initrd messages at bootup

#34 Post by L18L »

As there are some issues using the script t12s here is an altenative method for all who like to boot up in their own language (sorry: no Chinese, Japanese, Korean).
Arab and Hebrew use text editor yudit.
French: Deja fait par esmourguit

Just translate the following lines to your language.
1st line: your language in your language.
Let $.... unchanged
Post the translation here as file named
init.<your-language-code>
for inclusion in next initrd as
usr/share/locales/<your-language-code>/init

Thanks :)

#English
_M_10="${DROPOUT} not found. Dropping out to initial-ramdisk console..."
_M_1="0 none"
_M_11="Dropped to initramfs shell. Type 'exec switch' to continue booting Puppy."
_M_12="Dumping last lines of kernel log..."
_M_13="Dumping last lines of /tmp/bootinit.log..."
_M_14="ENTER key only to copy: "
_M_15="ENTER only to upgrade: "
_M_16="ERROR: Windows NTFS hibernated partition, cannot mount"
_M_17="failed"
_M_18="Folder $ONEFOLDER marked bad."
_M_19="from version $xOLDPVERSION"
_M_20="Hit the ENTER key only if it is okay to upgrade this file, or to not use it and boot up in RAM only type any other printable character."
_M_2="'${1}' filesystem check, please wait..."
_M_21="Increasing $PUPSAVEFILE by $KILOBIG Kbytes, please wait..."
_M_22="Loading drivers needed to access disk drives"
_M_23="Loading folder $ONEFOLDER from CD/DVD..."
_M_24="Loading personal file $PUPSAVEFILE ($PUPSAVEDEV)..."
_M_25="Loading '${PKEYS}' keyboard layout..."
_M_26="Loading the '${basepupsfs}' main file..."
_M_27="Mounting encrypted $PUPSAVEFILE..."
_M_28="NOTICE: As you type your password nothing will be displayed on the screen for absolute security. Just type it in then press ENTER key..."
_M_29="Overlaying preconfig files..."
_M_30="Overwritten old files have been moved to /tmp/versioncleanup/"
_M_31="Password: "
_M_32="pausing"
_M_33="Pausing for 60 seconds..."
_M_34="Performing a 'switch_root' to the layered filesystem..."
_M_35="RAM full"
_M_36="'save file' filesystem check, please wait..."
_M_37="Searching for Puppy files..."
_M_38="Setting up the layered filesystem..."
_M_39="SORRY, cannot check filesystem"
_M_3="After bootup please examine this directory (before shutdown) for anything that you might like to recover. Pausing 30 secs so you can read this msg..."
_M_40="SORRY, cannot resize $PUPSAVEFILE"
_M_41="...successfully mounted"
_M_42="The main Puppy file '${basepupsfs}' is being loaded off the optical disc."
_M_43="then on next boot it will load fast. Type any printable char not to copy it."
_M_44="This is a radical file cleanup for broken systems, could alter some settings."
_M_45="This is a simulated version upgrade, which performs a file cleanup."
_M_46="This save-file was last used with version $OLDDISTRO_VERSION of Puppy"
_M_47="Type a number to choose which personal file to use:"
_M_48="Version update, restoring 'official' files, please wait..."
_M_49="Very slow! Type ENTER key only to copy it to the same partition as the save-file"
_M_4="Backing off, not using save-file, booting in RAM only, PUPMODE=5..."
_M_50="(with a slow CPU this may take sometime, please be patient)"
_M_51="You are upgrading Puppy ${OLDstr} to ${NEWPVERSION}."
_M_5="'${basepupsfs}' now copying to hard drive (but only available next boot)..."
_M_6="Can't mount file, press ENTER key to try again, or any other char then ENTER for f.s. check then try again, or for developers type 'quit' to drop out to console: "
_M_7="...continuing with loading $PUPSAVEFILE..."
_M_8="copying to ram"
_M_9="done"

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

internationalization of initrd messages at bootup

#35 Post by L18L »

Menu is populated now by

Arabic (just some automatically translated phrases)
and French (complete translation by toutou´s creator esmourguit)

Font LatArCyrHeb-16.psfu.gz is added which enables Arabic and Hebrew.
Attachments
addition2_to_initrd.tar.gz
(39.18 KiB) Downloaded 609 times

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

Russian translation

#36 Post by rodin.s »

I have made Russian translation. But it works only for three top lines. Some other file (/etc/rc.d/rc.sysinit) has to be translated for the rest.
But it's good that Russian font in console is loaded in initrd and all Russian messages in console displayed well. My unicode pet is not needed.

Edit: gettext doesn't work in /etc/rc.d/rc.sysinit.
Edit2: No. I was wrong. Gettext works in /etc/rc.d/rc.sysinit. And now all console boot messages are in Russian.
Attachments
init.gz
Russian translation
(3.33 KiB) Downloaded 587 times
rc_sysinit.tar.gz
i18n with gettext of /etc/rc.d/rc.sysinit, pot file and ru.po and mo.
(12.75 KiB) Downloaded 606 times
Last edited by rodin.s on Wed 15 Feb 2012, 11:09, edited 1 time in total.

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

Re: Russian translation

#37 Post by L18L »

rodin.s wrote:I have made Russian translation. But it works only for three top lines. Some other file (/etc/rc.d/rc.sysinit) has to be translated for the rest.
But it's good that Russian font in console is loaded in initrd and all Russian messages in console displayed well. My unicode pet is not needed.

Edit: gettext doesn't work in /etc/rc.d/rc.sysinit.
Thank you very much rodin.s,

Your way of distributing the translation file is very good. I like it,
English as comment and an empty line

Code: Select all

#Ру

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

Russian translation

#38 Post by rodin.s »

I have found one small mistake in my translation (variable _M_8 was _M_7). init.gz is re-uploaded.
There is one strange but positive thing. When I boot pfix=ram and choose ru in initrd I got quicksetup in Russian while locale is set to en.

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

Re: Russian translation

#39 Post by L18L »

rodin.s wrote:I have found one small mistake in my translation (variable _M_8 was _M_7). init.gz is re-uploaded.
Thanks, I have updated my copy. Will be in next upload.
rodin.s wrote:There is one strange but positive thing. When I boot pfix=ram and choose ru in initrd I got quicksetup in Russian while locale is set to en.
The strange thing was intended 8)
It is done by setting LANGUAGE

At the moment this is not set properly as I did not know another way: It was written into /pup_rw/etc/rc.d/PUPSTATE by init script and can be found in puppy in the file /etc/rd.d/PUPSTATE.

Bad consequence is: You cannot run a program in another language

Code: Select all

LANGUAGE=de quicksetup
will stay in Russian for you
because quicksetup (and almost every other program is reading PUPSTATE and thus always stay Russian)

This is not good. I think people like me like to switch to another LANGUAGE sometimes.

fix:

Code: Select all

# [ `grep -E '^LANGUAGE=' /etc/rc.d/PUPSTATE` ] && ( mv /etc/rc.d/PUPSTATE P; sed 's/^LANGUAGE=/\#LANGUAGE=/' P > /etc/rc.d/PUPSTATE; rm P )
This one-liner makes the LANGUAGE=.. command in PUPSTATE to be a comment so you can use a LANGUAGE other than the one you have been booting.
This one-liner should be inserted maybe in quicksetup?

Or is there another better way for booting language being passthrough´ed :?:

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

gettext at bootup

#40 Post by L18L »

rodin.s wrote:...
Edit: gettext doesn't work in /etc/rc.d/rc.sysinit.
Edit2: No. I was wrong. Gettext works in /etc/rc.d/rc.sysinit. ...
It did not work with me.

And now I remember why I did not not publish the before mentioned script from 2010: it did not work.

And now it is clear why not:
quote from http://www.gnu.org/software/gettext/man ... iable.html
Note: The variable LANGUAGE is ignored if the locale is set to ‘C’. In other words, you have to first enable localization, by setting LANG (or LC_ALL) to a value other than ‘C’, before you can use a language priority list through the LANGUAGE variable.


At the time of running /etc/rc.d/rc.sysinit there is no locale set. That´s it!

When the desktop has been started there is a locale: LANG=en_US
and gettext prefers the LANGUAGE which was set as boot parameter or chosen in the menu.

I have made a version of rc.sysinit using t12s
tested succesfully in Russian and German.

The translation file was created from ru.po

Have fun :)
Attachments
rc.sysinit-t12s.tar.gz
/etc/rc.d/rc.sysinit
ru and de
(12.6 KiB) Downloaded 578 times

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

rc.sysinit works

#41 Post by rodin.s »

Yes, rc.sysinit with t12s is working. But one phrase "next boot will be faster" from rc.update also should to be translated.
Gettexted rc.sysinit started to work for me after I added line:

Code: Select all

LANG=$(cat /etc/profile | grep '^LANG=' | cut -d '=' -f2 )

Code: Select all

# cat /etc/profile | grep '^LANG=' | cut -d '=' -f2
ru_UA.UTF-8

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#42 Post by BarryK »

L18L,
I like your little i18n test program!

I have put the two fonts that you have provided into the initrd in Woof.

After bootup:
One problem: running in the console, I start 'mp' and the border lines do not display properly.

...I wonder if there is a fix for this?
[url]https://bkhome.org/news/[/url]

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

mp in console

#43 Post by L18L »

Barry,

console is urxvt or CONTROL-ALT-F2 ?

I have played with both of them,
did not see immediately the border line problem

file named äöü
see picture in X
äöü is blinking
same file named aou does not blink

in console (sorry no photograph available)
file name in title bar is displayed inproperly (equiv. to blinking?)

I can input äöü but it displaed not immediately correctly.
Attachments
mp.png
mp and UTF-8
(9.66 KiB) Downloaded 617 times

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

border lines

#44 Post by rodin.s »

Maybe Barry means border lines in menu when you press Ctrl-A. Maybe you could try two console fonts from my unicode pet ter-u16n.psf.gz and cyr-sun16.psfu.gz. Do not install the pet. Just unpack it and get fonts. In both of them border lines are back and both of them work for Russian and English. Not sure about other languages.

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

console font

#45 Post by L18L »

After rodin.s´ hint I have repeated test in console

From my view there is nothing bad to report about border lines
No ! ctrl-a menu: left border is corrupt

Just cosmetic

But
- no öü
- no §
neither in mp nor in command line!

My conclusion:
The "new" consolefont is good just for displaying
but not for input.

Do Puppians really use console for things other than ASCII :?:

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

border lines

#46 Post by rodin.s »

I took pictures of menu of mp with normal and new consolefonts.
Attachments
16-02-12_2345.jpg
new
(42.52 KiB) Downloaded 445 times
16-02-12_2351.jpg
normal
(43.33 KiB) Downloaded 407 times

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#47 Post by BarryK »

Yes, I meant when running mp from commandline, no X running.

rodin.s, thanks, I'll check out your alternative console fonts.

Well, I have implemented internationalization of the initrd in Woof, and built Racy 5.2.2.6 to test it:

http://bkhome.org/blog/?viewDetailed=02691

Note though, I used L18L's original technique of simple sed expressions. The implementation is extremely simple, you can see the 'init' script online:

http://bkhome.org/fossil/woof2.cgi/arti ... 8fd83a47d6

The /locale/de/init translation file in the initrd is not online as it gets generated by 3builddistro in Woof, from this file:

http://bkhome.org/fossil/woof2.cgi/arti ... 709a624016
...note, the comments in the [general] section are slightly wrong, the translation actually happens at every boot, and all other SSS domains are now using the same simple sed expressions technique.

A language-choice menu is not required in the initrd, as Woof now is able to edit the initrd.gz and insert file /PUPPYLANG -- except for case of booting off CD -- in that case, you are stuck with the English messages at early-bootup, but as soon as execution gets to rc.sysinit then translation will kick in.

Note also, keyboard layout gets set to match the language, unless set by pkeys boot param or file /PUPPYKEYMAP in initrd -- important in situation where have to enter a password for encrypted save-file.
[url]https://bkhome.org/news/[/url]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#48 Post by technosaurus »

whenever I have had issues with ncurses based interfaces, it was either:
a. the app needed ncursesw (unlikely if it works in X)
b. the incorrect terminfo was being exported and used ... I would guess that you need /usr/share/terminfo/l/linux and export TERM=linux in the initrd and init script respectively
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

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

terminfo

#49 Post by L18L »

technosaurus wrote:whenever I have had issues with ncurses based interfaces, it was either:
a. the app needed ncursesw (unlikely if it works in X)
b. the incorrect terminfo was being exported and used ... I would guess that you need /usr/share/terminfo/l/linux and export TERM=linux in the initrd and init script respectively
Before putting it into init one can try.
I have tried:

Code: Select all

TERM=linux-m mp
and the left borderline of menu was displayed :)
This was in racy 5.2.2.6

äöü
- is correct on command line
- not in mp editing

Is there a ncursesw.pet ?
Not found in PPM

_____________________________

edited
same issue with some borderlines in xorgwizard
Last edited by L18L on Fri 17 Feb 2012, 12:04, edited 2 times in total.

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

simple sed expressions

#50 Post by L18L »

BarryK wrote:...Note though, I used L18L's original technique of simple sed expressions. The implementation is extremely simple, you can see the 'init' script online:
And slightly faster without g.
But password should become
s%"Password: "%"Paßwort: "%g
because translation has to happen more than once.
(And tell the translator to NOT remove g) :wink:

Compliment, you have also solved the problem of
done
using
"done" 8)

Post Reply