Localization is implemented using the built-in localization methods in Flutter.
Good names:
"positiveResponse": "Да"
"settingsSubmitButton": "Подтверждаю это"
"mainTitle": "Главный экран"
Bad names:
"yes": "Да"
"approveThis": "Подтверждаю это"
"mainScreen": "Главный экран"
Generic strings can save time, but can also be misleading. If you name the strings correctly, this problem will not occur.
Segments are required for visual and semantic separation of lines in the .arb file.
It is also recommended to add an empty line before the segment for visual separation.
For the segment, meta-names are used with @:
"@segmentCommon": {
"---------": "---------",
"description": "Общие строки"
},
"positiveResponse": "Да",
"@segmentMain": {
"---------": "---------",
"description": "Главный экран"
},
...
All lines related to this segment must come after it.
Naming pattern: <segmentName><stringPurpose>
<segmentName>
— the name of the segment under which the line is located<stringPurpose>
— obviously the purpose of the string
Examples:
"@segmentAuth": {
"---------": "---------",
"description": "Строки связанные с авторизацией"
},
"authLoginTitle": "вход",
"authUserTextFieldLabel": "почта или номер телефона",
"authPasswordTextFieldLabel": "пароль",
...
- According to the rules, add a new line.
- Make hot reload/restart.
- The code will be generated in the
lib/l10n
temporary folder.
- IntelliJ / Android Studio: Flutter Intl
- VSCode: Flutter Intl