1 | /*
|
2 | ################################################################################
|
3 | # #
|
4 | # db db .8888. dP 888888b 8888ba .8888. d8b db 888888b d8888P #
|
5 | # 88 88 d8' `8b 88 88 88 `8b d8' `8b 88V8 88 88 88 #
|
6 | # Y8 8P 88 88 88 a88aaa 88aa8P' 88 88 88 V8 88 88aaa 88 #
|
7 | # `8b d8' 88 88 88 88 88 `8b 88 88 88 V888 88 88 #
|
8 | # `8bd8' Y8. .8P 88 88 88 .88 Y8. .8P dP 88 V88 88 88 #
|
9 | # YP `888P' 88888P 888888P 888888' `888P' 88 VP 8P 888888P dP #
|
10 | # #
|
11 | ################################################################################
|
12 |
|
13 | Language-helper middleware for Express web server.
|
14 |
|
15 | Copyright (C) 2016-2017 Volebo <dev@volebo.net>
|
16 | Copyright (C) 2016-2017 Maksim Koryukov <maxkoryukov@gmail.com>
|
17 |
|
18 | This program is free software: you can redistribute it and/or modify
|
19 | it under the terms of the MIT License, attached to this software package.
|
20 |
|
21 | This program is distributed in the hope that it will be useful,
|
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
24 |
|
25 | You should have received a copy of the MIT License along with this
|
26 | program. If not, see <https://opensource.org/licenses/MIT>.
|
27 | */
|
28 |
|
29 |
|
30 |
|
31 | const _ = require('lodash')
|
32 |
|
33 | // TODO : load from ICU
|
34 | const _langs = [
|
35 | {
|
36 | // NOTE: do not remove the EN locale, it is library default!
|
37 | // https://en.wikipedia.org/wiki/IETF_language_tag
|
38 | code: 'en',
|
39 | name: {
|
40 | short: 'en',
|
41 | full: 'English',
|
42 | native: {
|
43 | short: 'en',
|
44 | full: 'English'
|
45 | }
|
46 | },
|
47 | },
|
48 |
|
49 | {
|
50 | code: 'en-GB',
|
51 | name: {
|
52 | short: 'en (GB)',
|
53 | full: 'English (GB)',
|
54 | native: {
|
55 | short: 'en (GB)',
|
56 | full: 'English (GB)'
|
57 | }
|
58 | },
|
59 | },
|
60 |
|
61 | {
|
62 | code: 'en-US',
|
63 | name: {
|
64 | short: 'en (US)',
|
65 | full: 'English (US)',
|
66 | native: {
|
67 | short: 'en (US)',
|
68 | full: 'English (US)'
|
69 | }
|
70 | },
|
71 | },
|
72 |
|
73 | {
|
74 | code: 'ru',
|
75 | name: {
|
76 | short: 'ru',
|
77 | full: 'Russian',
|
78 | native: {
|
79 | short: 'рус',
|
80 | full: 'Русский'
|
81 | }
|
82 | },
|
83 | },
|
84 |
|
85 | {
|
86 | code: 'ru-RU',
|
87 | name: {
|
88 | short: 'ru (RU)',
|
89 | full: 'Russian (Russia)',
|
90 | native: {
|
91 | short: 'рус (Рос)',
|
92 | full: 'Русский (Россия)'
|
93 | }
|
94 | },
|
95 | },
|
96 |
|
97 | {
|
98 | code: 'uz',
|
99 | name: {
|
100 | short: 'uz',
|
101 | full: 'Uzbek',
|
102 | native: {
|
103 | short: 'uz',
|
104 | full: 'Uzbek'
|
105 | }
|
106 | },
|
107 | },
|
108 | {
|
109 | code: 'zh-CHS',
|
110 | name: {
|
111 | short: 'zh-CHS',
|
112 | full: 'Chinese (Simplified)',
|
113 | native: {
|
114 | short: '那么-ES',
|
115 | full: '吉恩斯(简体)'
|
116 | }
|
117 | },
|
118 | },
|
119 | ]
|
120 |
|
121 | const _dic = _.keyBy(_langs, v => v.code.toLowerCase())
|
122 |
|
123 | module.exports = _dic
|