mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 23:40:41 +00:00
32 lines
714 B
Dart
32 lines
714 B
Dart
import 'package:intl/intl.dart';
|
|
|
|
enum SupportedLocale { en, fr, ru }
|
|
|
|
SupportedLocale get currentLanguage {
|
|
switch (Intl.getCurrentLocale()) {
|
|
case "en":
|
|
return SupportedLocale.en;
|
|
case "fr":
|
|
return SupportedLocale.fr;
|
|
case "ru":
|
|
return SupportedLocale.ru;
|
|
default:
|
|
return SupportedLocale.en;
|
|
}
|
|
}
|
|
|
|
extension SupportedLocaleExtension on SupportedLocale {
|
|
String get intlName => toString().replaceAll("SupportedLocale.", "");
|
|
|
|
String get localizedName {
|
|
switch (this) {
|
|
case SupportedLocale.en:
|
|
return 'English';
|
|
case SupportedLocale.fr:
|
|
return 'Français';
|
|
case SupportedLocale.ru:
|
|
return 'Русский';
|
|
}
|
|
}
|
|
}
|
|
|