Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#30241 closed Cleanup/optimization (fixed)

Add system checks to ensure correct configuration of translation settings.

Reported by: Nick Pope Owned by: Nick Pope
Component: Core (System checks) Version: dev
Severity: Normal Keywords: translations, system checks, language tags
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Nick Pope)

Following on from #29713 which added translation.E001 to check LANGUAGE_CODE, I proposed the following:;

  • translation.E002: 'You have provided an invalid language code in the LANGUAGES setting: {}.'
  • translation.E003: 'You have provided an invalid language code in the LANGUAGES_BIDI setting: {}.'
  • translation.E004: 'You have provided a value for the LANGUAGE_CODE setting that is not in the LANGUAGES setting.'
  • translation.W005: 'You have provided values in the LANGUAGES_BIDI setting that are not in the LANGUAGES setting.'

Note W005 instead of E005 - this case can simply be a warning because it will not cause things to go wrong, but highlights a potential configuration issue.

Change History (7)

comment:1 by Nick Pope, 6 years ago

Description: modified (diff)
Has patch: set
Patch needs improvement: set

comment:2 by Tim Graham, 6 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Nick Pope, 6 years ago

Patch needs improvement: unset

comment:4 by Mariusz Felisiak, 5 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

Resolution: fixed
Status: assignedclosed

In 4400d82:

Fixed #30241 -- Added more system checks of translation settings.

comment:6 by Matthias Kestenholz, 5 years ago

It seems that when overriding LANGUAGES it's required to override LANGUAGES_BIDI too. This might not be intentional...?

Example failure: https://travis-ci.org/matthiask/feincms3-sites/jobs/517232818 respectively

Destroying test database for alias 'default' ('test_feincms3_sites')...
SystemCheckError: System check identified some issues:
ERRORS:
?: (translation.E005) You have provided values in the LANGUAGES_BIDI setting that are not in the LANGUAGES setting.
System check identified 1 issue (0 silenced).
The command "cd tests && ./manage.py test -v 2 testapp && cd .." exited with 1.

This is with LANGUAGES = (("en", "English"), ("de", "German")) and LANGUAGES_BIDI from django/conf/global_settings.py

Version 0, edited 5 years ago by Matthias Kestenholz (next)

comment:7 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

In 0a01ca80:

Refs #30241 -- Fixed BytesWarning emitted in test_translation tests.

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