Skip to content

Commit

Permalink
Improve the initial behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
lamnhan066 committed Aug 25, 2023
1 parent b750deb commit c055052
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/src/language_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@ class LanguageHelper {
if (finalCode == null) {
// Try to set by the default code from device
final currentCode = LanguageCode.code;
if (data.containsKey(currentCode)) {
if (codesBoth.contains(currentCode)) {
finalCode = currentCode;
printDebug('Set current language code to $finalCode by device locale');
} else if (data.isNotEmpty) {
finalCode = data.keys.first;
} else if (codes.isNotEmpty) {
finalCode = codes.first;
printDebug('Set current language code to $finalCode');
}
} else {
Expand All @@ -242,8 +242,8 @@ class LanguageHelper {

if (!codesBoth.contains(finalCode)) {
printDebug(
'language does not contain the $finalCode => Change the code to ${data.keys.first}');
finalCode = data.keys.first;
'language does not contain the $finalCode => Change the code to ${codes.first}');
finalCode = codes.first;
}

printDebug('Set currentCode to $finalCode');
Expand Down

0 comments on commit c055052

Please sign in to comment.