long1eu / flutter_i18n

This plugin create a binding between your translations from .arb files and your Flutter app.
Apache License 2.0
251 stars 55 forks source link

How to handle nest data? #111

Closed jintangWang closed 5 years ago

jintangWang commented 5 years ago

I knew .arb don't support nest data, like this:

{
  "common": {
      "day": "day",
      "yes": "Yes",
      "no": "No",
   }
}

Do you have any smart suggestions? Because it tortures me if I change data to below:

{
  "common_day": "day",
  "common_yes": "yes",
  "common_no": "no"
}
noordawod commented 5 years ago

Well, from my experience with software design and architecture, keep it simple :) if you impose a certain structure on your data model (in this case it's linguistic data), then your tools, code, and any 3rd party software you may want to use will need to be able to read this structure. I'm not sure this is the right way to go.

For example, I don't know if any of the online translation tools support nesting.

jintangWang commented 5 years ago

Thanks. It's a clever option. I found a jsfiddle almost match my require. So I forked and modified a little to use in .arb. Here is it. http://jsfiddle.net/jintang/bmgvw48n/7/ Thanks again.