Skip to content

Add zh, zh-Hans-CN, and zh-Hant-TW #1520

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

Merged
merged 1 commit into from
May 29, 2025
Merged
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
1 change: 1 addition & 0 deletions assets/l10n/app_zh.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions assets/l10n/app_zh_Hans_CN.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"settingsPageTitle": "设置"
}
3 changes: 3 additions & 0 deletions assets/l10n/app_zh_Hant_TW.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"settingsPageTitle": "設定"
}
23 changes: 23 additions & 0 deletions lib/generated/l10n/zulip_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'zulip_localizations_pl.dart';
import 'zulip_localizations_ru.dart';
import 'zulip_localizations_sk.dart';
import 'zulip_localizations_uk.dart';
import 'zulip_localizations_zh.dart';

// ignore_for_file: type=lint

Expand Down Expand Up @@ -111,6 +112,17 @@ abstract class ZulipLocalizations {
Locale('ru'),
Locale('sk'),
Locale('uk'),
Locale('zh'),
Locale.fromSubtags(
languageCode: 'zh',
countryCode: 'CN',
scriptCode: 'Hans',
),
Locale.fromSubtags(
languageCode: 'zh',
countryCode: 'TW',
scriptCode: 'Hant',
),
];

/// Title for About Zulip page.
Expand Down Expand Up @@ -1432,13 +1444,22 @@ class _ZulipLocalizationsDelegate
'ru',
'sk',
'uk',
'zh',
].contains(locale.languageCode);

@override
bool shouldReload(_ZulipLocalizationsDelegate old) => false;
}

ZulipLocalizations lookupZulipLocalizations(Locale locale) {
// Lookup logic when language+script+country codes are specified.
switch (locale.toString()) {
case 'zh_Hans_CN':
return ZulipLocalizationsZhHansCn();
case 'zh_Hant_TW':
return ZulipLocalizationsZhHantTw();
}

// Lookup logic when language+country codes are specified.
switch (locale.languageCode) {
case 'en':
Expand Down Expand Up @@ -1471,6 +1492,8 @@ ZulipLocalizations lookupZulipLocalizations(Locale locale) {
return ZulipLocalizationsSk();
case 'uk':
return ZulipLocalizationsUk();
case 'zh':
return ZulipLocalizationsZh();
}

throw FlutterError(
Expand Down
Loading