Skip to content

hanlogy/locale_data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Implementation

You should follow Unicode BCP47 Locale Identifier, for example the valid locale code should be: zh-Hans-CN, see https://www.unicode.org/reports/tr35/ for more details.

About the data structure

Script code shuold be combined with a two-letter language code

Script codes, such as Hans and Hant, are used only in Chinese languages currently. The script code should be combined with a two-letter language code, for example:

zh_Hant

Abount zh_Hans

Since we use simplified Chinese as the default, Hans should not be used. Therefore, there is no zh_Hans or zh_Hans_[region]. For example, zh_Hans should be referred to as zh, and zh_Hans_SG should be referred to as zh_SG.

Abount zh_Hant_[region]

TW,HK and MO must have the script code Hant, For example, these are not allowed as the keys in our data:

zh_TW
zh_HK
zh_MO

All regions allow Hant, for example:

zh_Hant_US

Language

A language consists of a language code and a script code, but it should not include the region code.

For example:

zh //generic simplified Chinese
zh_Hant //generic traditional Chinese
en_US
fr_FR

Region

A region code is composed of two capitalized letters, such as CN.

See:
ISO 3166-1 alpha-2

Files

languages.json

The key of each language item is the language code, optionally followed by the script code if needed and when the language is Chinese.

Example:

{
  "en": {
    "value": "English"
  },
  "zh": {
    "value": "简体中文"
  },
  "zh_Hant": {
    "value": "繁體中文",
    "TW": "正體中文"
  },
  "sv": {
    "value": "Svenska"
  },
  "de": {
    "value": "Deutsch"
  }
}

regions.json

A region consists of l10n and calling_code.

The key of each l10n is the language code, optionally followed by the region code if needed.

Example:

{
  "CN": {
    "l10n": {
      "en": "China",
      "zh": "中国",
      "zh_Hant": "中國",
      "sv": "Kina"
    },
    "calling_code": "86"
  },
  "LA": {
    "l10n": {
      "en": "Laos",
      "zh": "老挝",
      "zh_Hant": "老撾",
      "zh_SG": "寮国",
      "zh_Hant_TW": "寮國"
    },
    "calling_code": "856"
  }
}

Implementations

See: https://github.com/hanlogy/dart_packages/tree/master/locale

Resources

https://en.wikipedia.org/wiki/ISO_3166-1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors