Skip to content

Support language settings #1513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,26 @@
"@openLinksWithInAppBrowser": {
"description": "Label for toggling setting to open links with in-app browser"
},
"languageSettingTitle": "Language",
"@languageSettingTitle": {
"description": "Title for language setting."
},
"languageEn": "English",
"@languageEn": {
"description": "Label for the English language."
},
"languagePl": "Polish",
"@languagePl": {
"description": "Label for the Polish language."
},
"languageRu": "Russian",
"@languageRu": {
"description": "Label for the Russian language."
},
"languageUk": "Ukrainian",
"@languageUk": {
"description": "Label for the Ukrainian language."
},
"pollWidgetQuestionMissing": "No question.",
"@pollWidgetQuestionMissing": {
"description": "Text to display for a poll when the question is missing"
Expand Down
22 changes: 22 additions & 0 deletions docs/translation.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ is working correctly.

## Adding new UI strings

<div id="add-string" />

### Adding a string to the translation database

To add a new string in the UI, start by
Expand Down Expand Up @@ -79,6 +81,26 @@ For example:
`zulipLocalizations.subscribedToNChannels(store.subscriptions.length)`.


## Adding a new language

ARB files for new languages are automatically created in pull requests generated
by [the update-translations GitHub workflow](/.github/workflows/update-translations.yml).
However, this won't make them in the in-app settings UI.

On [Weblate](https://hosted.weblate.org/projects/zulip/zulip-flutter/),
we can check the percentage of strings translated in each language.
We use this information to determine if we should start offerring the language
in the in-app settings UI. For reference, on the web app, we offer a language
when it is 5% translated. (Search for `percent_translated` in the server code.)

When a language has a good percentage of strings translated, follow these steps
to add it:

- If the language tag is, for example, 'en-GB', [add a string](#add-string)
named 'languageEnGb'.
- Update [localizations.dart](/lib/model/localizations.dart) to include the new language in
`languages`, following the instructions there.

## Hack to enforce locale (for testing, etc.)

For testing the app's behavior in different locales,
Expand Down
30 changes: 30 additions & 0 deletions lib/generated/l10n/zulip_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,36 @@ abstract class ZulipLocalizations {
/// **'Open links with in-app browser'**
String get openLinksWithInAppBrowser;

/// Title for language setting.
///
/// In en, this message translates to:
/// **'Language'**
String get languageSettingTitle;

/// Label for the English language.
///
/// In en, this message translates to:
/// **'English'**
String get languageEn;

/// Label for the Polish language.
///
/// In en, this message translates to:
/// **'Polish'**
String get languagePl;

/// Label for the Russian language.
///
/// In en, this message translates to:
/// **'Russian'**
String get languageRu;

/// Label for the Ukrainian language.
///
/// In en, this message translates to:
/// **'Ukrainian'**
String get languageUk;

/// Text to display for a poll when the question is missing
///
/// In en, this message translates to:
Expand Down
15 changes: 15 additions & 0 deletions lib/generated/l10n/zulip_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,21 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get openLinksWithInAppBrowser => 'Open links with in-app browser';

@override
String get languageSettingTitle => 'Language';

@override
String get languageEn => 'English';

@override
String get languagePl => 'Polish';

@override
String get languageRu => 'Russian';

@override
String get languageUk => 'Ukrainian';

@override
String get pollWidgetQuestionMissing => 'No question.';

Expand Down
15 changes: 15 additions & 0 deletions lib/generated/l10n/zulip_localizations_de.dart
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,21 @@ class ZulipLocalizationsDe extends ZulipLocalizations {
@override
String get openLinksWithInAppBrowser => 'Open links with in-app browser';

@override
String get languageSettingTitle => 'Language';

@override
String get languageEn => 'English';

@override
String get languagePl => 'Polish';

@override
String get languageRu => 'Russian';

@override
String get languageUk => 'Ukrainian';

@override
String get pollWidgetQuestionMissing => 'No question.';

Expand Down
15 changes: 15 additions & 0 deletions lib/generated/l10n/zulip_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,21 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get openLinksWithInAppBrowser => 'Open links with in-app browser';

@override
String get languageSettingTitle => 'Language';

@override
String get languageEn => 'English';

@override
String get languagePl => 'Polish';

@override
String get languageRu => 'Russian';

@override
String get languageUk => 'Ukrainian';

@override
String get pollWidgetQuestionMissing => 'No question.';

Expand Down
15 changes: 15 additions & 0 deletions lib/generated/l10n/zulip_localizations_it.dart
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,21 @@ class ZulipLocalizationsIt extends ZulipLocalizations {
@override
String get openLinksWithInAppBrowser => 'Open links with in-app browser';

@override
String get languageSettingTitle => 'Language';

@override
String get languageEn => 'English';

@override
String get languagePl => 'Polish';

@override
String get languageRu => 'Russian';

@override
String get languageUk => 'Ukrainian';

@override
String get pollWidgetQuestionMissing => 'No question.';

Expand Down
15 changes: 15 additions & 0 deletions lib/generated/l10n/zulip_localizations_ja.dart
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,21 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get openLinksWithInAppBrowser => 'Open links with in-app browser';

@override
String get languageSettingTitle => 'Language';

@override
String get languageEn => 'English';

@override
String get languagePl => 'Polish';

@override
String get languageRu => 'Russian';

@override
String get languageUk => 'Ukrainian';

@override
String get pollWidgetQuestionMissing => 'No question.';

Expand Down
15 changes: 15 additions & 0 deletions lib/generated/l10n/zulip_localizations_nb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,21 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
@override
String get openLinksWithInAppBrowser => 'Open links with in-app browser';

@override
String get languageSettingTitle => 'Language';

@override
String get languageEn => 'English';

@override
String get languagePl => 'Polish';

@override
String get languageRu => 'Russian';

@override
String get languageUk => 'Ukrainian';

@override
String get pollWidgetQuestionMissing => 'No question.';

Expand Down
15 changes: 15 additions & 0 deletions lib/generated/l10n/zulip_localizations_pl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,21 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
@override
String get openLinksWithInAppBrowser => 'Otwieraj odnośniki w aplikacji';

@override
String get languageSettingTitle => 'Language';

@override
String get languageEn => 'English';

@override
String get languagePl => 'Polish';

@override
String get languageRu => 'Russian';

@override
String get languageUk => 'Ukrainian';

@override
String get pollWidgetQuestionMissing => 'Brak pytania.';

Expand Down
15 changes: 15 additions & 0 deletions lib/generated/l10n/zulip_localizations_ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,21 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
@override
String get openLinksWithInAppBrowser => 'Открывать ссылки внутри приложения';

@override
String get languageSettingTitle => 'Language';

@override
String get languageEn => 'English';

@override
String get languagePl => 'Polish';

@override
String get languageRu => 'Russian';

@override
String get languageUk => 'Ukrainian';

@override
String get pollWidgetQuestionMissing => 'Нет вопроса.';

Expand Down
15 changes: 15 additions & 0 deletions lib/generated/l10n/zulip_localizations_sk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,21 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
@override
String get openLinksWithInAppBrowser => 'Open links with in-app browser';

@override
String get languageSettingTitle => 'Language';

@override
String get languageEn => 'English';

@override
String get languagePl => 'Polish';

@override
String get languageRu => 'Russian';

@override
String get languageUk => 'Ukrainian';

@override
String get pollWidgetQuestionMissing => 'Bez otázky.';

Expand Down
15 changes: 15 additions & 0 deletions lib/generated/l10n/zulip_localizations_sl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,21 @@ class ZulipLocalizationsSl extends ZulipLocalizations {
String get openLinksWithInAppBrowser =>
'Odpri povezave v brskalniku znotraj aplikacije';

@override
String get languageSettingTitle => 'Language';

@override
String get languageEn => 'English';

@override
String get languagePl => 'Polish';

@override
String get languageRu => 'Russian';

@override
String get languageUk => 'Ukrainian';

@override
String get pollWidgetQuestionMissing => 'Brez vprašanja.';

Expand Down
15 changes: 15 additions & 0 deletions lib/generated/l10n/zulip_localizations_uk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,21 @@ class ZulipLocalizationsUk extends ZulipLocalizations {
String get openLinksWithInAppBrowser =>
'Відкривати посилання за допомогою браузера додатку';

@override
String get languageSettingTitle => 'Language';

@override
String get languageEn => 'English';

@override
String get languagePl => 'Polish';

@override
String get languageRu => 'Russian';

@override
String get languageUk => 'Ukrainian';

@override
String get pollWidgetQuestionMissing => 'Немає питання.';

Expand Down
15 changes: 15 additions & 0 deletions lib/generated/l10n/zulip_localizations_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,21 @@ class ZulipLocalizationsZh extends ZulipLocalizations {
@override
String get openLinksWithInAppBrowser => 'Open links with in-app browser';

@override
String get languageSettingTitle => 'Language';

@override
String get languageEn => 'English';

@override
String get languagePl => 'Polish';

@override
String get languageRu => 'Russian';

@override
String get languageUk => 'Ukrainian';

@override
String get pollWidgetQuestionMissing => 'No question.';

Expand Down
Loading