1

When define a locale text map, I can use:

1.locale key first

{
    "en":{
      "WELCOME_TO_USE_THIS_APP":"Welcome to use this app,...",
      "SOME_OTHER_TEXT":"fsdfsf..."
    },
    "es":{
      "WELCOME_TO_USE_THIS_APP":"Bienvenido a usar esta aplicación, ...",
      "SOME_OTHER_TEXT":"fkdjsklfs..."
    }
}

2.text key first:

{
    "WELCOME_TO_USE_THIS_APP":{
      "en":"Welcome to use this app,...",
      "es":"Bienvenido a usar esta aplicación, ..."
    },
    "SOME_OTHER_TEXT":{
      "en":"fsdfs...",
      "es":"fkdjsklfs..."
    }
}

Which one should I use?

3

In practice, the locale-specific translations for a project will almost certainly not only be organized by language, but also stored in separate files per language. As Aganju wrote, this makes things easier for the translators. But it is also easier for the developer; imagine you quickly have to integrate three new languages - would you rather merge in three separate files or three huge changesets to the same file?

2

The latter is a lot easier for the translator.

The former will put all texts from one language next to each other in the memory, which might make access infinitesimaly faster.

Unless this quantum of performance becomes relevant, I'd say the latter is preferable.

  • I think you are right because the hardest thing about this is making sure that the app is translated the same the for all languages. Your solution helps nicely with this. – Esben Skov Pedersen Feb 14 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.