Translation of early boot messages
I posted about implementing translation of the initrd (initramfs) in EasyOS:
http://bkhome.org/news/201901/sss-simple-string-substitution.html
I decided to use gettext rather than the SSS or t12s methods. So, it
was a matter of sorting out some details. The TEXTDOMAIN for the scripts
in the initrd is "easyinitrd", and I created a translation file for
German:
/usr/share/locale/de/LC_MESSAGES/easyinitrd.mo
Booting up the latest build of EasyOS, when QuickSetup ran, I chose
the "de_DE" locale, with the "UTF-8" checkbox ticked. Clicked "OK"
button, and got this:
I clicked "Yes", and it was done:
Then rebooted:
...if you think that translation is odd, it is because I used Google
Translation service. Lutz (L18L) has done better translation, however,
there are now more strings and some have changed -- I will post the
updated 'easyinitrd.pot' file soon to the forum.
Some technical notes:
QuickSetup (/usr/sbin/quicksetup) calls /usr/sbin/lang2initrd, which
is responsible for those two information windows shown above. Then,
/usr/sbin/fixinitrd is called, which does the actual translation -- it
opens up file 'initrd' in the boot-partition and appends
"INIT_LANG='de_DE.UTF-8'" (for the German case) in file /BOOT_SPECS
Some translation support files get installed into /usr/lib/locale and /usr/share/locale in the initrd, and it is then closed up.
That script 'fixinitrd' is supposed to work standalone. You can run
it in a terminal, say "fixinitrd en" and it will translate back to
English -- however, I haven't tested that yet.
There may be a problem with some languages. The initrd has psfu
fonts, and an appropriate one is loaded, based on the first two letters
of $INIT_LANG. Currently, there are only two,
/lib/consolefonts/LatArCyrHeb-16.psfu and LatGrkCyr-8x16.psfu, in the
initrd -- the "u" means that they have some UTF-8 mappings. Languages
ar, he and iw use the former, all other languages use the latter.
English (en) uses the inbuilt kernel font.
We may have to use other psfu fonts for accurate translation of some languages.
What is not yet done is translation of the Syslinux and reFind boot menus. Will do that very soon.
Tags: easy