fix(i18n): 去掉印尼语内容完整性过滤,缺失时回退中文
This commit is contained in:
1 parent
c307903c42
commit
3bc79ad8e2
12 files changed
+17
-123
No files matched your search
@@ -241,11 +241,11 @@ class Drama {
|
||||
}
|
||||
|
||||
String localizedTitle(String languageCode) {
|
||||
return localizedRequiredText(languageCode, title, titleLocales);
|
||||
return localizedText(languageCode, title, titleLocales);
|
||||
}
|
||||
|
||||
String localizedSynopsis(String languageCode) {
|
||||
return localizedRequiredText(languageCode, synopsis, synopsisLocales);
|
||||
return localizedText(languageCode, synopsis, synopsisLocales);
|
||||
}
|
||||
|
||||
String localizedTag(String languageCode) {
|
||||
|
||||
@@ -18,16 +18,3 @@ String localizedText(
|
||||
if (chinese.isNotEmpty) return chinese;
|
||||
return fallback;
|
||||
}
|
||||
|
||||
/// 按当前语言取必须本地化的文案;印尼语缺失时不回退中文。
|
||||
String localizedRequiredText(
|
||||
String languageCode,
|
||||
String fallback,
|
||||
Map<String, String> locales,
|
||||
) {
|
||||
final primaryCode = languageCode.split(RegExp(r'[_-]')).first;
|
||||
final selected = locales[languageCode] ?? locales[primaryCode] ?? '';
|
||||
if (selected.trim().isNotEmpty) return selected;
|
||||
if (primaryCode == 'id') return '';
|
||||
return localizedText(primaryCode, fallback, locales);
|
||||
}
|
||||
Reference in new issue
Block a user