Allow composition of GMST l10n values

I don't know if we want an issue for this. GMST localization files don't appear to be documented anyway.

This MR expands the l10n yaml format for the gmst "locale". Specifically, it allows format specifiers in GMST strings to be replaced by ICU style variables. It also allows multiple GMST strings to be combined into a single message.

The second commit provides an example of why we need (something like) this. MWGui::Widgets::MWSpellEffect::updateWidgets has a few more reasons. The sPercent string from that file should, for example, be replaced with ICU's percent number format in any non-GMST-based translation.

The new format consists of an object/map with two keys:

  • pattern a string in which {gmst:X} tokens will be replaced with the value of GMST X
  • variables an (optional) array of string arrays specifying the variable names (and formatting rules) of any format specifiers in the replaced tokens

Technically the old string format was also adjusted. I don't expect anyone to notice, but the GMST values are now escaped meaning it's no longer possible for ICU style tokens to be replaced in them. i.e. the GMST string {a} will not be replaced by the value of the a variable, instead it will always produce the literal string {a}. This is a minor bug fix.

Merge request reports

Loading