Project

General

Profile

Actions

Defect #15617

closed

Regional (i.e. sub) localization not correctly supported

Added by J D about 11 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
I18n
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Duplicate
Affected version:

Description

Environment:
  Redmine version                2.4.1.stable
  Ruby version                   2.0.0-p247 (2013-06-27) [x86_64-linux]
  Rails version                  3.2.15
  Environment                    development
  Database adapter               PostgreSQL

I have encountered a reliably repeatable bug when using regional localization (like en-GB) within Redmine.

The manifestation is a significant number of "translation missing" messages on screen, including for core labels like "translation missing: en.label_project_plural" and "translation missing: en.label_logged".

To reproduce, create/utilise a plugin providing a sub-regional translation file (e.g. en-GB), in the knowledge that Redmine core does not ship with a corresponding locale file and will defer to the fallback locale (e.g. en).

The bug can be observed by switching Language from the user "MyAccount" section, or during a login (when the user has a different regional locale to the installation's default locale).

The cause appears to be that when Redmine initialises regional locales (e.g. "en-GB"), it also loads the fallback locale (:en) - but only using files where a corresponding en-GB.yml file does not exist.

This creates two keys in Redmine's i18n translations dictionary ("en" and "en-GB"), however only 1 of them (en-GB) is populated with data from all available en-GB files - the other key (en) is lacking all translation from files that were not required to satisfy renderings for en-GB.

When the locale is subsequently switched from "en-GB" to "en" (or vice-versa depending on whichever locale was requested first by a user) due to a logon or a user selection, the alternative locale is considered already loaded since it's key exists even though the hash table is incomplete. This causes failed translation lookups.

I would offer a fix if I knew ruby, i18n and Redmine well enough, but hopefully this information facilitates a patch.

Interim solution (for me) is to not use sub-regional localisation (and remove this support from plugins that do).


Related issues

Is duplicate of Redmine - Defect #12900: Template::Error (translation missing: en.date.formats.default)Closed

Actions
Actions #1

Updated by Toshi MARUYAMA about 11 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

Duplicate with #12900.
Try cache clear.

Actions #2

Updated by Toshi MARUYAMA about 11 years ago

  • Is duplicate of Defect #12900: Template::Error (translation missing: en.date.formats.default) added
Actions #3

Updated by J D about 11 years ago

Clearing cache has no effect (& isn't a feasible solution on a running production site)

Actions #4

Updated by J D about 11 years ago

Fixed by correcting "en" to "en-GB" in locale file as advised in related ticket.

Thanks Toshi

Actions

Also available in: Atom PDF