**Более подробное объяснение управления зависимостями [здесь](./documentation/ru_RU/dependency_management.md)**
# Utils
# Утилиты
## Internationalization
## Интернационализация
### Translations
### Переводы
Translations are kept as a simple key-value dictionary map.
To add custom translations, create a class and extend `Translations`.
Переводы хранятся в виде карты пар "ключ-значение". Чтобы добавить собственные переводы, создайте класс и расширьте `Translations`.
```dart
import'package:get/get.dart';
...
...
@@ -316,17 +315,17 @@ class Messages extends Translations {
}
```
#### Using translations
#### Использование переводов
Just append `.tr` to the specified key and it will be translated, using the current value of `Get.locale` and `Get.fallbackLocale`.
Просто добавьте `.tr` к указанному ключу, и он будет переведен с использованием текущего значения `Get.locale` и `Get.fallbackLocale`.
```dart
Text('title'.tr);
```
### Locales
### Локации
Pass parameters to `GetMaterialApp` to define the locale and translations.
Передайте параметры в `GetMaterialApp`, чтобы определить языковой стандарт и переводы.
```dart
returnGetMaterialApp(
...
...
@@ -336,18 +335,18 @@ return GetMaterialApp(
);
```
#### Change locale
#### Изменение локации
Call `Get.updateLocale(locale)` to update the locale. Translations then automatically use the new locale.
Вызовите `Get.updateLocale(locale)`, чтобы обновить локацию. Затем переводы автоматически используют новый языковой стандарт.
```dart
varlocale=Locale('en','US');
Get.updateLocale(locale);
```
#### System locale
#### Системная локация
To read the system locale, you could use`window.locale`.
Чтобы узнать системную локацию, вам следует использовать`window.locale`.
```dart
import'dart:ui'asui;
...
...
@@ -357,28 +356,30 @@ return GetMaterialApp(
);
```
## 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 **GetX™**.
Пожалуйста, не используйте виджет более высокого уровня, чем `GetMaterialApp`, для его обновления. Это может вызвать повторяющиеся ключи. Многие люди привыкли к старому подходу к созданию виджета «ThemeProvider» только для того, чтобы изменить тему вашего приложения, а это НЕ требуется с GetX ™.
You can create your custom theme and simply add it within `Get.changeTheme` without any boilerplate for that:
Вы можете создать свою собственную тему и просто добавить ее в `Get.changeTheme` без повторяющегося кода:
```dart
Get.changeTheme(ThemeData.light());
```
If you want to create something like a button that changes the Theme in `onTap`, you can combine two **GetX™** APIs for that:
Если вы хотите создать что-то вроде кнопки, которая изменяет тему, вы можете объединить для этого два API **GetX ™**:
- The api that checks if the dark `Theme` is being used.
- And the `Theme` Change API, you can just put this within an `onPressed`:
- API, который проверяет, используется ли темная тема.