You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gen_lang is a dart library for internationalization. Extracts messages to generate dart files required by Intl, inspired by Intl_translation and Flutter i18n
A source folder contains all string json files (defaults to "res/string")
--output-dir
A output folder stores all generated files (defaults to "lib/generated")
--template-locale
Use string_{template-locale}.json as a template to search KEY. If string_en does not exist, this script will use the first string json file as a template (defaults to "en")
Source of Json Files
By default, the json files are required to locate at res/string. Using
--source-dir argument can change the default source path. These files
must be named in this pattern string_{Locale}.json
Define messages in a plural form. ${how many} is a reserved parameter in
a plural message. This parameters support integer only. For Intl,
Intl.plural() supports these plural keyword including 'Zero', 'One',
'Two', 'Few', 'Many' and 'Other'. Define a json key into this pattern
{jsonKey} {pluralKeyword}. For 'Other', need to define 'POther' for the
plural keyword.
Example
{
"pluralMessageZero": "Hi ${interviewerName}, I have no working experience.",
"pluralMessageOne": "Hi ${interviewerName}, I have one year working experience.",
"pluralMessageTwo": "Hi ${interviewerName}, I have two years of working experience.",
"pluralMessageFew": "Hi ${interviewerName}, I have few years of working experience.",
"pluralMessageMany": "Hi ${interviewerName}, I worked for a long time.",
"pluralMessagePOther": "Hi ${interviewerName}, I have ${howMany} years of working experience."
}
Define a message in gender form. ${targetGender} is a reserved parameter
in a gender message. This parameters support string value with 'male',
female' and 'other'. For Intl, Intl.gender() supports these keyword
including 'Male', 'Female' and 'Other'. Define a json key into this
pattern {jsonKey} {genderKeyword}. For 'Other', need to define 'GOther'
for the gender keyword.
Example
{
"genderMessageMale": "Hi ${name}, He is boy.",
"genderMessageFemale": "Hi ${name}, She is girl",
"genderMessageGOther": "Hi ${name}, he/she is boy/girl."
}
Usage of i18n.dart
The script will generate two files into the output folder including
i18n.dart and messages_all.dart. Import i18n.dart into your source
code. Then finish internationalization tasks.
gen_lang is a dart library for internationalization. Extracts messages to generate dart files required by Intl, inspired by Intl_translation and Flutter i18n