Skip to content

Commit

Permalink
Tagline: support for countries only locales: (eg _FR) (#5370)
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k authored Jun 18, 2024
1 parent 8a415f8 commit 229ea66
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/smooth_app/lib/data_models/news_feed/newsfeed_json.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,13 @@ class _TagLineItemNewsItem {
if (_translations.containsKey(locale)) {
translation = _translations[locale];
} else if (locale.contains('_')) {
final String languageCode = locale.split('_').first;
final List<String> splittedLocale = locale.split('_');
final String languageCode = splittedLocale.first;
final String countryCode = '_${splittedLocale.last}';
if (_translations.containsKey(languageCode)) {
translation = _translations[languageCode];
} else if (_translations.containsKey(countryCode)) {
translation = _translations[countryCode];
}
}

Expand Down Expand Up @@ -335,9 +339,13 @@ class _TaglineJSONFeed {

// Try by language
if (locale.contains('_')) {
final String languageCode = locale.split('_').first;
final List<String> splittedLocale = locale.split('_');
final String languageCode = splittedLocale.first;
final String countryCode = '_${splittedLocale.last}';
if (_news.containsKey(languageCode)) {
return _news[languageCode]!;
} else if (_news.containsKey(countryCode)) {
return _news[countryCode]!;
}
}

Expand Down

0 comments on commit 229ea66

Please sign in to comment.