Skip to content

Latest commit

 

History

History
71 lines (51 loc) · 2.24 KB

i18n.md

File metadata and controls

71 lines (51 loc) · 2.24 KB

I18N

Internationalization, or i18n, is concerned in this project.

Currently User Interface related files are stored in www/lang
As well as readme.i18n and i18n.i18n for readme. In the future, there can be other manual files.

Note: I'm thinking about putting this part to dedicated repo.

What to do

In simple cases, you just make a copy of already-there language file, and modify it to your local language.
You should know what's your locale "code", for example "English (US)" is en-US. You can look at your browser locale configuration, or gather from the Internet. After that, add an entry in list.json.

Naming

Plain:

"there-is-an-apple": "There is an apple"

With parameter(s):

"there-are-0-apples-in-1-baskets": "There are {0} apples in {1} baskets"

With Conditions: (differs by language)

"0-apples": {
    "single": "{0} apple",
    "multiple": "{0} apples"
}

Special Key:

"KeyboardLayout": "1234567890qwertzuiopasdfghjklyxcvbnm"

It seems can't satisfy another grammar

That's what is going to be fun:

This i18n implementation didn't do built-in basics.
Instead the grammar details are all done by code.

That doesn't mean difficulty:

  • You can simply describe how should the grammar work, by communicating with natual language, with someone that could write code, at here or around you.

  • Here almost everyone could do programming. Coding grammar needs much less work -- it's what a junior programmer could do to improve his/her skill.

  • Don't forget me! There are Issue and Discussion.

  • Or you actually can do code? Look at file www/i18n-ext.js then you could get the point. Also see www/i18n.d.ts for typing details. You may modify anything around, to be better.

  • You can also make "example" files (like en-US-ex.jsonc), for testing grammar points, or just showing what could be done.
    The jsonc format is JSON allowing comments. At the moment please use only //

  • Use a test file:

    • Load project Web Interface

    • Open DevTools in browser (usually press F12)

    • go to console, inside type like:

      testI18n('en-US');  // lang code
      i18n('0-apples', [1]);  // key ('conditions') and values ('things')
      // ...
    • See if it's correct