Skip to content

Localize speed and variant labels#3249

Open
Matrix9494 wants to merge 4 commits into
lichess-org:mainfrom
Matrix9494:tran_bug
Open

Localize speed and variant labels#3249
Matrix9494 wants to merge 4 commits into
lichess-org:mainfrom
Matrix9494:tran_bug

Conversation

@Matrix9494
Copy link
Copy Markdown
Contributor

Summary

This PR localizes speed and variant labels in the mobile UI by reusing existing translation keys.

It adds mobile l10n generation for existing variant names from variant.xml, then uses those localized labels across game creation, challenges, offline computer setup, over-the-board setup, studies, analysis, and variant pickers.

It also switches speed labels such as Bullet, Blitz, Rapid, Classical, and Correspondence to existing localized strings where they are shown in the UI.

Comment thread lib/src/model/common/chess.dart Outdated
@@ -130,6 +130,31 @@ enum Variant {
final String label;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove label if we are going to use the translated one instead (which should then be called label).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done locally. One detail I noticed is that the old Variant.label was not only used as UI text. A few places use it for PGN/export or protocol-like data, where the stable English value should be kept.

So I split the old usage into two explicit APIs:

  • label(l10n) for localized UI text
  • pgnName for the old stable English value

pgnName is effectively the previous Variant.label, just renamed to make its non-UI purpose explicit. I originally used translatedLabel(l10n) because I wanted to avoid breaking those existing non-UI usages.

Does that naming look good to you, or would you prefer another name for the old stable English label?

Comment thread lib/src/model/common/speed.dart Outdated
}
}

String translatedLabel(AppLocalizations l10n) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same: remove existing label and name this one label, we don't want to use the non-translated string anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants