From 475357620db4c56d967a5437956d3d8bdf69fcb4 Mon Sep 17 00:00:00 2001 From: problematicconsumer Date: Thu, 7 Sep 2023 14:20:31 +0330 Subject: [PATCH] Fix translation code gen --- .github/workflows/ci.yml | 2 +- lib/core/prefs/locale_prefs.dart | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 352fa829..744a38c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,8 +120,8 @@ jobs: - name: Generate run: | - make gen make translate + make gen - name: Get Libs ${{ matrix.platform }} run: | diff --git a/lib/core/prefs/locale_prefs.dart b/lib/core/prefs/locale_prefs.dart index 039ce5d6..24a697d3 100644 --- a/lib/core/prefs/locale_prefs.dart +++ b/lib/core/prefs/locale_prefs.dart @@ -10,8 +10,13 @@ part 'locale_prefs.g.dart'; @Riverpod(keepAlive: true) class LocaleNotifier extends _$LocaleNotifier { - late final _pref = - Pref(ref.watch(sharedPreferencesProvider), "locale", AppLocale.en); + late final _pref = Pref( + ref.watch(sharedPreferencesProvider), + "locale", + AppLocale.en, + mapFrom: AppLocale.values.byName, + mapTo: (value) => value.name, + ); @override AppLocale build() => _pref.getValue();