I am implementing localization in flutter. From what I read in docs I get that all the translations should be in root/lib/l10n/ folder. I have two files in it app_en.arb and app_hi.arb. I have followed this official doc on flutter localization. As I read I got to know that arb file takes json format. With the example given in the doc, which takes key-value pair it works fine.
{
"helloWorld": "Hello World!",
"@helloWorld": {
"description": "The conventional newborn programmer greeting"
}
}
But what I want is to store json object like this for translation
app_en.arb
{
"helloWorld": "Hello World!",
"@helloWorld": {
"description": "The conventional newborn programmer greeting"
},
"content": [
{
"id": "one",
"question": "What's your name?"
},
{
"id": "two",
"question": "What's your name?"
}
]
}
app_hi.arb
{
"helloWorld": "नमस्ते",
"content": [
{
"id": "एक",
"question": "आपका नाम क्या है?"
},
{
"id": "दो",
"question": "आपका नाम क्या है?"
}
]
}
But it throws an error
The value of "content" is not a string. Generating synthetic localizations package has failed.
is it possible to store json objects like this? if not, what is the alternate way?