Support falling back to another language, if a PO for a language is partially translated
Currently the default implementation fallback to msgid if the translation for a language is missing. However, in many cases, we would want the user to choose a fallback language, so that if there is some missing translation, they can still read in what they would prefer.
There is handle_missing_translation, but a big problem is that it does not get msgctxt, so if we would like to try gettext again with some other language, we do not have enough information to do so -- suppose the initial call is dpgettext or so.
A simple solution would be pass msgctxt to handle_missing_translation functions. Or just support fallbacking natively in the module.
Downstream
https://git.pleroma.social/pleroma/pleroma/-/merge_requests/3634#note_89751
A pull request is welcome. We should define a new version of those callbacks that receive the context. Later I can do a quick pass to make it backwards compatible.
@tusooa any updates on this?
@tusooa any updates on this?
We already implemented support for fallbacks in Pleroma.
@tusooa fantastic 🙃 Do you think that's something that we should backport back to Gettext, or were you able to do this with the current Gettext API, meaning no changes are needed to Gettext?
@tusooa fantastic upside_down_face Do you think that's something that we should backport back to Gettext, or were you able to do this with the current Gettext API, meaning no changes are needed to Gettext?
With https://github.com/elixir-gettext/gettext/pull/304 , we are able to implement fallbacks already. It would be nice to have native fallbacks in the library, just like GNU gettext, but with the bug in the environment, it may be hard to deliver a result that satisfies everyone.
Okay, so for now I'll close this then. Thanks for reporting back! 💟