Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow _resolvePlural to search _fallbackTranslation values when trying to resolve a plural key #559

Merged
merged 7 commits into from
Sep 5, 2023
2 changes: 1 addition & 1 deletion lib/src/localization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
bw-flagship marked this conversation as resolved.
Show resolved Hide resolved
if (resource == tag) {
resource = _resolve('$key.other');
}
Expand Down
4 changes: 2 additions & 2 deletions test/easy_localization_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}));
Expand Down
Loading