Language file `en` missing

Wolfgang Scherer Wolfgang.Scherer at gmx.de
Sun Dec 1 21:10:16 UTC 2019


==================================================
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.:

.. code-block:: text

   Accept-Language: en-US, en;q=0.8, de-DE;q=0.5, de;q=0.3

--------------------------------------------------
Environment
--------------------------------------------------

INI settings:

.. code-block:: ini

   ## Internationalization (see setup documentation for details)
   ## By default, the language requested by the browser is used if available.
   #i18n.enabled = false
   ## Fallback language, empty for English (valid values are the names of subdirectories in kallithea/i18n):
   i18n.lang =

---------------------------------------------------
Request with Prio English, German
---------------------------------------------------

If there is no language file for `en` installed, the language file
`de` is used, which is an **error**.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message file `en` not installed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Since language file `en` cannot be found, the message file `de` is
used, which has higher priority than the fallback. **This is an
error**.

.. code-block:: text

   Accept-Language: en-US, en;q=0.8, de-DE;q=0.5, de;q=0.3

.. code-block:: text

   [tg.request_local] Request.languages_best_match: en-US, en;q=0.8, de-DE;q=0.5, de;q=0.3
   [tg.request_local] Request.languages_best_match: ['en-US', 'en', 'de-DE', 'de']
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('en', 'US', None, None)
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('en', None, None, None)
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('de', 'DE', None, None)
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('de', None, None, None)
   [tg.request_local] Request.languages_best_match: en-US, en;q=0.8, de-DE;q=0.5, de;q=0.3
   [tg.request_local] Request.languages_best_match: ['en-US', 'en', 'de-DE', 'de']
   [tg.i18n] ugettext: tg.translator.info(): content-transfer-encoding: 8bit
   [tg.i18n] ugettext: tg.translator.info(): content-type:             text/plain; charset=utf-8
   [tg.i18n] ugettext: tg.translator.info(): generated-by:             Babel 2.7.0
   [tg.i18n] ugettext: tg.translator.info(): language:                 de
   [tg.i18n] ugettext: tg.translator.info(): language-team:            de <LL at li.org>
   [tg.i18n] ugettext: tg.translator.info(): last-translator:          FULL NAME <EMAIL at ADDRESS>
   [tg.i18n] ugettext: tg.translator.info(): mime-version:             1.0
   [tg.i18n] ugettext: tg.translator.info(): plural-forms:             nplurals=2; plural=n != 1
   [tg.i18n] ugettext: tg.translator.info(): po-revision-date:         YEAR-MO-DA HO:MI+ZONE
   [tg.i18n] ugettext: tg.translator.info(): pot-creation-date:        2019-11-30 22:58+0100
   [tg.i18n] ugettext: tg.translator.info(): project-id-version:       PROJECT VERSION
   [tg.i18n] ugettext: tg.translator.info(): report-msgid-bugs-to:     translations at kallithea-scm.org

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message file `en` installed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Since language file `en` is found, it is used, which is the corrct
behavior.

.. code-block:: text

   Accept-Language: en-US, en;q=0.8, de-DE;q=0.5, de;q=0.3

.. code-block:: text

   [tg.request_local] Request.languages_best_match: en-US, en;q=0.8, de-DE;q=0.5, de;q=0.3
   [tg.request_local] Request.languages_best_match: ['en-US', 'en', 'de-DE', 'de']
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('en', 'US', None, None)
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('en', None, None, None)
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('de', 'DE', None, None)
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('de', None, None, None)
   [tg.request_local] Request.languages_best_match: en-US, en;q=0.8, de-DE;q=0.5, de;q=0.3
   [tg.request_local] Request.languages_best_match: ['en-US', 'en', 'de-DE', 'de']
   [tg.i18n] ugettext: tg.translator.info(): content-transfer-encoding: 8bit
   [tg.i18n] ugettext: tg.translator.info(): content-type:             text/plain; charset=utf-8
   [tg.i18n] ugettext: tg.translator.info(): generated-by:             Babel 1.3
   [tg.i18n] ugettext: tg.translator.info(): language-team:            en <LL at li.org>
   [tg.i18n] ugettext: tg.translator.info(): last-translator:          Wolfgang Scherer <wolfgang.scherer at gmx.de>>
   [tg.i18n] ugettext: tg.translator.info(): mime-version:             1.0
   [tg.i18n] ugettext: tg.translator.info(): plural-forms:             nplurals=2; plural=(n != 1)
   [tg.i18n] ugettext: tg.translator.info(): po-revision-date:         2019-12-01 16:57+0100
   [tg.i18n] ugettext: tg.translator.info(): pot-creation-date:        2019-12-01 16:44+0100
   [tg.i18n] ugettext: tg.translator.info(): project-id-version:       Kallithea 0.5.0
   [tg.i18n] ugettext: tg.translator.info(): report-msgid-bugs-to:     translations at kallithea-scm.org

---------------------------------------------------
Request with Prio German, English
---------------------------------------------------

There is no difference, whether language file `en` is installed or not.

Language file `en` is **not** installed, language file `de` is found.

.. code-block:: text

   Accept-Language: de-DE, de;q=0.8, en-US;q=0.5, en;q=0.3

.. code-block:: text

   [tg.request_local] Request.languages_best_match: de-DE, de;q=0.8, en-US;q=0.5, en;q=0.3
   [tg.request_local] Request.languages_best_match: ['de-DE', 'de', 'en-US', 'en']
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('de', 'DE', None, None)
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('de', None, None, None)
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('en', 'US', None, None)
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('en', None, None, None)
   [tg.request_local] Request.languages_best_match: de-DE, de;q=0.8, en-US;q=0.5, en;q=0.3
   [tg.request_local] Request.languages_best_match: ['de-DE', 'de', 'en-US', 'en']
   [tg.i18n] ugettext: tg.translator.info(): content-transfer-encoding: 8bit
   [tg.i18n] ugettext: tg.translator.info(): content-type:             text/plain; charset=utf-8
   [tg.i18n] ugettext: tg.translator.info(): generated-by:             Babel 2.7.0
   [tg.i18n] ugettext: tg.translator.info(): language:                 de
   [tg.i18n] ugettext: tg.translator.info(): language-team:            de <LL at li.org>
   [tg.i18n] ugettext: tg.translator.info(): last-translator:          FULL NAME <EMAIL at ADDRESS>
   [tg.i18n] ugettext: tg.translator.info(): mime-version:             1.0
   [tg.i18n] ugettext: tg.translator.info(): plural-forms:             nplurals=2; plural=n != 1
   [tg.i18n] ugettext: tg.translator.info(): po-revision-date:         YEAR-MO-DA HO:MI+ZONE
   [tg.i18n] ugettext: tg.translator.info(): pot-creation-date:        2019-11-30 22:58+0100
   [tg.i18n] ugettext: tg.translator.info(): project-id-version:       PROJECT VERSION
   [tg.i18n] ugettext: tg.translator.info(): report-msgid-bugs-to:     translations at kallithea-scm.org

Language file `en` is installed, language file `de` is found.

.. code-block:: text

   Accept-Language: de-DE, de;q=0.8, en-US;q=0.5, en;q=0.3

.. code-block:: text

   [tg.request_local] Request.languages_best_match: de-DE, de;q=0.8, en-US;q=0.5, en;q=0.3
   [tg.request_local] Request.languages_best_match: ['de-DE', 'de', 'en-US', 'en']
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('de', 'DE', None, None)
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('de', None, None, None)
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('en', 'US', None, None)
   [tg.i18n] _parse_locale: lang, territory, script, variant: ('en', None, None, None)
   [tg.request_local] Request.languages_best_match: de-DE, de;q=0.8, en-US;q=0.5, en;q=0.3
   [tg.request_local] Request.languages_best_match: ['de-DE', 'de', 'en-US', 'en']
   [tg.i18n] ugettext: tg.translator.info(): content-transfer-encoding: 8bit
   [tg.i18n] ugettext: tg.translator.info(): content-type:             text/plain; charset=utf-8
   [tg.i18n] ugettext: tg.translator.info(): generated-by:             Babel 2.7.0
   [tg.i18n] ugettext: tg.translator.info(): language:                 de
   [tg.i18n] ugettext: tg.translator.info(): language-team:            de <LL at li.org>
   [tg.i18n] ugettext: tg.translator.info(): last-translator:          FULL NAME <EMAIL at ADDRESS>
   [tg.i18n] ugettext: tg.translator.info(): mime-version:             1.0
   [tg.i18n] ugettext: tg.translator.info(): plural-forms:             nplurals=2; plural=n != 1
   [tg.i18n] ugettext: tg.translator.info(): po-revision-date:         YEAR-MO-DA HO:MI+ZONE
   [tg.i18n] ugettext: tg.translator.info(): pot-creation-date:        2019-11-30 22:58+0100
   [tg.i18n] ugettext: tg.translator.info(): project-id-version:       PROJECT VERSION
   [tg.i18n] ugettext: tg.translator.info(): report-msgid-bugs-to:     translations at kallithea-scm.org




More information about the kallithea-general mailing list