Add internationalization support with astro-i18next integration

- Implemented astro-i18next for multi-language support, including English, Dutch, and Italian.
- Configured default locale and language fallback settings.
- Defined routes for localized content in the configuration.
- Updated package.json and package-lock.json to include new dependencies for i18next and related plugins.
This commit is contained in:
becarta
2025-05-23 15:10:00 +02:00
parent 8a3507dce0
commit 3168826fa8
581 changed files with 88691 additions and 494 deletions

38
node_modules/iso-639-1/.eslintrc generated vendored Normal file
View File

@@ -0,0 +1,38 @@
{
// 基于 airbnb 规则
"extends": "airbnb",
// 使用 babel 解析器,支持一些还没有进入 ES6+ 标准的特性。比如 class property
"parser": "babel-eslint",
// 解析 webpack alias 中的模块名
"settings": {
"import/resolver": "webpack"
},
"env": {
"browser": true
},
"rules": {
"no-plusplus": [
"error",
{
// 允许 for 循环中的 i++
"allowForLoopAfterthoughts": true
}
],
"no-param-reassign": [
"error",
{
// 允许修改参数的属性
"props": false
}
],
// 允许在循环里使用 await
"no-await-in-loop": 0,
// 允许在一个表达式里使用多种操作符,否则与 prettier 冲突
// see https://github.com/prettier/eslint-config-prettier#no-mixed-operators
"no-mixed-operators": 0,
// 允许在 jsx 中使用 bind
"react/jsx-no-bind": 0,
// 允许所有类型的 proptype
"react/forbid-prop-types": 0
}
}

1
node_modules/iso-639-1/.nvmrc generated vendored Normal file
View File

@@ -0,0 +1 @@
14.17

4
node_modules/iso-639-1/.prettierrc generated vendored Normal file
View File

@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}

6
node_modules/iso-639-1/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,6 @@
language: node_js
node_js:
- '8.0'
- '6.1'
script:
- npm run test

5
node_modules/iso-639-1/.vscode/settings.json generated vendored Normal file
View File

@@ -0,0 +1,5 @@
{
"eslint.enable": true,
"eslint.packageManager": "yarn",
"prettier.eslintIntegration": true
}

34
node_modules/iso-639-1/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,34 @@
# iso-639-1 Changelog
## v2.1.14
- Bump async from 2.6.0 to 2.6.4 [#53](https://github.com/meikidd/iso-639-1/pull/53)
- Add a type to list the langage codes in the TS definition file [#55](https://github.com/meikidd/iso-639-1/pull/55)
## v2.1.13
- update Arabic native name [#50](https://github.com/meikidd/iso-639-1/pull/50)
## v2.1.12
- remove 'bh' [#51](https://github.com/meikidd/iso-639-1/pull/51)
- fj native name changed to "vosa Vakaviti" [#51](https://github.com/meikidd/iso-639-1/pull/51)
- dv native name changed to "ދިވެހި" [#51](https://github.com/meikidd/iso-639-1/pull/51)
- lo native name changed to "ພາສາລາວ" [#51](https://github.com/meikidd/iso-639-1/pull/51)
- ms native name changed to "Bahasa Melayu" [#51](https://github.com/meikidd/iso-639-1/pull/51)
- lu native name changed to "Kiluba" [#51](https://github.com/meikidd/iso-639-1/pull/51)
- na native name changed to "Dorerin Naoero" [#51](https://github.com/meikidd/iso-639-1/pull/51)
- tk native name changed to "Türkmençe" [#51](https://github.com/meikidd/iso-639-1/pull/51)
## v2.1.11
- Slovenian native name "slovenski jezik" -> "slovenščina" [#49](https://github.com/meikidd/iso-639-1/pull/49)
## v2.1.10
- Polish native name "język polski" -> "Polski" [#48](https://github.com/meikidd/iso-639-1/pull/48)
## v2.1.9
- Change hu native name "Magyar" -> "magyar" [#40](https://github.com/meikidd/iso-639-1/pull/40)
## v2.1.8
- Change hr native name "hrvatski jezik" -> "Hrvatski"
- Change sl English name "Slovene" -> "Slovenian"
## v2.1.0
- Correctly handle prototype property names passed as codes [#20](https://github.com/meikidd/iso-639-1/issues/20)

21
node_modules/iso-639-1/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
This software is licensed under the MIT License.
Copyright(c) by Mei Qingguang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

1643
node_modules/iso-639-1/build/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/iso-639-1/build/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

205
node_modules/iso-639-1/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,205 @@
declare module 'iso-639-1' {
export type LanguageCode =
'aa'
| 'ab'
| 'ae'
| 'af'
| 'ak'
| 'am'
| 'an'
| 'ar'
| 'as'
| 'av'
| 'ay'
| 'az'
| 'ba'
| 'be'
| 'bg'
| 'bi'
| 'bm'
| 'bn'
| 'bo'
| 'br'
| 'bs'
| 'ca'
| 'ce'
| 'ch'
| 'co'
| 'cr'
| 'cs'
| 'cu'
| 'cv'
| 'cy'
| 'da'
| 'de'
| 'dv'
| 'dz'
| 'ee'
| 'el'
| 'en'
| 'eo'
| 'es'
| 'et'
| 'eu'
| 'fa'
| 'ff'
| 'fi'
| 'fj'
| 'fo'
| 'fr'
| 'fy'
| 'ga'
| 'gd'
| 'gl'
| 'gn'
| 'gu'
| 'gv'
| 'ha'
| 'he'
| 'hi'
| 'ho'
| 'hr'
| 'ht'
| 'hu'
| 'hy'
| 'hz'
| 'ia'
| 'id'
| 'ie'
| 'ig'
| 'ii'
| 'ik'
| 'io'
| 'is'
| 'it'
| 'iu'
| 'ja'
| 'jv'
| 'ka'
| 'kg'
| 'ki'
| 'kj'
| 'kk'
| 'kl'
| 'km'
| 'kn'
| 'ko'
| 'kr'
| 'ks'
| 'ku'
| 'kv'
| 'kw'
| 'ky'
| 'la'
| 'lb'
| 'lg'
| 'li'
| 'ln'
| 'lo'
| 'lt'
| 'lu'
| 'lv'
| 'mg'
| 'mh'
| 'mi'
| 'mk'
| 'ml'
| 'mn'
| 'mr'
| 'ms'
| 'mt'
| 'my'
| 'na'
| 'nb'
| 'nd'
| 'ne'
| 'ng'
| 'nl'
| 'nn'
| 'no'
| 'nr'
| 'nv'
| 'ny'
| 'oc'
| 'oj'
| 'om'
| 'or'
| 'os'
| 'pa'
| 'pi'
| 'pl'
| 'ps'
| 'pt'
| 'qu'
| 'rm'
| 'rn'
| 'ro'
| 'ru'
| 'rw'
| 'sa'
| 'sc'
| 'sd'
| 'se'
| 'sg'
| 'si'
| 'sk'
| 'sl'
| 'sm'
| 'sn'
| 'so'
| 'sq'
| 'sr'
| 'ss'
| 'st'
| 'su'
| 'sv'
| 'sw'
| 'ta'
| 'te'
| 'tg'
| 'th'
| 'ti'
| 'tk'
| 'tl'
| 'tn'
| 'to'
| 'tr'
| 'ts'
| 'tt'
| 'tw'
| 'ty'
| 'ug'
| 'uk'
| 'ur'
| 'uz'
| 've'
| 'vi'
| 'vo'
| 'wa'
| 'wo'
| 'xh'
| 'yi'
| 'yo'
| 'za'
| 'zh'
| 'zu'
interface ISO6391 {
getName: (code: string) => string;
getAllNames: () => Array<string>;
getNativeName: (code: string) => string;
getAllNativeNames: () => Array<string>;
getCode: (name: string) => LanguageCode;
getAllCodes: () => Array<LanguageCode>;
validate: (code: string) => boolean;
getLanguages: (codes: Array<string>) => Array<{
code: LanguageCode;
name: string;
nativeName: string;
}>;
}
let localeCode: ISO6391;
export default localeCode;
}

46
node_modules/iso-639-1/package.json generated vendored Normal file
View File

@@ -0,0 +1,46 @@
{
"name": "iso-639-1",
"version": "2.1.15",
"description": "ISO-639-1 codes",
"main": "build/index.js",
"module": "src/index.js",
"typings": "index.d.ts",
"scripts": {
"build": "webpack",
"test": "mocha"
},
"repository": {
"type": "git",
"url": "git+https://github.com/meikidd/iso-639-1.git"
},
"keywords": [
"iso",
"iso-639",
"iso-639-1",
"language",
"language code",
"locale",
"locale code"
],
"author": "meikidd <meikidd@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/meikidd/iso-639-1/issues"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"clean-webpack-plugin": "^0.1.17",
"mocha": "^4.0.1",
"webpack": "^3.10.0"
},
"homepage": "https://github.com/meikidd/iso-639-1#readme",
"engines": {
"node": ">=6.0"
}
}

121
node_modules/iso-639-1/readme.md generated vendored Normal file
View File

@@ -0,0 +1,121 @@
# ISO-639-1
[![NPM Version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Download Count][download-url]][npm-url]
[travis-image]: https://travis-ci.org/meikidd/iso-639-1.svg?branch=master
[travis-url]: https://travis-ci.org/meikidd/iso-639-1
[npm-image]: https://img.shields.io/npm/v/iso-639-1.svg?style=flat-square
[npm-url]: https://npmjs.org/package/iso-639-1
[download-url]: https://img.shields.io/npm/dt/iso-639-1.svg?style=flat-square
Simple interface for [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes
## Installation
```
npm install iso-639-1
```
## Usage
### Node.js
```javascript
const ISO6391 = require('iso-639-1');
console.log(ISO6391.getName('en')); // 'English'
```
### ES Module
```javascript
import ISO6391 from 'iso-639-1';
console.log(ISO6391.getName('en')); // 'English'
```
### Browsers
HTML
```html
<script type="text/javascript" src="./node_modules/iso-639-1/build/index.js"></script>
```
Visit global variable ISO6391 in js
```javascript
console.log(ISO6391.getName('en')); // 'English'
```
## Methods
### getName(code)
- @param code {string}
- @return {string}
Lookup language english name by code
### getAllNames()
- @return {array}
Get array of all language english names
### getNativeName(code)
- @param code {string}
- @return {string}
Lookup language native name by code
### getAllNativeNames()
- @return {array}
Get array of all language native names
### getCode(name)
- @param name {string}
- @return {string}
Lookup code by english name or native name
### getAllCodes()
- @return {array}
Get array of all codes
### validate(code)
- @param code {string}
- @return {boolean}
Check whether the given code is in the list of [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
### getLanguages(codes)
- @param codes {array}
- @return {array}
Get the array of the language objects by the given codes
## Example
```
const ISO6391 = require('iso-639-1')
console.log(ISO6391.getName('zh')) // 'Chinese'
console.log(ISO6391.getNativeName('zh')) // '中文'
console.log(ISO6391.getAllNames()) // ['Afar','Abkhaz', ... ,'Zulu']
console.log(ISO6391.getAllNativeNames()) //['Afaraf','аҧсуа бызшәа', ... ,'isiZulu' ]
console.log(ISO6391.getCode('Chinese')) // 'zh'
console.log(ISO6391.getCode('中文')) // 'zh'
console.log(ISO6391.getAllCodes()) //['aa','ab',...,'zu']
console.log(ISO6391.validate('en')) // true
console.log(ISO6391.validate('xx')) // false
console.log(ISO6391.getLanguages(['en', 'zh']))
// [{code:'en',name:'English',nativeName:'English'},{code:'zh',name:'Chinese',nativeName:'中文'}]
```

736
node_modules/iso-639-1/src/data.js generated vendored Normal file
View File

@@ -0,0 +1,736 @@
const LANGUAGES_LIST = {
aa: {
name: 'Afar',
nativeName: 'Afaraf',
},
ab: {
name: 'Abkhaz',
nativeName: 'аҧсуа бызшәа',
},
ae: {
name: 'Avestan',
nativeName: 'avesta',
},
af: {
name: 'Afrikaans',
nativeName: 'Afrikaans',
},
ak: {
name: 'Akan',
nativeName: 'Akan',
},
am: {
name: 'Amharic',
nativeName: 'አማርኛ',
},
an: {
name: 'Aragonese',
nativeName: 'aragonés',
},
ar: {
name: 'Arabic',
nativeName: 'اَلْعَرَبِيَّةُ',
},
as: {
name: 'Assamese',
nativeName: 'অসমীয়া',
},
av: {
name: 'Avaric',
nativeName: 'авар мацӀ',
},
ay: {
name: 'Aymara',
nativeName: 'aymar aru',
},
az: {
name: 'Azerbaijani',
nativeName: 'azərbaycan dili',
},
ba: {
name: 'Bashkir',
nativeName: 'башҡорт теле',
},
be: {
name: 'Belarusian',
nativeName: 'беларуская мова',
},
bg: {
name: 'Bulgarian',
nativeName: 'български език',
},
bi: {
name: 'Bislama',
nativeName: 'Bislama',
},
bm: {
name: 'Bambara',
nativeName: 'bamanankan',
},
bn: {
name: 'Bengali',
nativeName: 'বাংলা',
},
bo: {
name: 'Tibetan',
nativeName: 'བོད་ཡིག',
},
br: {
name: 'Breton',
nativeName: 'brezhoneg',
},
bs: {
name: 'Bosnian',
nativeName: 'bosanski jezik',
},
ca: {
name: 'Catalan',
nativeName: 'Català',
},
ce: {
name: 'Chechen',
nativeName: 'нохчийн мотт',
},
ch: {
name: 'Chamorro',
nativeName: 'Chamoru',
},
co: {
name: 'Corsican',
nativeName: 'corsu',
},
cr: {
name: 'Cree',
nativeName: 'ᓀᐦᐃᔭᐍᐏᐣ',
},
cs: {
name: 'Czech',
nativeName: 'čeština',
},
cu: {
name: 'Old Church Slavonic',
nativeName: 'ѩзыкъ словѣньскъ',
},
cv: {
name: 'Chuvash',
nativeName: 'чӑваш чӗлхи',
},
cy: {
name: 'Welsh',
nativeName: 'Cymraeg',
},
da: {
name: 'Danish',
nativeName: 'dansk',
},
de: {
name: 'German',
nativeName: 'Deutsch',
},
dv: {
name: 'Divehi',
nativeName: 'ދިވެހި',
},
dz: {
name: 'Dzongkha',
nativeName: 'རྫོང་ཁ',
},
ee: {
name: 'Ewe',
nativeName: 'Eʋegbe',
},
el: {
name: 'Greek',
nativeName: 'Ελληνικά',
},
en: {
name: 'English',
nativeName: 'English',
},
eo: {
name: 'Esperanto',
nativeName: 'Esperanto',
},
es: {
name: 'Spanish',
nativeName: 'Español',
},
et: {
name: 'Estonian',
nativeName: 'eesti',
},
eu: {
name: 'Basque',
nativeName: 'euskara',
},
fa: {
name: 'Persian',
nativeName: 'فارسی',
},
ff: {
name: 'Fula',
nativeName: 'Fulfulde',
},
fi: {
name: 'Finnish',
nativeName: 'suomi',
},
fj: {
name: 'Fijian',
nativeName: 'vosa Vakaviti',
},
fo: {
name: 'Faroese',
nativeName: 'føroyskt',
},
fr: {
name: 'French',
nativeName: 'Français',
},
fy: {
name: 'Western Frisian',
nativeName: 'Frysk',
},
ga: {
name: 'Irish',
nativeName: 'Gaeilge',
},
gd: {
name: 'Scottish Gaelic',
nativeName: 'Gàidhlig',
},
gl: {
name: 'Galician',
nativeName: 'galego',
},
gn: {
name: 'Guaraní',
nativeName: "Avañe'ẽ",
},
gu: {
name: 'Gujarati',
nativeName: 'ગુજરાતી',
},
gv: {
name: 'Manx',
nativeName: 'Gaelg',
},
ha: {
name: 'Hausa',
nativeName: 'هَوُسَ',
},
he: {
name: 'Hebrew',
nativeName: 'עברית',
},
hi: {
name: 'Hindi',
nativeName: 'हिन्दी',
},
ho: {
name: 'Hiri Motu',
nativeName: 'Hiri Motu',
},
hr: {
name: 'Croatian',
nativeName: 'Hrvatski',
},
ht: {
name: 'Haitian',
nativeName: 'Kreyòl ayisyen',
},
hu: {
name: 'Hungarian',
nativeName: 'magyar',
},
hy: {
name: 'Armenian',
nativeName: 'Հայերեն',
},
hz: {
name: 'Herero',
nativeName: 'Otjiherero',
},
ia: {
name: 'Interlingua',
nativeName: 'Interlingua',
},
id: {
name: 'Indonesian',
nativeName: 'Bahasa Indonesia',
},
ie: {
name: 'Interlingue',
nativeName: 'Interlingue',
},
ig: {
name: 'Igbo',
nativeName: 'Asụsụ Igbo',
},
ii: {
name: 'Nuosu',
nativeName: 'ꆈꌠ꒿ Nuosuhxop',
},
ik: {
name: 'Inupiaq',
nativeName: 'Iñupiaq',
},
io: {
name: 'Ido',
nativeName: 'Ido',
},
is: {
name: 'Icelandic',
nativeName: 'Íslenska',
},
it: {
name: 'Italian',
nativeName: 'Italiano',
},
iu: {
name: 'Inuktitut',
nativeName: 'ᐃᓄᒃᑎᑐᑦ',
},
ja: {
name: 'Japanese',
nativeName: '日本語',
},
jv: {
name: 'Javanese',
nativeName: 'basa Jawa',
},
ka: {
name: 'Georgian',
nativeName: 'ქართული',
},
kg: {
name: 'Kongo',
nativeName: 'Kikongo',
},
ki: {
name: 'Kikuyu',
nativeName: 'Gĩkũyũ',
},
kj: {
name: 'Kwanyama',
nativeName: 'Kuanyama',
},
kk: {
name: 'Kazakh',
nativeName: 'қазақ тілі',
},
kl: {
name: 'Kalaallisut',
nativeName: 'kalaallisut',
},
km: {
name: 'Khmer',
nativeName: 'ខេមរភាសា',
},
kn: {
name: 'Kannada',
nativeName: 'ಕನ್ನಡ',
},
ko: {
name: 'Korean',
nativeName: '한국어',
},
kr: {
name: 'Kanuri',
nativeName: 'Kanuri',
},
ks: {
name: 'Kashmiri',
nativeName: 'कश्मीरी',
},
ku: {
name: 'Kurdish',
nativeName: 'Kurdî',
},
kv: {
name: 'Komi',
nativeName: 'коми кыв',
},
kw: {
name: 'Cornish',
nativeName: 'Kernewek',
},
ky: {
name: 'Kyrgyz',
nativeName: 'Кыргызча',
},
la: {
name: 'Latin',
nativeName: 'latine',
},
lb: {
name: 'Luxembourgish',
nativeName: 'Lëtzebuergesch',
},
lg: {
name: 'Ganda',
nativeName: 'Luganda',
},
li: {
name: 'Limburgish',
nativeName: 'Limburgs',
},
ln: {
name: 'Lingala',
nativeName: 'Lingála',
},
lo: {
name: 'Lao',
nativeName: 'ພາສາລາວ',
},
lt: {
name: 'Lithuanian',
nativeName: 'lietuvių kalba',
},
lu: {
name: 'Luba-Katanga',
nativeName: 'Kiluba',
},
lv: {
name: 'Latvian',
nativeName: 'latviešu valoda',
},
mg: {
name: 'Malagasy',
nativeName: 'fiteny malagasy',
},
mh: {
name: 'Marshallese',
nativeName: 'Kajin M̧ajeļ',
},
mi: {
name: 'Māori',
nativeName: 'te reo Māori',
},
mk: {
name: 'Macedonian',
nativeName: 'македонски јазик',
},
ml: {
name: 'Malayalam',
nativeName: 'മലയാളം',
},
mn: {
name: 'Mongolian',
nativeName: 'Монгол хэл',
},
mr: {
name: 'Marathi',
nativeName: 'मराठी',
},
ms: {
name: 'Malay',
nativeName: 'Bahasa Melayu',
},
mt: {
name: 'Maltese',
nativeName: 'Malti',
},
my: {
name: 'Burmese',
nativeName: 'ဗမာစာ',
},
na: {
name: 'Nauru',
nativeName: 'Dorerin Naoero',
},
nb: {
name: 'Norwegian Bokmål',
nativeName: 'Norsk bokmål',
},
nd: {
name: 'Northern Ndebele',
nativeName: 'isiNdebele',
},
ne: {
name: 'Nepali',
nativeName: 'नेपाली',
},
ng: {
name: 'Ndonga',
nativeName: 'Owambo',
},
nl: {
name: 'Dutch',
nativeName: 'Nederlands',
},
nn: {
name: 'Norwegian Nynorsk',
nativeName: 'Norsk nynorsk',
},
no: {
name: 'Norwegian',
nativeName: 'Norsk',
},
nr: {
name: 'Southern Ndebele',
nativeName: 'isiNdebele',
},
nv: {
name: 'Navajo',
nativeName: 'Diné bizaad',
},
ny: {
name: 'Chichewa',
nativeName: 'chiCheŵa',
},
oc: {
name: 'Occitan',
nativeName: 'occitan',
},
oj: {
name: 'Ojibwe',
nativeName: 'ᐊᓂᔑᓈᐯᒧᐎᓐ',
},
om: {
name: 'Oromo',
nativeName: 'Afaan Oromoo',
},
or: {
name: 'Oriya',
nativeName: 'ଓଡ଼ିଆ',
},
os: {
name: 'Ossetian',
nativeName: 'ирон æвзаг',
},
pa: {
name: 'Panjabi',
nativeName: 'ਪੰਜਾਬੀ',
},
pi: {
name: 'Pāli',
nativeName: 'पाऴि',
},
pl: {
name: 'Polish',
nativeName: 'Polski',
},
ps: {
name: 'Pashto',
nativeName: 'پښتو',
},
pt: {
name: 'Portuguese',
nativeName: 'Português',
},
qu: {
name: 'Quechua',
nativeName: 'Runa Simi',
},
rm: {
name: 'Romansh',
nativeName: 'rumantsch grischun',
},
rn: {
name: 'Kirundi',
nativeName: 'Ikirundi',
},
ro: {
name: 'Romanian',
nativeName: 'Română',
},
ru: {
name: 'Russian',
nativeName: 'Русский',
},
rw: {
name: 'Kinyarwanda',
nativeName: 'Ikinyarwanda',
},
sa: {
name: 'Sanskrit',
nativeName: 'संस्कृतम्',
},
sc: {
name: 'Sardinian',
nativeName: 'sardu',
},
sd: {
name: 'Sindhi',
nativeName: 'सिन्धी',
},
se: {
name: 'Northern Sami',
nativeName: 'Davvisámegiella',
},
sg: {
name: 'Sango',
nativeName: 'yângâ tî sängö',
},
si: {
name: 'Sinhala',
nativeName: 'සිංහල',
},
sk: {
name: 'Slovak',
nativeName: 'slovenčina',
},
sl: {
name: 'Slovenian',
nativeName: 'slovenščina',
},
sm: {
name: 'Samoan',
nativeName: "gagana fa'a Samoa",
},
sn: {
name: 'Shona',
nativeName: 'chiShona',
},
so: {
name: 'Somali',
nativeName: 'Soomaaliga',
},
sq: {
name: 'Albanian',
nativeName: 'Shqip',
},
sr: {
name: 'Serbian',
nativeName: 'српски језик',
},
ss: {
name: 'Swati',
nativeName: 'SiSwati',
},
st: {
name: 'Southern Sotho',
nativeName: 'Sesotho',
},
su: {
name: 'Sundanese',
nativeName: 'Basa Sunda',
},
sv: {
name: 'Swedish',
nativeName: 'Svenska',
},
sw: {
name: 'Swahili',
nativeName: 'Kiswahili',
},
ta: {
name: 'Tamil',
nativeName: 'தமிழ்',
},
te: {
name: 'Telugu',
nativeName: 'తెలుగు',
},
tg: {
name: 'Tajik',
nativeName: 'тоҷикӣ',
},
th: {
name: 'Thai',
nativeName: 'ไทย',
},
ti: {
name: 'Tigrinya',
nativeName: 'ትግርኛ',
},
tk: {
name: 'Turkmen',
nativeName: 'Türkmençe',
},
tl: {
name: 'Tagalog',
nativeName: 'Wikang Tagalog',
},
tn: {
name: 'Tswana',
nativeName: 'Setswana',
},
to: {
name: 'Tonga',
nativeName: 'faka Tonga',
},
tr: {
name: 'Turkish',
nativeName: 'Türkçe',
},
ts: {
name: 'Tsonga',
nativeName: 'Xitsonga',
},
tt: {
name: 'Tatar',
nativeName: 'татар теле',
},
tw: {
name: 'Twi',
nativeName: 'Twi',
},
ty: {
name: 'Tahitian',
nativeName: 'Reo Tahiti',
},
ug: {
name: 'Uyghur',
nativeName: 'ئۇيغۇرچە‎',
},
uk: {
name: 'Ukrainian',
nativeName: 'Українська',
},
ur: {
name: 'Urdu',
nativeName: 'اردو',
},
uz: {
name: 'Uzbek',
nativeName: 'Ўзбек',
},
ve: {
name: 'Venda',
nativeName: 'Tshivenḓa',
},
vi: {
name: 'Vietnamese',
nativeName: 'Tiếng Việt',
},
vo: {
name: 'Volapük',
nativeName: 'Volapük',
},
wa: {
name: 'Walloon',
nativeName: 'walon',
},
wo: {
name: 'Wolof',
nativeName: 'Wollof',
},
xh: {
name: 'Xhosa',
nativeName: 'isiXhosa',
},
yi: {
name: 'Yiddish',
nativeName: 'ייִדיש',
},
yo: {
name: 'Yoruba',
nativeName: 'Yorùbá',
},
za: {
name: 'Zhuang',
nativeName: 'Saɯ cueŋƅ',
},
zh: {
name: 'Chinese',
nativeName: '中文',
},
zu: {
name: 'Zulu',
nativeName: 'isiZulu',
},
};
export default LANGUAGES_LIST;

47
node_modules/iso-639-1/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
import LANGUAGES_LIST from './data';
export default class ISO6391 {
static getLanguages(codes = []) {
return codes.map(code => ({
code,
name: ISO6391.getName(code),
nativeName: ISO6391.getNativeName(code),
}));
}
static getName(code) {
return ISO6391.validate(code) ? LANGUAGES_LIST[code].name : '';
}
static getAllNames() {
return Object.values(LANGUAGES_LIST).map(l => l.name);
}
static getNativeName(code) {
return ISO6391.validate(code) ? LANGUAGES_LIST[code].nativeName : '';
}
static getAllNativeNames() {
return Object.values(LANGUAGES_LIST).map(l => l.nativeName);
}
static getCode(name) {
const code = Object.keys(LANGUAGES_LIST).find(code => {
const language = LANGUAGES_LIST[code];
return (
language.name.toLowerCase() === name.toLowerCase() ||
language.nativeName.toLowerCase() === name.toLowerCase()
);
});
return code || '';
}
static getAllCodes() {
return Object.keys(LANGUAGES_LIST);
}
static validate(code) {
return LANGUAGES_LIST.hasOwnProperty(code);
}
}

92
node_modules/iso-639-1/test/test.js generated vendored Normal file
View File

@@ -0,0 +1,92 @@
const assert = require('assert');
const ISO6391 = require('../build/index');
describe('getName()', function() {
it('en', function() {
assert.equal(ISO6391.getName('en'), 'English');
});
it('zh', function() {
assert.equal(ISO6391.getName('zh'), 'Chinese');
});
it('xx', function() {
assert.equal(ISO6391.getName('xx'), '');
});
it('toString', function() {
assert.equal(ISO6391.getName('toString'), '');
});
});
describe('getNativeName()', function() {
it('en', function() {
assert.equal(ISO6391.getNativeName('en'), 'English');
});
it('zh', function() {
assert.equal(ISO6391.getNativeName('zh'), '中文');
});
it('xx', function() {
assert.equal(ISO6391.getNativeName('xx'), '');
});
it('toString', function() {
assert.equal(ISO6391.getNativeName('toString'), '');
});
});
describe('getCode()', function() {
it('English', function() {
assert.equal(ISO6391.getCode('English'), 'en');
});
it('Chinese', function() {
assert.equal(ISO6391.getCode('Chinese'), 'zh');
});
it('中文', function() {
assert.equal(ISO6391.getCode('中文'), 'zh');
});
it('xx', function() {
assert.equal(ISO6391.getCode('xx'), '');
});
it('toString', function() {
assert.equal(ISO6391.getCode('toString'), '');
});
});
describe('validate()', function() {
it('en', function() {
assert.equal(ISO6391.validate('en'), true);
});
it('zh', function() {
assert.equal(ISO6391.validate('zh'), true);
});
it('xx', function() {
assert.equal(ISO6391.validate('xx'), false);
});
it('toString', function() {
assert.equal(ISO6391.validate('toString'), false);
});
});
describe('getLanguages()', function() {
it('[en, zh, xx, toString]', function() {
assert.deepEqual(ISO6391.getLanguages(['en', 'zh', 'xx', 'toString']), [
{
code: 'en',
name: 'English',
nativeName: 'English',
},
{
code: 'zh',
name: 'Chinese',
nativeName: '中文',
},
{
code: 'xx',
name: '',
nativeName: '',
},
{
code: 'toString',
name: '',
nativeName: '',
},
]);
});
});

41
node_modules/iso-639-1/webpack.config.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
const path = require('path');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
// const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
// webpack 配置
let webpackConfig = {
entry: {
index: './src/index.js',
},
output: {
path: path.resolve(__dirname, `./build`), // 输出路径
filename: '[name].js', // js 文件路径
library: 'ISO6391',
libraryTarget: 'umd'
},
devtool: 'cheap-source-map',
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
cacheDirectory: require('os').tmpdir(),
presets: ['es2015', 'stage-0'],
plugins: ['add-module-exports', 'transform-runtime'],
},
},
},
],
},
plugins: [
new webpack.NamedModulesPlugin(),
new CleanWebpackPlugin(['./build']),
// new UglifyJSPlugin()
],
};
module.exports = webpackConfig;