Opened 7 months ago

Closed 2 months ago

#23328 closed Bug (duplicate)

get_javascript_catalog bug

Reported by: liminspace Owned by: nobody
Component: Internationalization Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by timgraham)

There is a project with two languages: "en" and "uk" (ukrainian).
Default language is "uk".

There are pharases:

locale/
    en/
        djangojs.po
            msgid "Всім привіт!"
            msgstr "Hello everyone!"
    uk/
        djangojs.po
            msgid "Всім привіт!"
            msgstr ""

In this case, the activated language "uk" phrase "Всім привіт!" will be in "en" -- "Hello everyone!".
It's a bug, because must be "uk".

I propose remove loading "en" translation as default (is better).
Or change update method for other default language:

if default_locale != 'en':
    for path in paths:
        try:
            catalog = gettext_module.translation(domain, path, [default_locale])
        except IOError:
            catalog = None
        if catalog is not None:
            # t.update(catalog._catalog)  # remove it
            t = catalog._catalog          # <- add it

Change History (3)

comment:1 Changed 6 months ago by liminspace

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Version changed from 1.7-rc-2 to master

comment:2 Changed 2 months ago by timgraham

  • Description modified (diff)

Could you give simple steps to reproduce the issue (or attach a sample project)? I'm not an expert on translation or javascript_catalog, but my understanding is that we use t.update(catalog._catalog) in the code you mentioned so that any strings that don't have translations to the current locale will fallback to English.

comment:3 Changed 2 months ago by timgraham

  • Resolution set to duplicate
  • Status changed from new to closed

I think this is a duplicate of #16284 ("djangojs uses en as fallback language rather than projects language code").

Note: See TracTickets for help on using tickets.
Back to Top