INFRA: Set Up Project.
This commit is contained in:
20
lib/service/localization_service.dart
Normal file
20
lib/service/localization_service.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../lang/app_en.dart';
|
||||
|
||||
class LocalizationService extends Translations {
|
||||
// Default locale
|
||||
static const locale = Locale('en', 'US');
|
||||
|
||||
static final locales = [const Locale('en')];
|
||||
|
||||
// Keys and their translations
|
||||
// Translations are separated maps in `lang` file
|
||||
@override
|
||||
Map<String, Map<String, String>> get keys => {'en_US': enUS};
|
||||
|
||||
// Gets locale from language, and updates the locale
|
||||
void changeLocale(String lang) {
|
||||
Get.updateLocale(Locale(lang));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user