Internationalization naming conventions

I am currently trying to internationalize my application. Even though I have read some documentation or looked at the source code, I am still not sure about standards and naming conventions in the field of internationalization. (Sorry if some of the points below are obvious, I am not a native English speaker)

I feel like the i18n is an old topic in computer science, so it should have at least some conventions. Therefore, I would prefer to use the correct names for my code, documentation, and further research.

Here are some specific points:

Language identification

I plan to differentiate between different languages tagged form en-US

, en-GB

, fr-FR

etc. (I've seen them in many places like Mozilla code or during Debian installation).

Does this format have a designation? Do the variables containing these tags have distinguished names?
Is this a "locale"? (this word seems to be a lot, but a little vague). What, a var locale = "en-US";

way to call it?

Translation tables

For each language, I want to store the translation as a table of key-value pairs between the name used in the code and the string with the actual translation.

In the example, for fr-FR

:

| key          | value    |
|--------------|----------|
| action.reply | répondre |
| action.edit  | éditer   |
| action.hide  | masquer  |
| ...          |          |

      

Is there a name for key

? I've seen "languageId", "key" or "entity".
Is there a name for value

? What's the best: translation

, localizedString

what else?
Is the value "locale"? Or maybe the whole table?

At least I get one thing: these tables should be stored in a directory named locale

or locales

(I prefer the plural form used by Mozilla, but angular-translate (JS lib) uses the only one ...)

Objects

The translation table above might be sufficient for static parts of the UI, but I also need to allow users to optionally translate some of the content they represent. Therefore, I have to answer the following needs:

  • Language sensitive, get translation for internal content foo

  • Given the content marked inside bar

    , get the translation for the language

In the second case, the object stores information for only one specific content. It represents one thing, not translation tables. Is there a difference in the names of these structures (each of them is suitable for obtaining data in a different way)?
What should these "accessors" be named?

Locale

The use of this word really puzzles me. Even after looking for a translation or reading code, I can't quite figure out what people mean when they use it.

Note

I know this question about naming conventions can lead to some subjective or "call it how you feel", so I'd really appreciate if your answers are backed up by some examples .

(In case you're wondering, my application is written in JavaScript, but the question is more likely not agnostic)

+3


source to share





All Articles