Skip to content

Commit 29f590f

Browse files
authored
Merge pull request #75 from greasyfork-org/language-variants-readme
Explain language variants in README
2 parents 21d31a8 + 3af72ca commit 29f590f

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

Readme.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Through [pkg-isocodes](https://salsa.debian.org/iso-codes-team/iso-codes.git):
77

88
- 185 Language codes (iso 639 - 2 letter) in 68 Languages
99
- 246 Country codes (iso 3166 - 2 letter) in 86 Languages
10-
- Country specific codes e.g. zh_TW are also available, have a look at the isocodes website for all options
1110

1211
Install
1312
=======
@@ -22,13 +21,15 @@ Usage
2221
```Ruby
2322
require 'i18n_data'
2423
...
25-
I18nData.languages # {"DE"=>"German",...}
26-
I18nData.languages('DE') # {"DE"=>"Deutsch",...}
27-
I18nData.languages('FR') # {"DE"=>"Allemand",...}
24+
I18nData.languages # {"DE"=>"German",...}
25+
I18nData.languages('DE') # {"DE"=>"Deutsch",...}
26+
I18nData.languages('FR') # {"DE"=>"Allemand",...}
27+
I18nData.languages('ZH-CN') # {"DE"=>"德语",...}
2828
...
2929

30-
I18nData.countries # {"DE"=>"Germany",...}
31-
I18nData.countries('DE') # {"DE"=>"Deutschland",...}
30+
I18nData.countries # {"DE"=>"Germany",...}
31+
I18nData.countries('DE') # {"DE"=>"Deutschland",...}
32+
I18nData.countries('ZH-CN') # {"DE"=>"德国",...}
3233
...
3334

3435
I18nData.language_code('German') # DE
@@ -41,6 +42,13 @@ I18nData.country_code('Deutschland') # DE
4142
..
4243
```
4344

45+
Language Variants
46+
=================
47+
48+
While translations _to_ language variants like ZH-CN are provided, translations _of_ the names of those variants are not. In other words, while `I18nData.languages('ZH_CN')['DE']` will give you the Chinese (as written in China) name of the German language ("德国"), the German name of the Chinese (as written in China) language is not provided.
49+
50+
Where the variant represents a country, you are able to combine the translations of the names of languages and countries (e.g. `"#{I18nData.languages('DE')['ZH']} (#{I18nData.countries('DE')['CN']})"` gives "Chinesisch (China)"), but there is no guarantee this will be correct gramatically or conceptionally in that language.
51+
4452
Data Providers
4553
==============
4654
- FileDataProvider: _FAST_ (default) (loading data from cache-files)

0 commit comments

Comments
 (0)