Fix Portuguese locale
This commit is contained in:
@@ -13,6 +13,7 @@ extension AppLocaleX on AppLocale {
|
|||||||
"zh_TW" => "中文 (台湾)",
|
"zh_TW" => "中文 (台湾)",
|
||||||
"tr" => "Türkçe",
|
"tr" => "Türkçe",
|
||||||
"es" => "Spanish",
|
"es" => "Spanish",
|
||||||
|
"pt_BR" => "Portuguese (Brazil)",
|
||||||
_ => "Unknown",
|
_ => "Unknown",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import 'package:hiddify/core/preferences/preferences_provider.dart';
|
import 'package:hiddify/core/preferences/preferences_provider.dart';
|
||||||
import 'package:hiddify/gen/translations.g.dart';
|
import 'package:hiddify/gen/translations.g.dart';
|
||||||
|
import 'package:hiddify/utils/custom_loggers.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
part 'locale_preferences.g.dart';
|
part 'locale_preferences.g.dart';
|
||||||
|
|
||||||
@Riverpod(keepAlive: true)
|
@Riverpod(keepAlive: true)
|
||||||
class LocalePreferences extends _$LocalePreferences {
|
class LocalePreferences extends _$LocalePreferences with AppLogger {
|
||||||
@override
|
@override
|
||||||
AppLocale build() {
|
AppLocale build() {
|
||||||
final persisted =
|
final persisted =
|
||||||
@@ -15,7 +16,12 @@ class LocalePreferences extends _$LocalePreferences {
|
|||||||
if (persisted == "zh") {
|
if (persisted == "zh") {
|
||||||
return AppLocale.zhCn;
|
return AppLocale.zhCn;
|
||||||
}
|
}
|
||||||
return AppLocale.values.byName(persisted);
|
try {
|
||||||
|
return AppLocale.values.byName(persisted);
|
||||||
|
} catch (e) {
|
||||||
|
loggy.error("error setting locale: [$persisted]", e);
|
||||||
|
return AppLocale.en;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> changeLocale(AppLocale value) async {
|
Future<void> changeLocale(AppLocale value) async {
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
"ru",
|
"ru",
|
||||||
"tr",
|
"tr",
|
||||||
"zh-CN",
|
"zh-CN",
|
||||||
"zh-TW"
|
"zh-TW",
|
||||||
|
"pt-BR"
|
||||||
],
|
],
|
||||||
"modules": [
|
"modules": [
|
||||||
"https://cdn.jsdelivr.net/npm/@inlang/plugin-i18next@4/dist/index.js",
|
"https://cdn.jsdelivr.net/npm/@inlang/plugin-i18next@4/dist/index.js",
|
||||||
|
|||||||
Reference in New Issue
Block a user