Skip to content

[akm] Add localization support#379

Open
khagaroth wants to merge 1 commit intoendeavouros-team:masterfrom
khagaroth:eos-akm-gettext
Open

[akm] Add localization support#379
khagaroth wants to merge 1 commit intoendeavouros-team:masterfrom
khagaroth:eos-akm-gettext

Conversation

@khagaroth
Copy link
Copy Markdown
Contributor

  • add gettext support, replace translatable strings with printf_gettext calls
  • add update_po_files script to generate / update POT and PO files
  • remove Finnish comment from akm.desktop and move it to fi.po, treat akm.desktop as a template and generate localized .desktop file at build time
  • add LANGUAGE setting to akm.conf to enable overriding UI language
  • add Czech translation

- add gettext support, replace translatable strings with
  printf_gettext calls
- add update_po_files script to generate / update POT and PO files
- remove Finnish comment from akm.desktop and move it to fi.po,
  treat akm.desktop as a template and generate localized .desktop
  file at build time
- add LANGUAGE setting to akm.conf to enable overriding UI language
- add Czech translation
@manuel-192
Copy link
Copy Markdown
Collaborator

Thanks for your contribution!

I'm planning on rewriting our translation system, and it will likely take a fair amount of time to implement.
Your contribution will surely help us along the way.

@khagaroth
Copy link
Copy Markdown
Contributor Author

Just FYI adding the gettext support was relatively easy, but I did bump into a few gotchas.

First, there is a bug that trips xgettext and breaks string extraction if the shell script contains a heredoc block with a single quote inside of it. Right now it requires a workaround - placing a comment with a single quote in it right after the heredoc. I reported this bug on the gettext bugtracker.

Another thing is that bash multi-line string handling with $() command substitution is a PITA to work with as it strips any trailing newlines. Not a problem with pure bash with output to the command-line as it doesn't need to use command substitution. But strings passed to yad either need to use 
 instead of \n or need to place the trailing \n outside the command substitution i.e. "text\ntext\n" -> "$(printf_gettext 'text\ntext')\n" as a kind of workaround to not loose trailing newlines.

Anyway, if you switch to gettext for the translation system rewrite, generating only the POT file and handling the PO files using a Weblate project and po-fetch (added in gettext 1.0) would be a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants