site  contact  subhomenews

Escaping characters in translation strings in initrd

January 25, 2023 — BarryK

Introduction here:

https://bkhome.org/news/202301/first-bootup-2-letter-language-asked-in-initrd.html

But, there are complications, discussed here:

https://forum.puppylinux.com/viewtopic.php?p=79487#p79487

Thinking, will go back to having the strings in single-quotes, and escape embedded single-quotes. Original:

S104='Ok let's put in single-quote and "double quote" characters in same string'

Now:

S104='Ok let'\''s put in single-quote and "double quote" characters in same string'

Reckon this is the simplest solution. I don't like the S104=$'text' nor the S104="text" formats, as they both involve interpretation of the string, don't treat it as-is. Single-quotes as-is is also faster.

EDIT:
Have implemented the change, see github commit:

"format of translation strings in initrd changed"
https://github.com/bkauler/woofq/commit/f00f5e72686abf97d4939f7692d32944ea19e332

The strings are now single-quote characters at each end. Furthermore, single-quote characters within the string are not escaped. Instead, they are automatically escaped when EasyOS is built:

"escape single-quote char within initrd translations"
https://github.com/bkauler/woofq/commit/5148393b4d773f228eb8806f6c3ce8d8c45edbb0

See also the README:

https://github.com/bkauler/woofq/blob/main/easyos/easy-code/boot/initrd-tree/nls/README 

Tags: easy