mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.58k stars 1.62k forks source link

i18n: Support passing arguments to `msgfmt` #13749

Open Kangie opened 3 weeks ago

Kangie commented 3 weeks ago

Describe the bug Currently there is no way to pass an option (e.g. -f/--use-fuzzy) to msgfmt meaning that we are unable to successfully translate projects that have extant translations (albeit marked fuzzy).

While modifying the translation to not be fuzzy is an option, this will increase translator workload and require that existing strings be reviewed.

Instead we should provide a configuration option of some kind that enables this (not uncommon) workflow.

To Reproduce N/A, see:

https://github.com/mesonbuild/meson/blob/d48602a5f3dade3c1800b3e3d11ad09a45a761a2/mesonbuild/modules/i18n.py#L288-L306

Expected behavior Projects should be able to pass appropriate options to msgfmt, be this via an explicitly-whitelisted list or directly "at your own risk".

E.g.:

i18n = import('i18n')
i18n.gettext(meson.project_name(), msgfmt_fuzzy=true)

or

i18n = import('i18n')
i18n.msgfmt(
    args = [ 'some', '-arbitrary', '--args=true' ]
)
i18n.gettext(meson.project_name())

system parameters N/A

eli-schwartz commented 2 weeks ago

msgfmt is now standardized by POSIX 2024: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/msgfmt.html

I suppose that we can assume any of the POSIX documented options shall exist. :) I do not know whether gettext-tiny, which predates 2024, is conformant but they presumably wish to be.

/cc @alanc @awilfox @q66

q66 commented 2 weeks ago

i removed gettext-tiny over a year ago so i no longer care myself

awilfox commented 2 weeks ago

I'll look more in-depth later, but:

Kangie commented 2 weeks ago

-f: silently ignored, can work with upstream if this is needed

I would say so; any projects that have translations marked fuzzy will have those lines silently excluded from the output if this option is not honoured, resulting in incomplete message object files and a big WTF debugging session.

This sort of translation omission is also unlikely to be picked during testing - we got lucky with fvwm3 that this was caught early.