当前位置:网站首页>Flutter internationalized Intl
Flutter internationalized Intl
2022-07-03 22:25:00 【nicepainkiller】
Intl It's official , Include for handling internationalization / Localized messages , Date and number format and parsing , Two way text and other international issues .
- pub Address :intl | Dart Package
- Github Address :https://github.com/dart-lang/intl
There was a better one before Android Studio Plug in for :Flutter i18n
- But this plug-in has been out of maintenance for a long time , So it is no longer recommended for everyone
At present, we can use another plug-in :Flutter Intl
- The plug-in is updated and maintained frequently , And widely praised ;
- in addition , stay Android Studio and VSCode Both of them support
Intl Use
step 1:Android Studio Add the plug-in

step 2: Add dependency flutter_localizations
In the project pubspec.yaml In file Used to generate dart file dev_dependencies: flutter_localizations: sdk: flutter

Note that :dev_dependencies:
And then update it !
step 3:Flutter Intl Initialize project ( for the first time )

After success , Automatically in pubspec.yaml At the end of the increase
flutter_intl:
enabled: trueAnd in lib Lower generation generated and l10n
The document states :
- generated Under bag intl Directory default generation messages_all.dart and messages_en.dart file ,messages The first file does not need to be modified manually , It's generated automatically
- generated Under bag I10n.dart yes Localizations and Delegate The implementation of the , No need to modify it manually , It's generated automatically
- l10n There is a intl_en.arb file , This is the English international language content generated by the system by default
step 4: Add language ( chinese -zh)
zh Is the support of Chinese ; Should be default lntl Only joined en Support for

step 5: Add system internationalization support
pubspec.yaml Add package dependency... To the file
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
MaterialApp modify :
MaterialApp( ... localizationsDelegates: [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: S.delegate.supportedLocales, ... )edit l10n Under folder .arb file according to json:
{ "app_name": "GBM", "confirm": " confirm ", "cancel": " Cancel " }.arb The file also supports Parameter passing
{ "app_name": "GBM", "confirm": " confirm ", "cancel": " Cancel ", "msg": "GBM:{msg}" }S.of(context).app_name S.of(context).msg(" Hello everyone ")
No, context When using this :S.current.app_name
There is a problem .arb: It doesn't seem to support object ( Cannot nest ); Can only key value:


In this case, there will be more configurations , Then maintain it It's sour !
I don't know Is there a good plan ? For recommendation
边栏推荐
- webAssembly
- Cognitive fallacy: Wittgenstein's ruler
- Pan Yueming helps Germany's Rochester Zodiac custom wristwatch
- LeetCode 1647. Minimum deletion times of unique character frequency
- Analysis report on the development trend and Prospect of global and Chinese supercontinuum laser source industry Ⓚ 2022 ~ 2027
- 油猴插件
- js demo 计算本年度还剩下多少天
- Cesium terrain clipping draw polygon clipping
- Team collaborative combat penetration tool CS artifact cobalt strike
- Take you to master the formatter of visual studio code
猜你喜欢

Can you draw with turtle?

Electronic tube: Literature Research on basic characteristics of 6j1

2022 free examination questions for safety management personnel of hazardous chemical business units and reexamination examination for safety management personnel of hazardous chemical business units
![[golang] leetcode intermediate - alphabetic combination of island number and phone number](/img/40/a664ea866ce355c1f5e9305fe91780.jpg)
[golang] leetcode intermediate - alphabetic combination of island number and phone number
![[Android reverse] use the DB browser to view and modify the SQLite database (copy the database file from the Android application data directory | use the DB browser tool to view the data block file)](/img/6e/3ffa91154a718b6ace6c8ca87c5995.jpg)
[Android reverse] use the DB browser to view and modify the SQLite database (copy the database file from the Android application data directory | use the DB browser tool to view the data block file)

Cesium terrain clipping draw polygon clipping

Kali2021.4a build PWN environment
![[automation operation and maintenance novice village] flask-2 certification](/img/9a/a9b45e1f41b9b75695dcb06c212a69.jpg)
[automation operation and maintenance novice village] flask-2 certification

How to solve win10 black screen with only mouse arrow

Go Technology Daily (2022-02-13) - Summary of experience in database storage selection
随机推荐
Is the account opening of Guotai Junan Securities safe and reliable? How to open Guotai Junan Securities Account
[sg function]split game (2020 Jiangxi university student programming competition)
Overview of Yunxi database executor
Code in keil5 -- use the code formatting tool astyle (plug-in)
Getting started with DOM
How can enterprises and developers take advantage of the explosion of cloud native landing?
Mysql database - Advanced SQL statement (I)
How the computer flushes the local DNS cache
Uboot migration
STM32 multi serial port implementation of printf -- Based on cubemx
BUUCTF,Misc:LSB
Conditional statements of shell programming
Go Technology Daily (2022-02-13) - Summary of experience in database storage selection
Rest参考
2022 free examination questions for safety management personnel of hazardous chemical business units and reexamination examination for safety management personnel of hazardous chemical business units
The 14th five year plan and investment feasibility study report of China's industry university research cooperation Ⓧ 2022 ~ 2028
[actual combat record] record the whole process of the server being attacked (redis vulnerability)
国泰君安证券开户是安全可靠的么?怎么开国泰君安证券账户
string
Covariance
