Skip to content

Commit

Permalink
Tagline: support for countries only locales: (eg _FR)
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k committed Jun 13, 2024
1 parent f5973da commit 2464960
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/smooth_app/lib/data_models/tagline/tagline_json.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,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 @@ -336,9 +340,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 2464960

Please sign in to comment.