Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various i18n fixes #25

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Various i18n fixes #25

wants to merge 8 commits into from

Conversation

pinotree
Copy link

This PR does a number of changes & fixes related to i18n, mostly in the build system:

  • drop the old messages.po file
  • use ngettext() for the Processor/Processors plural form string
  • pass -c to msgfmt to ensure .po files are valid (no problems in the current files)
  • pass --previous to msgmerge to help translators
  • simplify the makefile rules in po/Makefile:
    • avoid hardcoding language names & filenames
    • do not update the pot file on build by default; this may result in a workflow change for maintainers, and the need to check that the messages are up-to-date from time to time
    • respect $(DESTDIR) when installing (follows the common practice, and the existing bits in the rest of linuxlogo)
    • simplify the xgettext invocation

I did not include the update of linux_logo.pot in this PR, nor the update of the translations. I can do that in a followup PR.

See the log message of each commit for longer explanations.

pinotree added 8 commits May 26, 2024 10:08
Properly use ngettext() to translate strings with singular/plural forms,
instead of hardcoding a n==1 check for any language.

Add an inline fallback ngettext() implementation for the "no i18n" case.
Remove messages.po, which is the default output file name of xgettext;
there is already linux_logo.pot as template.
Use makefile functions to get the list of available translations,
instead of hardcoding them. Build the list of languages, and expected mo
files from that as well.

Iterate on languages, as it is easier (no need to drop the suffix
manually every time).
Pass -c/--check to msgfmt, so it checks the validity of the po files,
rejecting invalid files.

There are no invalid translations in the current sources, so this is a
no-op change that will prevent mistakes in the future.
This way, the old msgid are preserved when a message is changed and
becomes fuzzy; this helps translators as they can easily see how the
msgid changed.
Every time xgettext is run, the generated template has its own
POT-Creation-Date field with the runtime timestamp; because of this,
the comparison between the existing template and the new one (using
`cmp`) always results as "different".

Hence, simply run xgettext with the wanted output file, as the result
is the same; make use of the automatic make variables to avoid repeating
variables in the command invocation.
While it can be useful to keep the translation catalog up-to-date,
updating it every time a file is changed is a bit wasteful.

Hence, do not ensure that the pot file is updated on 'all'. This will
likely require some manual update from time to time to make sure that
the translatable messages are still up-to-date, however they do not
change that often in linuxlogo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant