From 20bdccf1c7b973c049bf6d30e4fd8cc631a82d4b Mon Sep 17 00:00:00 2001 From: Kyle Cummings Date: Fri, 17 Feb 2023 14:59:32 -0500 Subject: [PATCH 1/5] resolve plural should not force fallback value to false --- lib/src/localization.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/localization.dart b/lib/src/localization.dart index dc5fa224..07987ea6 100644 --- a/lib/src/localization.dart +++ b/lib/src/localization.dart @@ -178,7 +178,7 @@ class Localization { if (subKey == 'other') return _resolve('$key.other'); final tag = '$key.$subKey'; - var resource = _resolve(tag, logging: false, fallback: false); + var resource = _resolve(tag, logging: false, fallback: _fallbackTranslations != null); if (resource == tag) { resource = _resolve('$key.other'); } From 54ea1c2db7ce1ddcf2c139e381cbc053b61b212c Mon Sep 17 00:00:00 2001 From: Kyle Cummings Date: Fri, 17 Feb 2023 15:07:57 -0500 Subject: [PATCH 2/5] revert just for sanity check --- lib/src/localization.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/localization.dart b/lib/src/localization.dart index 07987ea6..dc5fa224 100644 --- a/lib/src/localization.dart +++ b/lib/src/localization.dart @@ -178,7 +178,7 @@ class Localization { if (subKey == 'other') return _resolve('$key.other'); final tag = '$key.$subKey'; - var resource = _resolve(tag, logging: false, fallback: _fallbackTranslations != null); + var resource = _resolve(tag, logging: false, fallback: false); if (resource == tag) { resource = _resolve('$key.other'); } From 2557e2c02b2aab42108393c9a1d0fb9f9ba84c48 Mon Sep 17 00:00:00 2001 From: Kyle Cummings Date: Fri, 17 Feb 2023 15:16:48 -0500 Subject: [PATCH 3/5] _resolvePlural _resolve fallback value should consider if _fallbackTranslations is null or not --- lib/src/localization.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/localization.dart b/lib/src/localization.dart index dc5fa224..07987ea6 100644 --- a/lib/src/localization.dart +++ b/lib/src/localization.dart @@ -178,7 +178,7 @@ class Localization { if (subKey == 'other') return _resolve('$key.other'); final tag = '$key.$subKey'; - var resource = _resolve(tag, logging: false, fallback: false); + var resource = _resolve(tag, logging: false, fallback: _fallbackTranslations != null); if (resource == tag) { resource = _resolve('$key.other'); } From 82c1a1b039fd00e18ab6b8bc9ace86e7b4064de7 Mon Sep 17 00:00:00 2001 From: Kyle Cummings Date: Mon, 5 Jun 2023 12:22:00 -0400 Subject: [PATCH 4/5] update intl version for compatibility --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index b3f13dce..a4a7d2c6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,7 +14,7 @@ dependencies: flutter: sdk: flutter shared_preferences: '>=2.0.0 <3.0.0' - intl: '>=0.17.0-0 <=0.17.0' + intl: '>=0.18.0-0 <=0.19.0' args: ^2.3.1 path: ^1.8.1 easy_logger: ^0.0.2 From 1620a74f1196f7389bbb2e5145d3b7dc3c59a097 Mon Sep 17 00:00:00 2001 From: Kyle Cummings Date: Tue, 5 Sep 2023 14:54:08 -0400 Subject: [PATCH 5/5] - revert intl versions in pubspec.yaml - update test case for plural with fallback priority --- pubspec.yaml | 2 +- test/easy_localization_test.dart | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index ea8a1b60..08359f1b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,7 +14,7 @@ dependencies: flutter: sdk: flutter shared_preferences: '>=2.0.0 <3.0.0' - intl: '>=0.18.0-0 <=0.19.0' + intl: '>=0.17.0-0 <=0.18.1' args: ^2.3.1 path: ^1.8.1 easy_logger: ^0.0.2 diff --git a/test/easy_localization_test.dart b/test/easy_localization_test.dart index bfb01c6b..d5177d5b 100644 --- a/test/easy_localization_test.dart +++ b/test/easy_localization_test.dart @@ -469,12 +469,12 @@ void main() { expect(Localization.instance.plural('hat_other', 1), 'other hats'); }); - test('other as fallback and fallback translations priority', + test('two as fallback and fallback translations priority', overridePrint(() { printLog = []; expect( Localization.instance.plural('test_fallback_plurals', 2), - '2 seconds', // isNot('fallback two'), + 'fallback two', ); expect(printLog, isEmpty); }));