lemmur-app-android/lib/l10n/l10n.dart

62 lines
1.4 KiB
Dart
Raw Normal View History

2021-02-27 17:02:55 +01:00
import 'package:flutter/material.dart';
2021-02-27 14:39:58 +01:00
export 'package:flutter_gen/gen_l10n/l10n.dart';
2021-03-01 09:44:37 +01:00
2021-03-09 08:51:08 +01:00
export 'l10n_api.dart';
2021-03-01 00:02:32 +01:00
export 'l10n_from_string.dart';
2021-02-27 17:02:55 +01:00
abstract class LocaleSerde {
static Locale fromJson(String json) {
if (json == null) return null;
final lang = json.split('-');
return Locale(lang[0], lang.length > 1 ? lang[1] : null);
}
static String toJson(Locale locale) => locale.toLanguageTag();
}
2021-03-04 09:46:08 +01:00
const _languageNames = {
'ca': 'Català',
'ar': 'عربي',
'en': 'English',
'el': 'Ελληνικά',
'eu': 'Euskara',
'eo': 'Esperanto',
'es': 'Español',
'da': 'Dansk',
'de': 'Deutsch',
'ga': 'Gaeilge',
'gl': 'Galego',
'hr': 'hrvatski',
'hu': 'Magyar Nyelv',
'ka': 'ქართული ენა',
'ko': '한국어',
'km': 'ភាសាខ្មែរ',
'hi': 'मानक हिन्दी',
'fa': 'فارسی',
'ja': '日本語',
'oc': 'Occitan',
'pl': 'Polski',
'pt': 'Português',
'pt_BR': 'Português Brasileiro',
'zh': '中文',
'fi': 'Suomi',
'fr': 'Français',
'sv': 'Svenska',
'sq': 'Shqip',
'sr_Latn': 'srpski',
'th': 'ภาษาไทย',
'tr': 'Türkçe',
'uk': 'Українська Mова',
'ru': 'Русский',
'nl': 'Nederlands',
'it': 'Italiano',
};
extension LanguageName on Locale {
/// returns the name of the language in the given language
String get languageName => _languageNames[toString()] ?? toString();
}