2020-09-18 17:36:41 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2020-10-15 18:37:36 +00:00
|
|
|
import 'package:freezer/languages/crowdin.dart';
|
2020-09-18 17:36:41 +00:00
|
|
|
import 'package:freezer/languages/en_us.dart';
|
|
|
|
import 'package:i18n_extension/i18n_extension.dart';
|
|
|
|
|
2021-03-16 19:35:50 +00:00
|
|
|
List<Language> languages = [
|
|
|
|
Language('en', 'US', "English"),
|
|
|
|
Language('ar', 'AR', "Arabic"),
|
|
|
|
Language('pt', 'BR', "Brazil"),
|
|
|
|
Language('it', 'IT', "Italian"),
|
|
|
|
Language('de', 'DE', "German"),
|
|
|
|
Language('ru', 'RU', "Russian"),
|
|
|
|
Language('es', 'ES', "Spanish"),
|
|
|
|
Language('hr', 'HR', "Croatian"),
|
|
|
|
Language('el', 'GR', "Greek"),
|
|
|
|
Language('ko', 'KO', "Korean"),
|
|
|
|
Language('fr', 'FR', "Baguette"),
|
|
|
|
Language('he', 'IL', "Hebrew"),
|
|
|
|
Language('tr', 'TR', "Turkish"),
|
|
|
|
Language('ro', 'RO', "Romanian"),
|
|
|
|
Language('id', 'ID', "Indonesian"),
|
|
|
|
Language('fa', 'IR', "Persian"),
|
|
|
|
Language('pl', 'PL', "Polish"),
|
|
|
|
Language('uk', 'UA', "Ukrainian"),
|
|
|
|
Language('hu', 'HU', "Hungarian"),
|
|
|
|
Language('ur', 'PK', "Urdu"),
|
|
|
|
Language('hi', 'IN', "Hindi"),
|
|
|
|
Language('sk', 'SK', "Slovak"),
|
|
|
|
Language('cs', 'CZ', "Czech"),
|
|
|
|
Language('vi', 'VI', "Vietnamese"),
|
|
|
|
Language('nl', 'NL', "Dutch"),
|
|
|
|
Language('sl', 'SL', "Slovenian"),
|
|
|
|
Language('zh', 'CN', "Chinese"),
|
|
|
|
Language('fil', 'PH', "Filipino"),
|
|
|
|
Language('ast', 'ES', "Asturian"),
|
|
|
|
Language('uwu', 'UWU', "Furry")
|
2020-09-18 17:36:41 +00:00
|
|
|
];
|
2021-03-16 19:35:50 +00:00
|
|
|
List<Locale> get supportedLocales => languages.map((l) => l.getLocale).toList();
|
2020-09-18 17:36:41 +00:00
|
|
|
|
|
|
|
extension Localization on String {
|
2020-10-15 18:37:36 +00:00
|
|
|
static var _t = Translations.byLocale("en_US") + language_en_us + crowdin;
|
2020-09-18 17:36:41 +00:00
|
|
|
|
|
|
|
String get i18n => localize(this, _t);
|
|
|
|
}
|
2021-03-16 19:35:50 +00:00
|
|
|
|
|
|
|
class Language {
|
|
|
|
String name;
|
|
|
|
String locale;
|
|
|
|
String country;
|
|
|
|
Language(this.locale, this.country, this.name);
|
|
|
|
|
|
|
|
Locale get getLocale => Locale(this.locale, this.country);
|
|
|
|
}
|