mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 12:09:43 +00:00
27 lines
753 B
Dart
27 lines
753 B
Dart
|
import 'package:devicelocale/devicelocale.dart';
|
||
|
import 'package:intl/intl.dart';
|
||
|
|
||
|
class LanguageService {
|
||
|
static const Map<String, String> list = {
|
||
|
'en': 'English',
|
||
|
'de': 'Deutsch (German)',
|
||
|
'es': 'Español (Spanish)',
|
||
|
'hi': 'हिंदी (Hindi)',
|
||
|
'ja': '日本 (Japanese)',
|
||
|
'ko': '한국어 (Korean)',
|
||
|
'nl': 'Nederlands (Dutch)',
|
||
|
'pl': 'Polski (Polish)',
|
||
|
'pt': 'Português (Portuguese)',
|
||
|
'ru': 'Русский (Russian)',
|
||
|
'uk': 'Українська (Ukrainian)',
|
||
|
'zh': '中文 (Chinese)'
|
||
|
};
|
||
|
|
||
|
static Future<String> localeDetection() async {
|
||
|
var locale = await Devicelocale.currentLocale;
|
||
|
locale = Intl.shortLocale(locale);
|
||
|
|
||
|
return list.keys.contains(locale) ? locale : 'en';
|
||
|
}
|
||
|
}
|