|
1 | 1 | /* @flow strict-local */ |
2 | 2 | /* eslint-disable spellcheck/spell-checker */ |
3 | 3 |
|
4 | | -export type Language = { |
5 | | - locale: string, |
6 | | - name: string, |
7 | | - nativeName: string, |
8 | | -}; |
| 4 | +import { type Language, languageData } from '../i18n/language_list'; |
9 | 5 |
|
10 | | -/** |
11 | | - * The set of languages we offer in the language settings screen. |
12 | | - * |
13 | | - * The translation data files in `static/translations/` include all the |
14 | | - * languages we have open on Transifex for people to translate. This means |
15 | | - * all the languages that someone's expressed interest in translating Zulip |
16 | | - * into, and there are usually some that aren't yet much translated at all. |
17 | | - * |
18 | | - * To avoid offering users a translation into their language when it won't |
19 | | - * actually do anything, we maintain this separate list of languages that |
20 | | - * are translated to an adequate level. |
21 | | - * |
22 | | - * The Zulip webapp offers a language in the UI when it's over 5% |
23 | | - * translated. (Search for `percent_translated` in the server code.) |
24 | | - * To see translation percentages, consult Transifex: |
25 | | - * https://www.transifex.com/zulip/zulip/mobile/ |
26 | | - * |
27 | | - * For the values of `nativeName`, consult Wikipedia: |
28 | | - * https://meta.wikimedia.org/wiki/List_of_Wikipedias |
29 | | - * or better yet, Wikipedia's own mobile UIs. Wikipedia is a very |
30 | | - * conscientiously international and intercultural project with a lot of |
31 | | - * effort going into it by speakers of many languages, which makes it a |
32 | | - * useful gold standard for this. |
33 | | - */ |
34 | | -const languages: $ReadOnlyArray<Language> = [ |
35 | | - { locale: 'bg', name: 'Bulgarian', nativeName: 'Български' }, |
36 | | - { locale: 'ca', name: 'Catalan', nativeName: 'Català' }, |
37 | | - { locale: 'cs', name: 'Czech', nativeName: 'Čeština' }, |
38 | | - { locale: 'de', name: 'German', nativeName: 'Deutsch' }, |
39 | | - { locale: 'en', name: 'English', nativeName: 'English' }, |
40 | | - // TODO: add `en_GB` -- it's "100% translated", though that just means |
41 | | - // the one string mentioning "organization" has s/z/s/ in that word |
42 | | - { locale: 'es', name: 'Spanish', nativeName: 'Español' }, |
43 | | - { locale: 'fa', name: 'Persian', nativeName: 'فارسی' }, |
44 | | - { locale: 'fi', name: 'Finnish', nativeName: 'Suomi' }, |
45 | | - { locale: 'fr', name: 'French', nativeName: 'Français' }, |
46 | | - { locale: 'gl', name: 'Galician', nativeName: 'Galego' }, |
47 | | - { locale: 'hi', name: 'Hindi', nativeName: 'हिन्दी' }, |
48 | | - { locale: 'hu', name: 'Hungarian', nativeName: 'Magyar' }, |
49 | | - { locale: 'id-ID', name: 'Indonesian', nativeName: 'Bahasa Indonesia' }, |
50 | | - { locale: 'it', name: 'Italian', nativeName: 'Italiano' }, |
51 | | - { locale: 'ja', name: 'Japanese', nativeName: '日本語' }, |
52 | | - { locale: 'ko', name: 'Korean', nativeName: '한국어' }, |
53 | | - { locale: 'lt', name: 'Lithuanian', nativeName: 'Lietuvių' }, |
54 | | - { locale: 'ml', name: 'Malayalam', nativeName: 'മലയാളം' }, |
55 | | - { locale: 'nl', name: 'Dutch', nativeName: 'Nederlands' }, |
56 | | - { locale: 'pl', name: 'Polish', nativeName: 'Polski' }, |
57 | | - { locale: 'pt', name: 'Portuguese', nativeName: 'Português' }, |
58 | | - { locale: 'ro', name: 'Romanian', nativeName: 'Română' }, |
59 | | - { locale: 'ru', name: 'Russian', nativeName: 'Русский' }, |
60 | | - { locale: 'sr', name: 'Serbian', nativeName: 'Српски' }, |
61 | | - { locale: 'sv', name: 'Swedish', nativeName: 'Svenska' }, |
62 | | - { locale: 'ta', name: 'Tamil', nativeName: 'தமிழ்' }, |
63 | | - { locale: 'tr', name: 'Turkish', nativeName: 'Türkçe' }, |
64 | | - { locale: 'uk', name: 'Ukrainian', nativeName: 'Українська' }, |
65 | | - { locale: 'vi', name: 'Vietnamese', nativeName: 'Tiếng Việt' }, |
66 | | - { locale: 'zh-Hans', name: 'Chinese (Simplified)', nativeName: '中文 (简体)' }, |
67 | | - { locale: 'zh-Hant', name: 'Chinese (Traditional)', nativeName: '中文 (繁体)' }, |
68 | | -]; |
| 6 | +export type { Language } from '../i18n/language_list'; |
69 | 7 |
|
70 | 8 | const sortForDisplay = (arr: $ReadOnlyArray<Language>): $ReadOnlyArray<Language> => |
71 | 9 | [...arr].sort((a, b) => |
72 | 10 | a.locale === 'en' ? -1 : b.locale === 'en' ? +1 : a.name < b.name ? -1 : +1, |
73 | 11 | ); |
74 | 12 |
|
75 | | -export default sortForDisplay(languages); |
| 13 | +export default sortForDisplay(languageData); |
0 commit comments