First bootup 2-letter language asked in initrd
The method used to translate the scripts in the initrd has varied over the years. At one stage, I tried the gettext method. Prior to now, it has been the "sss" method; "simple string substitution", in which the strings in a script are completely replaced, resulting in a non-English script.
The latter method is clumsy, for various reasons. For example, if you want to change the scripts to a different language, copies of the original scripts in English have to be kept -- though, I have implemented a devious method of translating the non-English script back to English, then to another language. There are other problems also.
After some indecision, I have implemented a fairly simple and flexible system. All of the strings that a script will echo to the screen have been taken out to a separate file. This file is simply a list of variables, like this example, part of '/nls/init.str.fr':
S010='ERREUR :'
S011='Sont maintenant tombés dans un shell dans initramfs.'
S012='Veuillez appuyer sur la combinaison de touches CTRL-ALT-DEL pour redémarrer,'
S013='ou MAINTENEZ LE BOUTON D'ALIMENTATION POUR ARRÊTER'
S014='Les instructions suivantes sont réservées aux développeurs :'
The 'init.str.fr' file is just included into the script by the "source" or "." command. This allows very easy flipping a language within the script.
So far I have created .fr, .de and .it translation files, but it is very easy to create them. I just go to translate.google.com and paste the content of the .en file and select target language and in a minute have a translation. These translations will all be in the initrd.
I have introduced a new kernel commandline parameter, "qlang". If you put it into the kernel commandline in the boot-loader, say "qlang=fr", then the scripts in the initrd will automatically load the appropriate translation files.
If you don't have that "qlang" parameter, at the very first bootup the 'init' script will popup a dialog window:
...that is a compromise, as there is English text, and all the countries are the English names.
However, this dialog pops up early in the 'init' script, and immediately after, the script will load the appropriate language translation file. Well, it will do if one exists.
The GUI is only text-mode, using the 'dialog' utility. I do intend to have a more "proper" GUI sometime in the future. The 'dialog' utility is statically-linked, so standalone, requiring no libraries. See OE commit:
https://github.com/bkauler/oe-qky-kirkstone/commit/e219225f6e218092b07de07a8fa0b94fa39e8a88
Here are the relevant woofQ commits:
https://github.com/bkauler/woofq/commit/78108b6fddf84a44bf44622700c112a8c83d96d9
https://github.com/bkauler/woofq/commit/17776060658cd98fa592cc944d81cc0671d63dab
https://github.com/bkauler/woofq/commit/be75f24cac94d37eca50d2a8473c77aa027eb8a7
If anyone is interested in creating some translation files, here are the files:
https://github.com/bkauler/woofq/tree/main/easyos/easy-code/boot/initrd-tree/nls
Note, the above photo shows a very complete list, but I will be reducing it considerably. I put in every language to start with, but most of those are unlikely to be required. Tibetan, for example, can go. I could probably look at all the translations offered by, say, LibreOffice, and reduce to those.
EDIT 2023-01-14:
There are 137 languages in that list. I have reduced it to 86,
those languages offered by LibreOffice. Here they are:
af am ar as be bg bn bo br ca cs cy da de dz el en eo es et eu fa fi fr fy ga gd gl gu hi hr hu is it ja ka kk km kn ko ks lo lt lv mk ml mn mr my ne nl no oc om or pa pl pt ro ru rw sa sd si sk sl sq sr ss st sv sw ta te tg th tn tr ts tt uk uz vi xh zh zu
The Asian languages, such as Hindi, Japanese and Chinese, cannot be rendered in the initrd, so will stay at English. After bootup to the desktop, they will be offered, if suitable fonts are installed.
The problem in the initrd is the .psfu
console fonts are only 256 characters, and only implement a
small selection of unicode fonts. It is possible to get the full
UTF-8 fonts working in the initrd, but that will have to be a
future project.
Tags: easy