Closed Bug 1340003 Opened 7 years ago Closed 7 years ago

Internal Server Error when translating into a candidate language

Categories

(developer.mozilla.org Graveyard :: Localization, enhancement)

All
Other
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jwhitlock, Assigned: safwan)

References

Details

(Keywords: in-triage, Whiteboard: [specification][type:bug])

What did you do?
================
Bulgarian (bg) was added to CANDIDATE_LANGUAGES, and is enabled on MDN's staging server (last entry):

https://developer.allizom.org/bg/

It appears in the list of possible languages for translation:

https://developer.allizom.org/en-US/docs/Web/CSS$locales


What happened?
==============
When Bulgarian is selected, an Internal Server Error occurs

What should have happened?
==========================
The translation interface should appear

Is there anything else we should know?
======================================
Tracked in Sentry: https://sentry.prod.mozaws.net/operations/mdn-stage/issues/382596/

Error is "KeyError: u'bg'"

Last part of traceback:

  File "kuma/wiki/views/translate.py", line 261, in translate
    language = language_mapping[document_locale.lower()]

The language_mapping does not include the candidate languages:

https://github.com/mozilla/kuma/blob/master/kuma/core/apps.py#L21
See Also: → 1339948, 1265891
Severity: normal → enhancement
Keywords: in-triage
@jwhitlock How do you have enabled "bg" in staging server?
Have you Added it to MDN_LANGUAGES setting settings_local.py file?
Flags: needinfo?(jwhitlock)
No, this is enabled by recent code from this year, adding a CANDIDATE_LANGUAGES item to settings:

https://github.com/mozilla/kuma/blob/b68f5fb1c6179097f4dd223c8c285c52d2bbd890/kuma/settings/common.py#L191-L194

There's a function enable_candidate_languages() that updates settings to enable the candidate languages:

https://github.com/mozilla/kuma/blob/726cfd2f3f4653808151df25f147490e58acc95e/kuma/settings/common.py#L264-L275

This is done on the staging server when kuma/settings/stage.py is loaded:

https://github.com/mozilla/kuma/blob/726cfd2f3f4653808151df25f147490e58acc95e/kuma/settings/stage.py#L20

The language_mapping has not been updated to be aware of CANDIDATE_LANGUAGES:

https://github.com/mozilla/kuma/blob/726cfd2f3f4653808151df25f147490e58acc95e/kuma/core/apps.py
Flags: needinfo?(jwhitlock)
Proposed PR: https://github.com/mozilla/kuma/pull/4155
Assignee: nobody → safwan.rahman15
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/cf69bf4300e0fd07e0f53f71fa45098e7db1e35e
[Bug 1340003] Internal Server Error when translating into a candidate language

https://github.com/mozilla/kuma/commit/06bff8973e82192bcd1d3d4e6de411d0094011fa
Merge pull request #4155 from safwanrahman/fix-candidate-language

[Bug 1340003] Internal Server Error when translating into a candidate language
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/286e1aebca006cafc5a27076f7682b723efce78a
bug 1340003: Use settings.LANGUAGES, path parsing

In locale_and_slug_from_path, use settings.LANGUAGES, which includes any
enabled candidate languages. This is used by KumaScript, like:
/en-US/docs/fr/Web/CSS

https://github.com/mozilla/kuma/commit/f56a544a255e9bf87e2de0b670b53029b792d31a
bug 1340003: Use settings.LANGUAGES in sitemaps

In build_sitemaps(), create the locale list from settings.LANGUAGES,
which includes enabled candidate languages.

https://github.com/mozilla/kuma/commit/8be77448faa34c31c5e3ce2a265791fb02cdfab2
Merge pull request #4156 from jwhitlock/more_candidate_lang_1340003

bug 1340003: More changes for candidate languages
Fixes pushed to stage and production. Thanks safwan!
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.