Language file `en` missing

Wolfgang Scherer Wolfgang.Scherer at gmx.de
Mon Dec 2 02:08:40 UTC 2019


Am 01.12.19 um 22:58 schrieb Mads Kiilerich:
> On 12/1/19 10:10 PM, Wolfgang Scherer wrote:
>> ==================================================
>> Accept-Language bug
>> ==================================================
>>
>> If there is no language file `en` installed, kallithea does not handle
>> Accept-Language correctly, when `en` is the prioritized language, e.g.:
>
> Apparently related:
>
> https://kallithea-scm.org/repos/kallithea/changeset/04682d9fb33a

The English translation is not always redundant!
For a language priority of `nothere` -> `anything but en` -> `fr` ->  `default`,  the English translation is in fact redundant for the transition `fr` -> `default`..
For a language priority of `nothere` -> `en`                     -> `fr` ->  `default`,  the English translation is **not* redundant for `nothere` -> `en`, because without an English translation, the French translation is incorrectly used.

>
> https://kallithea-scm.org/repos/kallithea/changeset/89e50be94fcb
The reasons to give up a poorly maintained manual translation file are sound. A better option is to automatically create such a file.
>
> https://kallithea-scm.org/repos/kallithea/changeset/f2f7a8c1281e
>
With an automtically generated `en` translation file, it does not make a difference whether i8n.lang is set to `en` or left emtpy, the result is the same.
>
> Is your point that the problem would be fixed by providing an empty kallithea/i18n/en/LC_MESSAGES/kallithea.mo (and building a corresponding .po)?
Unfortunately, the translation file cannot be empty. Anything missing in the translation file is looked up in the next translation file of the chain.

However, it is quite simple to generate a full translation file from the automatically created .po template. I have just written such a generator at: http://sw-amt.ws/kallithea/public/kallithea-deploy/files/c92c49843628ac881d772cabf0c4ea445777f4fc/msgdup.py (relevant parts are :class:`MsgSection` and :func:`run`, the rest is boiler-plate). It handles the info attributes and plurals properly. The entire creation sequence is documented here: http://sw-amt.ws/kallithea-deploy/html/overview.html#install-a-language-file-for-en . I did not check, whether setup.py already provides such a facility.
>
> And for clarity, the default .ini should perhaps set the fallback language as   "i18n.lang = en"   and update the description accordingly?

I would not do that, since an older kallithea without an `en` translation file would choke on it with an error message.

If I should prepare anything further, let me know.

Wolfgang



More information about the kallithea-general mailing list