Page MenuHomePhabricator

Configure fallback locales for vue-i18n
Closed, ResolvedPublic

Description

Out of the box vue-i18n does fallback lookups for messages by trimming off parts of the <language>-<region>-<dialect> locale label. This means that a hypothetical locale of de-DE-bavarian would look in:

  • de-DE-bavarian
  • de-DE
  • de

We can configure fancier fallback chains using a fallbackLocale map.

Event Timeline

See T258492#6490574 for a trick to extract fallbacks from MediaWiki's source code.

bd808 moved this task from Backlog to In Progress on the Toolhub board.
bd808 triaged this task as Medium priority.Dec 22 2020, 4:33 PM

Change 651556 had a related patch set uploaded (by BryanDavis; owner: Bryan Davis):
[wikimedia/toolhub@main] i18n: Configure fallback locales for vue-i18n

https://gerrit.wikimedia.org/r/651556

Using the sed command from T258492#6490574 I have been able to extract a collection of fallback rules from the MediaWiki code and create the map included in https://gerrit.wikimedia.org/r/651556.

One thing to note with this, we should take fallback chains into consideration if we start lazy loading locales in the future. This would mean doing some lookup of the fallback chain when switching locale and loading all the locales in the chain. Not an impossible thing at all, but something to keep in mind for the future.

Change 651556 merged by jenkins-bot:
[wikimedia/toolhub@main] i18n: Configure fallback locales for vue-i18n

https://gerrit.wikimedia.org/r/651556