Skip to content

Commit

Permalink
SimpleTranslator submap refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ilteoood committed Jul 15, 2020
1 parent baba5e2 commit 5782875
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,4 @@ Removed cache parameter from loadString method, resolve [issue/116](https://gith
## [0.17.0]

RTL support.
Test fix for [issue/115](https://github.com/ilteoood/flutter_i18n/issues/115)
6 changes: 2 additions & 4 deletions lib/utils/simple_translator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ class SimpleTranslator {
translationKey.split(KEY_SEPARATOR);
translationKeySplitted.removeLast();
Map<dynamic, dynamic> decodedSubMap = decodedMap;
translationKeySplitted.forEach((listKey) => decodedSubMap =
decodedSubMap != null && decodedSubMap[listKey] != null
? decodedSubMap[listKey]
: Map());
translationKeySplitted.forEach((listKey) =>
decodedSubMap = (decodedSubMap ?? Map())[listKey] ?? Map());
return decodedSubMap;
}
}

0 comments on commit 5782875

Please sign in to comment.