flutter_localizer
flutter_localizer copied to clipboard
Make it work for i18n_extension too.
To make it work for https://pub.dev/packages/i18n_extension
In Set Up Extract String
:
$$.i18n
There is no need for a key. Just keep the original string. For example Text("Home")
would became Text("Home".i18n)
Then the file should not be .arb
. It should be .json
. The key is the String, and leave the value empty to be filled in later:
{
"Home": "",
"Welcome back!": "",
}
It doesn't matter whether it's .arb or .json. All the plugin cares about is the content. Regarding the JSON content, would it matter if the value is empty? I suppose if it's empty then it's never read meaning it could also just contain the same value.
The only thing that would need some adjustment is the fact that the key is the value
If you want to adjust only the fact that the key is the value, yes, this is the most important thing for me to be able to promote this plugin for i18n_extension too.
The value is empty at first, because it is what you need to fill in later for the language you are supporting. It will not be empty after you fill it in.
In i18n_extension you can declare all language translations in the same file, if you want. Like this:
{
"en_us": {
"Hi.": "Hi.",
"Goodbye.": "Goodbye.",
},
"es_es": {
"Hi.": "Hola.",
"Goodbye.": "Adiós.",
}
}
But that's not necessary. I can just create some import function that reads the json
and puts it into a map in memory. So, for example, for "es_es" it would need a file with this:
{
"Hi.": "Hola.",
"Goodbye.": "Adiós.",
}