Skip to content

Commit

Permalink
Fixed local range issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
jigar-f committed Nov 8, 2023
1 parent 960fb3e commit c1450b5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class LanternApp extends StatelessWidget {
void toggleConnectivityWarningIfNecessary() {
final shouldShowConnectivityWarning =
!sessionModel.networkAvailable.value ||
(sessionModel.proxyAvailable.value!=null && sessionModel.proxyAvailable.value==false);
(sessionModel.proxyAvailable.value != null &&
sessionModel.proxyAvailable.value == false);
if (shouldShowConnectivityWarning != showConnectivityWarning) {
showConnectivityWarning = shouldShowConnectivityWarning;
if (showConnectivityWarning) {
Expand Down Expand Up @@ -138,7 +139,13 @@ class LanternApp extends StatelessWidget {
return const Locale('en', 'US');
}
final codes = lang.split('_');
return Locale(codes[0], codes[1]);
// Check if the split code has more than one part
if (codes.length > 1) {
return Locale(codes[0], codes[1]);
} else {
// If not, return default locale
return const Locale('en', 'US');
}
}

String _getLocaleBasedFont(Locale locale) {
Expand Down

0 comments on commit c1450b5

Please sign in to comment.