Skip to content

Commit 47d2955

Browse files
feat(localization): add Chinese (zh) language support
Clean-branch integration of community PR #300 (ADAIBLOG) against current develop. Adds all 423 translation keys, resolves the 15 keys missing from the original PR (13 QR/share-meal keys + 2 American football PA keys), and wires up all integration points. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e4cb5ec commit 47d2955

8 files changed

Lines changed: 1053 additions & 1 deletion

File tree

lib/core/utils/supported_language.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
enum SupportedLanguage {
22
en,
33
pl,
4-
de;
4+
de,
5+
zh;
56

67
factory SupportedLanguage.fromCode(String localeCode) {
78
final languageCode = localeCode.split('_').first;
@@ -12,6 +13,8 @@ enum SupportedLanguage {
1213
return SupportedLanguage.de;
1314
case 'pl':
1415
return SupportedLanguage.pl;
16+
case 'zh':
17+
return SupportedLanguage.zh;
1518
default:
1619
return SupportedLanguage.en;
1720
}

lib/features/add_meal/data/dto/fdc_sp/sp_const.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class SPConst {
2828
return fdcFoodDescriptionDe;
2929
case SupportedLanguage.pl:
3030
return fdcFoodDescriptionEn;
31+
case SupportedLanguage.zh:
32+
return fdcFoodDescriptionEn;
3133
}
3234
}
3335
}

lib/features/add_meal/data/dto/fdc_sp/sp_fdc_food_dto.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class SpFdcFoodDTO {
3131
return descriptionDe;
3232
case SupportedLanguage.pl:
3333
return descriptionEn;
34+
case SupportedLanguage.zh:
35+
return descriptionEn;
3436
}
3537
}
3638

lib/features/add_meal/data/dto/off/off_product_dto.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ class OFFProductDTO {
4343
case SupportedLanguage.pl:
4444
localeName = product_name;
4545
break;
46+
case SupportedLanguage.zh:
47+
localeName = product_name;
48+
break;
4649
}
4750

4851
// If local language is not available, return available language

lib/generated/intl/messages_all.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import 'messages_it.dart' as messages_it;
2323
import 'messages_pl.dart' as messages_pl;
2424
import 'messages_tr.dart' as messages_tr;
2525
import 'messages_uk.dart' as messages_uk;
26+
import 'messages_zh.dart' as messages_zh;
2627

2728
typedef Future<dynamic> LibraryLoader();
2829
Map<String, LibraryLoader> _deferredLibraries = {
@@ -33,6 +34,7 @@ Map<String, LibraryLoader> _deferredLibraries = {
3334
'pl': () => new SynchronousFuture(null),
3435
'tr': () => new SynchronousFuture(null),
3536
'uk': () => new SynchronousFuture(null),
37+
'zh': () => new SynchronousFuture(null),
3638
};
3739

3840
MessageLookupByLibrary? _findExact(String localeName) {
@@ -51,6 +53,8 @@ MessageLookupByLibrary? _findExact(String localeName) {
5153
return messages_tr.messages;
5254
case 'uk':
5355
return messages_uk.messages;
56+
case 'zh':
57+
return messages_zh.messages;
5458
default:
5559
return null;
5660
}

lib/generated/intl/messages_zh.dart

Lines changed: 590 additions & 0 deletions
Large diffs are not rendered by default.

lib/generated/l10n.dart

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)