Translations are kept as a simple key-value dictionary map.
To add custom translations, create a class and extend `Translations`.
```dart
import'package:get/get.dart';
classMessagesextendsTranslations{
@override
Map<String,Map<String,String>>getkeys=>{
'en_US':{
'hello':'Hello World',
},
'de_DE':{
'hello':'Hallo Welt',
}
};
}
```
#### Using translations
Just append `.tr` to the specified key and it will be translated, using the current value of `Get.locale` and `Get.fallbackLocale`.
```dart
Text('title'.tr);
```
### Locales
Pass parameters to `GetMaterialApp` to define the locale and translations.
```dart
returnGetMaterialApp(
translations:Messages(),// your translations
locale:Locale('en_US'),// translations will be displayed in that locale
fallbackLocale:Locale('en_US'),// specify the fallback locale in case an invalid locale is selected.
supportedLocales:<Locale>[Locale('en_US'),Locale('de_DE')]// specify the supported locales
);
```
#### Change locale
Call `Get.updateLocale(locale)` to update the locale. Translations then automatically use the new locale.
```dart
varlocale=Locale('en_US');
Get.updateLocale(locale);
```
#### System locale
To read the system locale, you could use `Platform.localeName`.
```dart
returnGetMaterialApp(
locale:Locale(Platform.localeName),
);
```
### More details about state management
**See a more in-depth explanation of internationalization [here](./docs/en_US/internationalization.md)**
## Change Theme
Please do not use any higher level widget than GetMaterialApp in order to update it. This can trigger duplicate keys. A lot of people are used to the prehistoric approach of creating a "ThemeProvider" widget just to change the theme of your app, and this is definitely NOT necessary with Get.