Showing
3 changed files
with
10 additions
and
60 deletions
| 1 | ## [3.7.0] | 1 | ## [3.7.0] |
| 2 | - Added: RxSet. Sets can now also be reactive. | 2 | - Added: RxSet. Sets can now also be reactive. |
| 3 | +- Added isDesktop/isMobile (@roipeker) | ||
| 3 | - Improve GetPlatform: It is now possible to know which device the user is using if GetPlatform.isWeb is true. | 4 | - Improve GetPlatform: It is now possible to know which device the user is using if GetPlatform.isWeb is true. |
| 4 | -context.responsiveValue used device orientation based on web and non-web applications. Now it checks if it is a desktop application (web or desktop application) to do the responsiveness calculation. | 5 | +context.responsiveValue used device orientation based on web and non-web applications. Now it checks if it is a desktop application (web or desktop application) to do the responsiveness calculation. (@roipeker) |
| 5 | - Change: The documentation previously stated that Iterables should not access the ".value" property. | 6 | - Change: The documentation previously stated that Iterables should not access the ".value" property. |
| 6 | However, many users did not pay attention to this fact, and ended up generating unnecessary issues and bugs in their application. | 7 | However, many users did not pay attention to this fact, and ended up generating unnecessary issues and bugs in their application. |
| 7 | In this version, we focus on code security. Now ".value" is protected, so it cannot be accessed externally by Lists, Maps or Sets. | 8 | In this version, we focus on code security. Now ".value" is protected, so it cannot be accessed externally by Lists, Maps or Sets. |
| @@ -329,29 +329,29 @@ Pass parameters to `GetMaterialApp` to define the locale and translations. | @@ -329,29 +329,29 @@ Pass parameters to `GetMaterialApp` to define the locale and translations. | ||
| 329 | ```dart | 329 | ```dart |
| 330 | return GetMaterialApp( | 330 | return GetMaterialApp( |
| 331 | translations: Messages(), // your translations | 331 | translations: Messages(), // your translations |
| 332 | - locale: Locale('en_US'), // translations will be displayed in that locale | ||
| 333 | - fallbackLocale: Locale('en_US'), // specify the fallback locale in case an invalid locale is selected. | ||
| 334 | - supportedLocales: <Locale>[Locale('en_US'), Locale('de_DE')] // specify the supported locales | 332 | + locale: Locale('en', 'US'), // translations will be displayed in that locale |
| 333 | + fallbackLocale: Locale('en', 'UK'), // specify the fallback locale in case an invalid locale is selected. | ||
| 334 | + supportedLocales: <Locale>[Locale('en', 'UK'), Locale('en', 'US'), Locale('de','DE')] // specify the supported locales | ||
| 335 | ); | 335 | ); |
| 336 | ``` | 336 | ``` |
| 337 | 337 | ||
| 338 | #### Change locale | 338 | #### Change locale |
| 339 | Call `Get.updateLocale(locale)` to update the locale. Translations then automatically use the new locale. | 339 | Call `Get.updateLocale(locale)` to update the locale. Translations then automatically use the new locale. |
| 340 | ```dart | 340 | ```dart |
| 341 | -var locale = Locale('en_US'); | 341 | +var locale = Locale('en', 'US'); |
| 342 | Get.updateLocale(locale); | 342 | Get.updateLocale(locale); |
| 343 | ``` | 343 | ``` |
| 344 | 344 | ||
| 345 | #### System locale | 345 | #### System locale |
| 346 | -To read the system locale, you could use `Platform.localeName`. | 346 | +To read the system locale, you could use `window.locale`. |
| 347 | ```dart | 347 | ```dart |
| 348 | +import 'dart:ui' as ui; | ||
| 349 | + | ||
| 348 | return GetMaterialApp( | 350 | return GetMaterialApp( |
| 349 | - locale: Locale(Platform.localeName), | 351 | + locale: ui.window.locale, |
| 350 | ); | 352 | ); |
| 351 | ``` | 353 | ``` |
| 352 | 354 | ||
| 353 | -### More details about internationalization | ||
| 354 | -**See a more in-depth explanation of internationalization [here](./docs/en_US/internationalization.md)** | ||
| 355 | ## Change Theme | 355 | ## Change Theme |
| 356 | 356 | ||
| 357 | 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. | 357 | 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. |
docs/en_US/internationalization.md
deleted
100644 → 0
| 1 | -## Translations | ||
| 2 | -Translations are kept as a simple key-value dictionary map. | ||
| 3 | -To add custom translations, create a class and extend `Translations`. | ||
| 4 | -```dart | ||
| 5 | -import 'package:get/get.dart'; | ||
| 6 | - | ||
| 7 | -class Messages extends Translations { | ||
| 8 | - @override | ||
| 9 | - Map<String, Map<String, String>> get keys => { | ||
| 10 | - 'en_US': { | ||
| 11 | - 'hello': 'Hello World', | ||
| 12 | - }, | ||
| 13 | - 'de_DE': { | ||
| 14 | - 'hello': 'Hallo Welt', | ||
| 15 | - } | ||
| 16 | - }; | ||
| 17 | -} | ||
| 18 | -``` | ||
| 19 | - | ||
| 20 | -### Using translations | ||
| 21 | -Just append `.tr` to the specified key and it will be translated, using the current value of `Get.locale` and `Get.fallbackLocale`. | ||
| 22 | -```dart | ||
| 23 | -Text('title'.tr); | ||
| 24 | -``` | ||
| 25 | - | ||
| 26 | -## Locales | ||
| 27 | -Pass parameters to `GetMaterialApp` to define the locale and translations. | ||
| 28 | - | ||
| 29 | -```dart | ||
| 30 | -return GetMaterialApp( | ||
| 31 | - translations: Messages(), // your translations | ||
| 32 | - locale: Locale('en_US'), // translations will be displayed in that locale | ||
| 33 | - fallbackLocale: Locale('en_US'), // specify the fallback locale in case an invalid locale is selected. | ||
| 34 | - supportedLocales: <Locale>[Locale('en_US'), Locale('de_DE')] // specify the supported locales | ||
| 35 | -); | ||
| 36 | -``` | ||
| 37 | - | ||
| 38 | -### Change locale | ||
| 39 | -Call `Get.updateLocale(locale)` to update the locale. Translations then automatically use the new locale. | ||
| 40 | -```dart | ||
| 41 | -var locale = Locale('en_US'); | ||
| 42 | -Get.updateLocale(locale); | ||
| 43 | -``` | ||
| 44 | - | ||
| 45 | -### System locale | ||
| 46 | -To read the system locale, you could use `Platform.localeName`. | ||
| 47 | -```dart | ||
| 48 | -return GetMaterialApp( | ||
| 49 | - locale: Locale(Platform.localeName), | ||
| 50 | -); | ||
| 51 | -``` |
-
Please register or login to post a comment