diff --git a/app/api/entities.v2/types/EntityInputDataSchema.ts b/app/api/entities.v2/types/EntityInputDataSchema.ts index 9c15946d2b..9423e9e7d0 100644 --- a/app/api/entities.v2/types/EntityInputDataSchema.ts +++ b/app/api/entities.v2/types/EntityInputDataSchema.ts @@ -1,4 +1,4 @@ -import { availableLanguagesISO6391 } from 'shared/languagesList'; +import { ISO6391Codes } from 'shared/languagesList'; const linkSchema = { type: 'object', @@ -78,7 +78,7 @@ export const entityInputDataSchema = { properties: { _id: { type: 'string' }, sharedId: { type: 'string', minLength: 1 }, - language: { enum: availableLanguagesISO6391 }, + language: { enum: ISO6391Codes }, title: { type: 'string', minLength: 1 }, template: { type: 'string' }, metadata: metadataSchema, diff --git a/app/react/Attachments/components/File.tsx b/app/react/Attachments/components/File.tsx index d35047d154..25b8a4fb2c 100644 --- a/app/react/Attachments/components/File.tsx +++ b/app/react/Attachments/components/File.tsx @@ -3,7 +3,7 @@ import { connect, ConnectedProps } from 'react-redux'; import { bindActionCreators, Dispatch } from 'redux'; import { Control } from 'react-redux-form'; import { withContext } from 'app/componentWrappers'; -import { Translate, t } from 'app/I18N'; +import { t, Translate } from 'app/I18N'; import { Icon } from 'UI'; import { APIURL } from 'app/config.js'; import { ClientBlobFile } from 'app/istore'; @@ -12,7 +12,7 @@ import { wrapDispatch } from 'app/Multireducer'; import { TocGeneratedLabel } from 'app/ToggledFeatures/tocGeneration'; import { NeedAuthorization } from 'app/Auth'; import { LocalForm } from 'app/Forms/Form'; -import { language as transformLanguage, availableLanguages } from 'shared/languagesList'; +import { availableLanguages, getLanguageSchema } from 'shared/languagesList'; import { isBlobFile } from 'shared/tsUtils'; import { EntitySchema } from 'shared/types/entityType'; import { FileType } from 'shared/types/fileType'; @@ -100,11 +100,12 @@ class File extends Component { renderReady() { const { language, filename = '' } = this.props.file; const { readonly } = this.props; + return (
- {language ? transformLanguage(language) || '' : ''} + {language ? getLanguageSchema(language)?.label || '' : ''} ML TOC @@ -196,6 +197,7 @@ class File extends Component { {language.localized_label} ({language.label}) ))} +
diff --git a/app/react/Attachments/components/specs/File.spec.tsx b/app/react/Attachments/components/specs/File.spec.tsx index 5b81dabc60..41eca70669 100644 --- a/app/react/Attachments/components/specs/File.spec.tsx +++ b/app/react/Attachments/components/specs/File.spec.tsx @@ -39,7 +39,7 @@ describe('file', () => { expect(title).toBe('Human_name_1.pdf'); const language = component.find('.badge').find(Translate).props().children; - expect(language).toBe('english'); + expect(language).toBe('English'); }); describe('read only', () => { diff --git a/app/shared/languagesList.ts b/app/shared/languagesList.ts index 8bdbac915c..ad07bc7940 100644 --- a/app/shared/languagesList.ts +++ b/app/shared/languagesList.ts @@ -1,42 +1,27 @@ /* eslint-disable max-lines */ import { LanguageSchema } from 'shared/types/commonTypes'; -const elasticLanguages: { - [index: string]: { franc: string; elastic: string; ISO639_1: string | null }; -} = { - arb: { franc: 'arb', elastic: 'arabic', ISO639_1: 'ar' }, - bul: { franc: 'bul', elastic: 'bulgarian', ISO639_1: 'bg' }, - cat: { franc: 'cat', elastic: 'catalan', ISO639_1: 'ca' }, - cjk: { franc: 'cjk', elastic: 'cjk', ISO639_1: null }, - ckb: { franc: 'ckb', elastic: 'sorani', ISO639_1: null }, - ces: { franc: 'ces', elastic: 'czech', ISO639_1: 'cs' }, - dan: { franc: 'dan', elastic: 'danish', ISO639_1: 'da' }, - deu: { franc: 'deu', elastic: 'german', ISO639_1: 'de' }, - ell: { franc: 'ell', elastic: 'greek', ISO639_1: 'el' }, - eng: { franc: 'eng', elastic: 'english', ISO639_1: 'en' }, - eus: { franc: 'eus', elastic: 'basque', ISO639_1: 'eu' }, - fas: { franc: 'fas', elastic: 'persian', ISO639_1: 'fa' }, - fin: { franc: 'fin', elastic: 'finnish', ISO639_1: 'fi' }, - fra: { franc: 'fra', elastic: 'french', ISO639_1: 'fr' }, - gle: { franc: 'gle', elastic: 'irish', ISO639_1: 'ga' }, - glg: { franc: 'glg', elastic: 'galician', ISO639_1: 'gl' }, - hin: { franc: 'hin', elastic: 'hindi', ISO639_1: 'hi' }, - hun: { franc: 'hun', elastic: 'hungarian', ISO639_1: 'hu' }, - hye: { franc: 'hye', elastic: 'armenian', ISO639_1: 'hy' }, - ind: { franc: 'ind', elastic: 'indonesian', ISO639_1: 'id' }, - ita: { franc: 'ita', elastic: 'italian', ISO639_1: 'it' }, - lav: { franc: 'lav', elastic: 'latvian', ISO639_1: 'lv' }, - lit: { franc: 'lit', elastic: 'lithuanian', ISO639_1: 'lt' }, - nld: { franc: 'nld', elastic: 'dutch', ISO639_1: 'nl' }, - nno: { franc: 'nno', elastic: 'norwegian', ISO639_1: 'nn' }, - nob: { franc: 'nob', elastic: 'norwegian', ISO639_1: 'nb' }, - por: { franc: 'por', elastic: 'portuguese', ISO639_1: 'pt' }, - ron: { franc: 'ron', elastic: 'romanian', ISO639_1: 'ro' }, - rus: { franc: 'rus', elastic: 'russian', ISO639_1: 'ru' }, - spa: { franc: 'spa', elastic: 'spanish', ISO639_1: 'es' }, - swe: { franc: 'swe', elastic: 'swedish', ISO639_1: 'sv' }, - tha: { franc: 'tha', elastic: 'thai', ISO639_1: 'th' }, - tur: { franc: 'tur', elastic: 'turkish', ISO639_1: 'tr' }, +type LanguageCode = 'elastic' | 'ISO639_3' | 'ISO639_1' | 'franc'; + +type LegacyElasticObject = Record< + string, + { franc: string; elastic: string; ISO639_1: string | null } +>; + +type Language = { + label: string; + value: string; +}; + +const undefinedLanguage: LanguageSchema = { + label: 'Other', + key: 'other' as any, + ISO639_1: 'other', + ISO639_3: 'other', + elastic: 'other', + franc: 'other', + localized_label: 'Other', + translationAvailable: false, }; const availableLanguages: LanguageSchema[] = [ @@ -44,6 +29,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Abkhazian', key: 'ab', ISO639_3: 'abk', + ISO639_1: 'ab', localized_label: 'Abkhazian', translationAvailable: false, }, @@ -51,6 +37,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Afar', key: 'aa', ISO639_3: 'aar', + ISO639_1: 'aa', localized_label: 'Afar', translationAvailable: false, }, @@ -58,6 +45,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Afrikaans', key: 'af', ISO639_3: 'afr', + ISO639_1: 'af', localized_label: 'Afrikaans', translationAvailable: false, }, @@ -65,6 +53,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Akan', key: 'ak', ISO639_3: 'aka', + ISO639_1: 'ak', localized_label: 'Akan', translationAvailable: false, }, @@ -72,6 +61,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Albanian', key: 'sq', ISO639_3: 'sqi', + ISO639_1: 'sq', localized_label: 'Shqip', translationAvailable: false, }, @@ -79,6 +69,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Amharic', key: 'am', ISO639_3: 'amh', + ISO639_1: 'am', localized_label: 'አማርኛ', translationAvailable: false, }, @@ -86,7 +77,10 @@ const availableLanguages: LanguageSchema[] = [ label: 'Arabic', key: 'ar', rtl: true, - ISO639_3: 'ara', + ISO639_3: 'arb', + franc: 'arb', + elastic: 'arabic', + ISO639_1: 'ar', localized_label: 'العربية', translationAvailable: false, }, @@ -94,6 +88,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Aragonese', key: 'an', ISO639_3: 'arg', + ISO639_1: 'an', localized_label: 'Aragonese', translationAvailable: false, }, @@ -101,6 +96,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Armenian', key: 'hy', ISO639_3: 'hye', + franc: 'hye', + elastic: 'armenian', + ISO639_1: 'hy', localized_label: 'Հայերեն', translationAvailable: false, }, @@ -108,6 +106,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Assamese', key: 'as', ISO639_3: 'asm', + ISO639_1: 'as', localized_label: 'অসমীয়া', translationAvailable: false, }, @@ -115,6 +114,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Avaric', key: 'av', ISO639_3: 'ava', + ISO639_1: 'av', localized_label: 'Avaric', translationAvailable: false, }, @@ -122,6 +122,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Avestan', key: 'ae', ISO639_3: 'ave', + ISO639_1: 'ae', localized_label: 'Avestan', translationAvailable: false, }, @@ -129,6 +130,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Aymara', key: 'ay', ISO639_3: 'aym', + ISO639_1: 'ay', localized_label: 'Aymara', translationAvailable: false, }, @@ -136,6 +138,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Azerbaijani', key: 'az', ISO639_3: 'aze', + ISO639_1: 'az', localized_label: 'Azərbaycan', translationAvailable: false, }, @@ -143,6 +146,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Bambara', key: 'bm', ISO639_3: 'bam', + ISO639_1: 'bm', localized_label: 'Bamanakan', translationAvailable: false, }, @@ -150,6 +154,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Bashkir', key: 'ba', ISO639_3: 'bak', + ISO639_1: 'ba', localized_label: 'Bashkir', translationAvailable: false, }, @@ -157,6 +162,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Basque', key: 'eu', ISO639_3: 'eus', + franc: 'eus', + elastic: 'basque', + ISO639_1: 'eu', localized_label: 'Euskara', translationAvailable: false, }, @@ -164,6 +172,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Belarusian', key: 'be', ISO639_3: 'bel', + ISO639_1: 'be', localized_label: 'Беларуская', translationAvailable: false, }, @@ -171,6 +180,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Bengali (Bangla)', key: 'bn', ISO639_3: 'ben', + ISO639_1: 'bn', localized_label: 'বাংলা', translationAvailable: false, }, @@ -178,6 +188,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Bihari', key: 'bh', ISO639_3: 'bih', + ISO639_1: 'bh', localized_label: 'Bhojpuri', translationAvailable: false, }, @@ -185,6 +196,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Bislama', key: 'bi', ISO639_3: 'bis', + ISO639_1: 'bi', localized_label: 'Bislama', translationAvailable: false, }, @@ -192,6 +204,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Bosnian', key: 'bs', ISO639_3: 'bos', + ISO639_1: 'bs', localized_label: 'Bosanski', translationAvailable: false, }, @@ -199,6 +212,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Breton', key: 'br', ISO639_3: 'bre', + ISO639_1: 'br', localized_label: 'Brezhoneg', translationAvailable: false, }, @@ -206,6 +220,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Bulgarian', key: 'bg', ISO639_3: 'bul', + franc: 'bul', + elastic: 'bulgarian', + ISO639_1: 'bg', localized_label: 'Български', translationAvailable: false, }, @@ -213,6 +230,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Burmese', key: 'my', ISO639_3: 'mya', + ISO639_1: 'my', localized_label: 'မြန်မာ', translationAvailable: false, }, @@ -220,6 +238,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Catalan', key: 'ca', ISO639_3: 'cat', + franc: 'cat', + elastic: 'catalan', + ISO639_1: 'ca', localized_label: 'Català', translationAvailable: false, }, @@ -227,6 +248,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Chamorro', key: 'ch', ISO639_3: 'cha', + ISO639_1: 'ch', localized_label: 'Chamorro', translationAvailable: false, }, @@ -234,6 +256,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Chechen', key: 'ce', ISO639_3: 'che', + ISO639_1: 'ce', localized_label: 'Нохчийн', translationAvailable: false, }, @@ -241,6 +264,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Chichewa, Chewa, Nyanja', key: 'ny', ISO639_3: 'nya', + ISO639_1: 'ny', localized_label: 'Nyanja', translationAvailable: false, }, @@ -248,6 +272,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Chinese', key: 'zh', ISO639_3: 'zho', + franc: 'cjk', + elastic: 'cjk', + ISO639_1: 'zh', localized_label: '中文', translationAvailable: false, }, @@ -255,6 +282,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Chinese (Simplified)', key: 'zh-Hans', ISO639_3: 'zho-Hans', + franc: 'cjk', + elastic: 'cjk', + ISO639_1: 'zh-Hans', localized_label: '简体中文', translationAvailable: false, }, @@ -262,6 +292,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Chinese (Traditional)', key: 'zh-Hant', ISO639_3: 'zho-Hant', + franc: 'cjk', + elastic: 'cjk', + ISO639_1: 'zh-Hant', localized_label: '繁體中文', translationAvailable: false, }, @@ -269,6 +302,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Chuvash', key: 'cv', ISO639_3: 'chv', + ISO639_1: 'cv', localized_label: 'Chuvash', translationAvailable: false, }, @@ -276,6 +310,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Cornish', key: 'kw', ISO639_3: 'cor', + ISO639_1: 'kw', localized_label: 'Kernewek', translationAvailable: false, }, @@ -283,6 +318,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Corsican', key: 'co', ISO639_3: 'cos', + ISO639_1: 'co', localized_label: 'Corsican', translationAvailable: false, }, @@ -290,6 +326,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Cree', key: 'cr', ISO639_3: 'cre', + ISO639_1: 'cr', localized_label: 'Cree', translationAvailable: false, }, @@ -297,6 +334,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Croatian', key: 'hr', ISO639_3: 'hrv', + ISO639_1: 'hr', localized_label: 'Hrvatski', translationAvailable: false, }, @@ -304,6 +342,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Czech', key: 'cs', ISO639_3: 'ces', + franc: 'ces', + elastic: 'czech', + ISO639_1: 'cs', localized_label: 'Čeština', translationAvailable: false, }, @@ -311,6 +352,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Danish', key: 'da', ISO639_3: 'dan', + franc: 'dan', + elastic: 'danish', + ISO639_1: 'da', localized_label: 'Dansk', translationAvailable: false, }, @@ -319,6 +363,7 @@ const availableLanguages: LanguageSchema[] = [ key: 'dv', rtl: true, ISO639_3: 'div', + ISO639_1: 'dv', localized_label: 'Divehi', translationAvailable: false, }, @@ -326,6 +371,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Dutch', key: 'nl', ISO639_3: 'nld', + franc: 'nld', + elastic: 'dutch', + ISO639_1: 'nl', localized_label: 'Nederlands', translationAvailable: false, }, @@ -333,6 +381,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Dzongkha', key: 'dz', ISO639_3: 'dzo', + ISO639_1: 'dz', localized_label: 'རྫོང་ཁ', translationAvailable: false, }, @@ -340,6 +389,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'English', key: 'en', ISO639_3: 'eng', + franc: 'eng', + elastic: 'english', + ISO639_1: 'en', localized_label: 'English', translationAvailable: false, }, @@ -347,6 +399,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Esperanto', key: 'eo', ISO639_3: 'epo', + ISO639_1: 'eo', localized_label: 'Esperanto', translationAvailable: false, }, @@ -354,6 +407,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Estonian', key: 'et', ISO639_3: 'est', + ISO639_1: 'et', localized_label: 'Eesti', translationAvailable: false, }, @@ -361,6 +415,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Ewe', key: 'ee', ISO639_3: 'ewe', + ISO639_1: 'ee', localized_label: 'Eʋegbe', translationAvailable: false, }, @@ -368,6 +423,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Faroese', key: 'fo', ISO639_3: 'fao', + ISO639_1: 'fo', localized_label: 'Føroyskt', translationAvailable: false, }, @@ -375,6 +431,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Fijian', key: 'fj', ISO639_3: 'fij', + ISO639_1: 'fj', localized_label: 'Fijian', translationAvailable: false, }, @@ -382,6 +439,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Finnish', key: 'fi', ISO639_3: 'fin', + franc: 'fin', + elastic: 'finnish', + ISO639_1: 'fi', localized_label: 'Suomi', translationAvailable: false, }, @@ -389,6 +449,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'French', key: 'fr', ISO639_3: 'fra', + franc: 'fra', + elastic: 'french', + ISO639_1: 'fr', localized_label: 'Français', translationAvailable: false, }, @@ -396,6 +459,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Fula, Fulah, Pulaar, Pular', key: 'ff', ISO639_3: 'ful', + ISO639_1: 'ff', localized_label: 'Pulaar', translationAvailable: false, }, @@ -403,6 +467,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Galician', key: 'gl', ISO639_3: 'glg', + franc: 'glg', + elastic: 'galician', + ISO639_1: 'gl', localized_label: 'Galego', translationAvailable: false, }, @@ -410,6 +477,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Gaelic Scottish', key: 'gd', ISO639_3: 'gla', + ISO639_1: 'gd', localized_label: 'Gàidhlig', translationAvailable: false, }, @@ -417,6 +485,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Gaelic (Manx)', key: 'gv', ISO639_3: 'glv', + ISO639_1: 'gv', localized_label: 'Gaelg', translationAvailable: false, }, @@ -424,6 +493,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Georgian', key: 'ka', ISO639_3: 'kat', + ISO639_1: 'ka', localized_label: 'Ქართული', translationAvailable: false, }, @@ -431,6 +501,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'German', key: 'de', ISO639_3: 'deu', + franc: 'deu', + elastic: 'german', + ISO639_1: 'de', localized_label: 'Deutsch', translationAvailable: false, }, @@ -438,6 +511,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Greek', key: 'el', ISO639_3: 'ell', + franc: 'ell', + elastic: 'greek', + ISO639_1: 'el', localized_label: 'Ελληνικά', translationAvailable: false, }, @@ -445,6 +521,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Guarani', key: 'gn', ISO639_3: 'grn', + ISO639_1: 'gn', localized_label: 'Guarani', translationAvailable: false, }, @@ -452,6 +529,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Gujarati', key: 'gu', ISO639_3: 'guj', + ISO639_1: 'gu', localized_label: 'ગુજરાતી', translationAvailable: false, }, @@ -459,6 +537,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Haitian Creole', key: 'ht', ISO639_3: 'hat', + ISO639_1: 'ht', localized_label: 'Haitian Creole', translationAvailable: false, }, @@ -467,6 +546,7 @@ const availableLanguages: LanguageSchema[] = [ key: 'ha', rtl: true, ISO639_3: 'hau', + ISO639_1: 'ha', localized_label: 'Hausa', translationAvailable: false, }, @@ -475,6 +555,7 @@ const availableLanguages: LanguageSchema[] = [ key: 'he', rtl: true, ISO639_3: 'heb', + ISO639_1: 'he', localized_label: 'עברית', translationAvailable: false, }, @@ -482,6 +563,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Herero', key: 'hz', ISO639_3: 'her', + ISO639_1: 'hz', localized_label: 'Herero', translationAvailable: false, }, @@ -489,6 +571,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Hindi', key: 'hi', ISO639_3: 'hin', + franc: 'hin', + elastic: 'hindi', + ISO639_1: 'hi', localized_label: 'हिन्दी', translationAvailable: false, }, @@ -496,6 +581,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Hiri Motu', key: 'ho', ISO639_3: 'hmo', + ISO639_1: 'ho', localized_label: 'Hiri Motu', translationAvailable: false, }, @@ -503,6 +589,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Hungarian', key: 'hu', ISO639_3: 'hun', + franc: 'hun', + elastic: 'hungarian', + ISO639_1: 'hu', localized_label: 'Magyar', translationAvailable: false, }, @@ -510,6 +599,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Icelandic', key: 'is', ISO639_3: 'isl', + ISO639_1: 'is', localized_label: 'Íslenska', translationAvailable: false, }, @@ -517,6 +607,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Ido', key: 'io', ISO639_3: 'ido', + ISO639_1: 'io', localized_label: 'Ido', translationAvailable: false, }, @@ -524,6 +615,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Igbo', key: 'ig', ISO639_3: 'ibo', + ISO639_1: 'ig', localized_label: 'Igbo', translationAvailable: false, }, @@ -531,6 +623,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Indonesian', key: 'in', ISO639_3: 'ind', + franc: 'ind', + elastic: 'indonesian', + ISO639_1: 'in', localized_label: 'Indonesia', translationAvailable: false, }, @@ -538,6 +633,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Interlingua', key: 'ia', ISO639_3: 'ina', + ISO639_1: 'ia', localized_label: 'Interlingua', translationAvailable: false, }, @@ -545,6 +641,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Interlingue', key: 'ie', ISO639_3: 'ile', + ISO639_1: 'ie', localized_label: 'Interlingue', translationAvailable: false, }, @@ -552,6 +649,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Inuktitut', key: 'iu', ISO639_3: 'iku', + ISO639_1: 'iu', localized_label: 'Inuktitut', translationAvailable: false, }, @@ -559,6 +657,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Inupiak', key: 'ik', ISO639_3: 'ipk', + ISO639_1: 'ik', localized_label: 'Inupiaq', translationAvailable: false, }, @@ -566,6 +665,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Irish', key: 'ga', ISO639_3: 'gle', + franc: 'gle', + elastic: 'irish', + ISO639_1: 'ga', localized_label: 'Gaeilge', translationAvailable: false, }, @@ -573,6 +675,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Italian', key: 'it', ISO639_3: 'ita', + franc: 'ita', + elastic: 'italian', + ISO639_1: 'it', localized_label: 'Italiano', translationAvailable: false, }, @@ -580,6 +685,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Japanese', key: 'ja', ISO639_3: 'jpn', + franc: 'cjk', + elastic: 'cjk', + ISO639_1: 'ja', localized_label: '日本語', translationAvailable: false, }, @@ -587,6 +695,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Javanese', key: 'jv', ISO639_3: 'jav', + ISO639_1: 'jv', localized_label: 'Jawa', translationAvailable: false, }, @@ -594,6 +703,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Kalaallisut, Greenlandic', key: 'kl', ISO639_3: 'kal', + ISO639_1: 'kl', localized_label: 'Kalaallisut', translationAvailable: false, }, @@ -601,6 +711,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Kannada', key: 'kn', ISO639_3: 'kan', + ISO639_1: 'kn', localized_label: 'ಕನ್ನಡ', translationAvailable: false, }, @@ -608,6 +719,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Kanuri', key: 'kr', ISO639_3: 'kau', + ISO639_1: 'kr', localized_label: 'Kanuri', translationAvailable: false, }, @@ -616,6 +728,7 @@ const availableLanguages: LanguageSchema[] = [ key: 'ks', rtl: true, ISO639_3: 'kas', + ISO639_1: 'ks', localized_label: 'کٲشُر', translationAvailable: false, }, @@ -623,6 +736,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Kazakh', key: 'kk', ISO639_3: 'kaz', + ISO639_1: 'kk', localized_label: 'Қазақ тілі', translationAvailable: false, }, @@ -630,6 +744,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Khmer', key: 'km', ISO639_3: 'khm', + ISO639_1: 'km', localized_label: 'ខ្មែរ', translationAvailable: false, }, @@ -637,6 +752,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Kikuyu', key: 'ki', ISO639_3: 'kik', + ISO639_1: 'ki', localized_label: 'Gikuyu', translationAvailable: false, }, @@ -644,6 +760,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Kinyarwanda (Rwanda)', key: 'rw', ISO639_3: 'kin', + ISO639_1: 'rw', localized_label: 'Kinyarwanda', translationAvailable: false, }, @@ -651,6 +768,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Kirundi', key: 'rn', ISO639_3: 'run', + ISO639_1: 'rn', localized_label: 'Ikirundi', translationAvailable: false, }, @@ -658,6 +776,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Kyrgyz', key: 'ky', ISO639_3: 'kir', + ISO639_1: 'ky', localized_label: 'Кыргызча', translationAvailable: false, }, @@ -665,6 +784,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Komi', key: 'kv', ISO639_3: 'kom', + ISO639_1: 'kv', localized_label: 'Komi', translationAvailable: false, }, @@ -672,6 +792,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Kongo', key: 'kg', ISO639_3: 'kon', + ISO639_1: 'kg', localized_label: 'Kongo', translationAvailable: false, }, @@ -679,6 +800,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Korean', key: 'ko', ISO639_3: 'kor', + franc: 'cjk', + elastic: 'cjk', + ISO639_1: 'ko', localized_label: '한국어', translationAvailable: false, }, @@ -687,6 +811,9 @@ const availableLanguages: LanguageSchema[] = [ key: 'ku', rtl: true, ISO639_3: 'kur', + franc: 'ckb', + elastic: 'sorani', + ISO639_1: 'ku', localized_label: 'Kurdî', translationAvailable: false, }, @@ -694,6 +821,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Kwanyama', key: 'kj', ISO639_3: 'kua', + ISO639_1: 'kj', localized_label: 'Kuanyama', translationAvailable: false, }, @@ -701,6 +829,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Lao', key: 'lo', ISO639_3: 'lao', + ISO639_1: 'lo', localized_label: 'ລາວ', translationAvailable: false, }, @@ -708,6 +837,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Latin', key: 'la', ISO639_3: 'lat', + ISO639_1: 'la', localized_label: 'Latin', translationAvailable: false, }, @@ -715,6 +845,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Latvian (Lettish)', key: 'lv', ISO639_3: 'lav', + franc: 'lav', + elastic: 'latvian', + ISO639_1: 'lv', localized_label: 'Latviešu', translationAvailable: false, }, @@ -722,6 +855,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Limburgish (Limburger)', key: 'li', ISO639_3: 'lim', + ISO639_1: 'li', localized_label: 'Limburgish', translationAvailable: false, }, @@ -729,6 +863,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Lingala', key: 'ln', ISO639_3: 'lin', + ISO639_1: 'ln', localized_label: 'Lingála', translationAvailable: false, }, @@ -736,6 +871,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Lithuanian', key: 'lt', ISO639_3: 'lit', + franc: 'lit', + elastic: 'lithuanian', + ISO639_1: 'lt', localized_label: 'Lietuvių', translationAvailable: false, }, @@ -743,6 +881,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Luga-Katanga', key: 'lu', ISO639_3: 'lub', + ISO639_1: 'lu', localized_label: 'Tshiluba', translationAvailable: false, }, @@ -750,6 +889,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Luganda, Ganda', key: 'lg', ISO639_3: 'lug', + ISO639_1: 'lg', localized_label: 'Luganda', translationAvailable: false, }, @@ -757,6 +897,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Luxembourgish', key: 'lb', ISO639_3: 'ltz', + ISO639_1: 'lb', localized_label: 'Lëtzebuergesch', translationAvailable: false, }, @@ -764,6 +905,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Macedonian', key: 'mk', ISO639_3: 'mkd', + ISO639_1: 'mk', localized_label: 'Македонски', translationAvailable: false, }, @@ -771,6 +913,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Malagasy', key: 'mg', ISO639_3: 'mlg', + ISO639_1: 'mg', localized_label: 'Malagasy', translationAvailable: false, }, @@ -778,6 +921,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Malay', key: 'ms', ISO639_3: 'msa', + ISO639_1: 'ms', localized_label: 'Melayu', translationAvailable: false, }, @@ -785,6 +929,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Malayalam', key: 'ml', ISO639_3: 'mal', + ISO639_1: 'ml', localized_label: 'മലയാളം', translationAvailable: false, }, @@ -792,6 +937,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Maltese', key: 'mt', ISO639_3: 'mlt', + ISO639_1: 'mt', localized_label: 'Malti', translationAvailable: false, }, @@ -799,6 +945,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Maori', key: 'mi', ISO639_3: 'mri', + ISO639_1: 'mi', localized_label: 'Te reo Māori', translationAvailable: false, }, @@ -806,6 +953,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Marathi', key: 'mr', ISO639_3: 'mar', + ISO639_1: 'mr', localized_label: 'मराठी', translationAvailable: false, }, @@ -813,6 +961,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Marshallese', key: 'mh', ISO639_3: 'mah', + ISO639_1: 'mh', localized_label: 'Marshallese', translationAvailable: false, }, @@ -820,6 +969,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Mongolian', key: 'mn', ISO639_3: 'mon', + ISO639_1: 'mn', localized_label: 'Монгол', translationAvailable: false, }, @@ -827,6 +977,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Nauru', key: 'na', ISO639_3: 'nau', + ISO639_1: 'na', localized_label: 'Nauru', translationAvailable: false, }, @@ -834,6 +985,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Navajo', key: 'nv', ISO639_3: 'nav', + ISO639_1: 'nv', localized_label: 'Navajo', translationAvailable: false, }, @@ -841,6 +993,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Ndonga', key: 'ng', ISO639_3: 'ndo', + ISO639_1: 'ng', localized_label: 'Ndonga', translationAvailable: false, }, @@ -848,6 +1001,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Northern Ndebele', key: 'nd', ISO639_3: 'nde', + ISO639_1: 'nd', localized_label: 'IsiNdebele', translationAvailable: false, }, @@ -855,6 +1009,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Nepali', key: 'ne', ISO639_3: 'nep', + ISO639_1: 'ne', localized_label: 'नेपाली', translationAvailable: false, }, @@ -862,6 +1017,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Norwegian', key: 'no', ISO639_3: 'nor', + ISO639_1: 'no', localized_label: 'Norsk', translationAvailable: false, }, @@ -869,6 +1025,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Norwegian bokmål', key: 'nb', ISO639_3: 'nob', + franc: 'nob', + elastic: 'norwegian', + ISO639_1: 'nb', localized_label: 'Norsk bokmål', translationAvailable: false, }, @@ -876,6 +1035,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Norwegian nynorsk', key: 'nn', ISO639_3: 'nno', + franc: 'nno', + elastic: 'norwegian', + ISO639_1: 'nn', localized_label: 'Norsk nynorsk', translationAvailable: false, }, @@ -883,6 +1045,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Occitan', key: 'oc', ISO639_3: 'oci', + ISO639_1: 'oc', localized_label: 'Occitan', translationAvailable: false, }, @@ -890,6 +1053,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Ojibwe', key: 'oj', ISO639_3: 'oji', + ISO639_1: 'oj', localized_label: 'Ojibwa', translationAvailable: false, }, @@ -897,6 +1061,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Old Church Slavonic, Old Bulgarian', key: 'cu', ISO639_3: 'chu', + ISO639_1: 'cu', localized_label: 'Church Slavic', translationAvailable: false, }, @@ -904,6 +1069,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Oriya', key: 'or', ISO639_3: 'ori', + ISO639_1: 'or', localized_label: 'ଓଡ଼ିଆ', translationAvailable: false, }, @@ -911,6 +1077,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Oromo (Afaan Oromo)', key: 'om', ISO639_3: 'orm', + ISO639_1: 'om', localized_label: 'Oromoo', translationAvailable: false, }, @@ -918,6 +1085,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Ossetian', key: 'os', ISO639_3: 'oss', + ISO639_1: 'os', localized_label: 'Ирон', translationAvailable: false, }, @@ -925,6 +1093,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Pāli', key: 'pi', ISO639_3: 'pli', + ISO639_1: 'pi', localized_label: 'Pali', translationAvailable: false, }, @@ -933,6 +1102,7 @@ const availableLanguages: LanguageSchema[] = [ key: 'ps', rtl: true, ISO639_3: 'pus', + ISO639_1: 'ps', localized_label: 'پښتو', translationAvailable: false, }, @@ -941,6 +1111,9 @@ const availableLanguages: LanguageSchema[] = [ key: 'fa', rtl: true, ISO639_3: 'fas', + franc: 'fas', + elastic: 'persian', + ISO639_1: 'fa', localized_label: 'فارسی', translationAvailable: false, }, @@ -948,6 +1121,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Polish', key: 'pl', ISO639_3: 'pol', + ISO639_1: 'pl', localized_label: 'Polski', translationAvailable: false, }, @@ -955,6 +1129,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Portuguese', key: 'pt', ISO639_3: 'por', + franc: 'por', + elastic: 'portuguese', + ISO639_1: 'pt', localized_label: 'Português', translationAvailable: false, }, @@ -962,6 +1139,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Punjabi (Eastern)', key: 'pa', ISO639_3: 'pan', + ISO639_1: 'pa', localized_label: 'ਪੰਜਾਬੀ', translationAvailable: false, }, @@ -969,6 +1147,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Quechua', key: 'qu', ISO639_3: 'que', + ISO639_1: 'qu', localized_label: 'Runasimi', translationAvailable: false, }, @@ -976,6 +1155,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Romansh', key: 'rm', ISO639_3: 'roh', + ISO639_1: 'rm', localized_label: 'Rumantsch', translationAvailable: false, }, @@ -983,6 +1163,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Romanian/Moldavian', key: 'ro', ISO639_3: 'ron', + franc: 'ron', + elastic: 'romanian', + ISO639_1: 'ro', localized_label: 'Română', translationAvailable: false, }, @@ -990,6 +1173,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Russian', key: 'ru', ISO639_3: 'rus', + franc: 'rus', + elastic: 'russian', + ISO639_1: 'ru', localized_label: 'Русский', translationAvailable: false, }, @@ -997,6 +1183,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Sami', key: 'se', ISO639_3: 'sme', + ISO639_1: 'se', localized_label: 'Davvisámegiella', translationAvailable: false, }, @@ -1004,6 +1191,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Samoan', key: 'sm', ISO639_3: 'smo', + ISO639_1: 'sm', localized_label: 'Samoan', translationAvailable: false, }, @@ -1011,6 +1199,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Sango', key: 'sg', ISO639_3: 'sag', + ISO639_1: 'sg', localized_label: 'Sängö', translationAvailable: false, }, @@ -1018,6 +1207,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Sanskrit', key: 'sa', ISO639_3: 'san', + ISO639_1: 'sa', localized_label: 'संस्कृत भाषा', translationAvailable: false, }, @@ -1025,6 +1215,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Serbian', key: 'sr', ISO639_3: 'srp', + ISO639_1: 'sr', localized_label: 'Српски', translationAvailable: false, }, @@ -1032,6 +1223,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Serbo-Croatian', key: 'sh', ISO639_3: 'hbs', + ISO639_1: 'sh', localized_label: 'Srpski (latinica)', translationAvailable: false, }, @@ -1039,6 +1231,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Sesotho', key: 'st', ISO639_3: 'sot', + ISO639_1: 'st', localized_label: 'Southern Sotho', translationAvailable: false, }, @@ -1046,6 +1239,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Setswana', key: 'tn', ISO639_3: 'tsn', + ISO639_1: 'tn', localized_label: 'Tswana', translationAvailable: false, }, @@ -1053,6 +1247,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Shona', key: 'sn', ISO639_3: 'sna', + ISO639_1: 'sn', localized_label: 'ChiShona', translationAvailable: false, }, @@ -1060,6 +1255,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Sichuan Yi, Nuosu', key: 'ii', ISO639_3: 'iii', + ISO639_1: 'ii', localized_label: 'ꆈꌠꉙ', translationAvailable: false, }, @@ -1067,6 +1263,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Sindhi', key: 'sd', ISO639_3: 'snd', + ISO639_1: 'sd', localized_label: 'سنڌي', translationAvailable: false, }, @@ -1074,6 +1271,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Sinhalese', key: 'si', ISO639_3: 'sin', + ISO639_1: 'si', localized_label: 'සිංහල', translationAvailable: false, }, @@ -1081,6 +1279,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Siswati, Swati', key: 'ss', ISO639_3: 'ssw', + ISO639_1: 'ss', localized_label: 'Swati', translationAvailable: false, }, @@ -1088,6 +1287,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Slovak', key: 'sk', ISO639_3: 'slk', + ISO639_1: 'sk', localized_label: 'Slovenčina', translationAvailable: false, }, @@ -1095,6 +1295,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Slovenian', key: 'sl', ISO639_3: 'slv', + ISO639_1: 'sl', localized_label: 'Slovenščina', translationAvailable: false, }, @@ -1102,6 +1303,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Somali', key: 'so', ISO639_3: 'som', + ISO639_1: 'so', localized_label: 'Soomaali', translationAvailable: false, }, @@ -1109,6 +1311,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Southern Ndebele', key: 'nr', ISO639_3: 'nbl', + ISO639_1: 'nr', localized_label: 'South Ndebele', translationAvailable: false, }, @@ -1116,6 +1319,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Spanish', key: 'es', ISO639_3: 'spa', + franc: 'spa', + elastic: 'spanish', + ISO639_1: 'es', localized_label: 'Español', translationAvailable: false, }, @@ -1123,6 +1329,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Sundanese', key: 'su', ISO639_3: 'sun', + ISO639_1: 'su', localized_label: 'Basa Sunda', translationAvailable: false, }, @@ -1130,6 +1337,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Swahili (Kiswahili)', key: 'sw', ISO639_3: 'swa', + ISO639_1: 'sw', localized_label: 'Kiswahili', translationAvailable: false, }, @@ -1137,6 +1345,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Swedish', key: 'sv', ISO639_3: 'swe', + franc: 'swe', + elastic: 'swedish', + ISO639_1: 'sv', localized_label: 'Svenska', translationAvailable: false, }, @@ -1144,6 +1355,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Tagalog', key: 'tl', ISO639_3: 'tgl', + ISO639_1: 'tl', localized_label: 'Filipino', translationAvailable: false, }, @@ -1151,6 +1363,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Tahitian', key: 'ty', ISO639_3: 'tah', + ISO639_1: 'ty', localized_label: 'Tahitian', translationAvailable: false, }, @@ -1158,6 +1371,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Tajik', key: 'tg', ISO639_3: 'tgk', + ISO639_1: 'tg', localized_label: 'Тоҷикӣ', translationAvailable: false, }, @@ -1165,6 +1379,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Tamil', key: 'ta', ISO639_3: 'tam', + ISO639_1: 'ta', localized_label: 'தமிழ்', translationAvailable: false, }, @@ -1172,6 +1387,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Tatar', key: 'tt', ISO639_3: 'tat', + ISO639_1: 'tt', localized_label: 'Татар', translationAvailable: false, }, @@ -1179,6 +1395,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Telugu', key: 'te', ISO639_3: 'tel', + ISO639_1: 'te', localized_label: 'తెలుగు', translationAvailable: false, }, @@ -1186,6 +1403,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Thai', key: 'th', ISO639_3: 'tha', + franc: 'tha', + elastic: 'thai', + ISO639_1: 'th', localized_label: 'ไทย', translationAvailable: false, }, @@ -1193,6 +1413,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Tibetan', key: 'bo', ISO639_3: 'bod', + ISO639_1: 'bo', localized_label: 'བོད་སྐད་', translationAvailable: false, }, @@ -1200,6 +1421,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Tigrinya', key: 'ti', ISO639_3: 'tir', + ISO639_1: 'ti', localized_label: 'ትግርኛ', translationAvailable: false, }, @@ -1207,6 +1429,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Tonga', key: 'to', ISO639_3: 'ton', + ISO639_1: 'to', localized_label: 'Lea fakatonga', translationAvailable: false, }, @@ -1214,6 +1437,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Tsonga', key: 'ts', ISO639_3: 'tso', + ISO639_1: 'ts', localized_label: 'Tsonga', translationAvailable: false, }, @@ -1221,6 +1445,9 @@ const availableLanguages: LanguageSchema[] = [ label: 'Turkish', key: 'tr', ISO639_3: 'tur', + franc: 'tur', + elastic: 'turkish', + ISO639_1: 'tr', localized_label: 'Türkçe', translationAvailable: false, }, @@ -1228,6 +1455,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Turkmen', key: 'tk', ISO639_3: 'tuk', + ISO639_1: 'tk', localized_label: 'Türkmen dili', translationAvailable: false, }, @@ -1235,6 +1463,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Twi', key: 'tw', ISO639_3: 'twi', + ISO639_1: 'tw', localized_label: 'Akan', translationAvailable: false, }, @@ -1242,6 +1471,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Uyghur', key: 'ug', ISO639_3: 'uig', + ISO639_1: 'ug', localized_label: 'ئۇيغۇرچە', translationAvailable: false, }, @@ -1249,6 +1479,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Ukrainian', key: 'uk', ISO639_3: 'ukr', + ISO639_1: 'uk', localized_label: 'Українська', translationAvailable: false, }, @@ -1257,6 +1488,7 @@ const availableLanguages: LanguageSchema[] = [ key: 'ur', rtl: true, ISO639_3: 'urd', + ISO639_1: 'ur', localized_label: 'اردو', translationAvailable: false, }, @@ -1264,6 +1496,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Uzbek', key: 'uz', ISO639_3: 'uzb', + ISO639_1: 'uz', localized_label: 'O‘zbek', translationAvailable: false, }, @@ -1271,6 +1504,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Venda', key: 've', ISO639_3: 'ven', + ISO639_1: 've', localized_label: 'Venda', translationAvailable: false, }, @@ -1278,6 +1512,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Vietnamese', key: 'vi', ISO639_3: 'vie', + ISO639_1: 'vi', localized_label: 'Tiếng Việt', translationAvailable: false, }, @@ -1285,6 +1520,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Volapük', key: 'vo', ISO639_3: 'vol', + ISO639_1: 'vo', localized_label: 'Volapük', translationAvailable: false, }, @@ -1292,6 +1528,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Wallon', key: 'wa', ISO639_3: 'wln', + ISO639_1: 'wa', localized_label: 'Walloon', translationAvailable: false, }, @@ -1299,6 +1536,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Welsh', key: 'cy', ISO639_3: 'cym', + ISO639_1: 'cy', localized_label: 'Cymraeg', translationAvailable: false, }, @@ -1306,6 +1544,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Wolof', key: 'wo', ISO639_3: 'wol', + ISO639_1: 'wo', localized_label: 'Wolof', translationAvailable: false, }, @@ -1313,6 +1552,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Western Frisian', key: 'fy', ISO639_3: 'fry', + ISO639_1: 'fy', localized_label: 'Frysk', translationAvailable: false, }, @@ -1320,6 +1560,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Xhosa', key: 'xh', ISO639_3: 'xho', + ISO639_1: 'xh', localized_label: 'IsiXhosa', translationAvailable: false, }, @@ -1328,6 +1569,7 @@ const availableLanguages: LanguageSchema[] = [ key: 'yi', rtl: true, ISO639_3: 'yid', + ISO639_1: 'yi', localized_label: 'ייִדיש', translationAvailable: false, }, @@ -1335,6 +1577,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Yoruba', key: 'yo', ISO639_3: 'yor', + ISO639_1: 'yo', localized_label: 'Èdè Yorùbá', translationAvailable: false, }, @@ -1342,6 +1585,7 @@ const availableLanguages: LanguageSchema[] = [ label: 'Zhuang, Chuang', key: 'za', ISO639_3: 'zha', + ISO639_1: 'za', localized_label: 'Zhuang', translationAvailable: false, }, @@ -1349,16 +1593,52 @@ const availableLanguages: LanguageSchema[] = [ label: 'Zulu', key: 'zu', ISO639_3: 'zul', + ISO639_1: 'zu', localized_label: 'IsiZulu', translationAvailable: false, }, ]; -const language = (key: string, purpose: keyof (typeof elasticLanguages)[number] = 'elastic') => { - const defaultValue = purpose !== 'ISO639_1' ? 'other' : null; - return elasticLanguages[key] ? elasticLanguages[key][purpose] : defaultValue; +const languageMapper = (ISO639_3: string, to: LanguageCode = 'elastic') => { + const language = availableLanguages.find(item => item.ISO639_3 === ISO639_3); + const defaultValue = to !== 'ISO639_1' ? undefinedLanguage.ISO639_3 : null; + + return language?.[to] || defaultValue; }; -const availableLanguagesISO6391 = availableLanguages.map(l => l.key); +const getLanguagesByCode = (code: LanguageCode = 'elastic'): Language[] => + availableLanguages + .filter(item => Boolean(item[code])) + .map(item => ({ value: item[code] as string, label: item.label })); + +const getLanguageCodes = (languages: Language[]): string[] => languages.map(item => item.value); -export { elasticLanguages, availableLanguages, language, availableLanguagesISO6391 }; +const getLanguageSchema = (ISO639_3: string) => + availableLanguages.find(item => item.ISO639_3 === ISO639_3) || undefinedLanguage; + +const ISO6391Languages = getLanguagesByCode('ISO639_1'); +const ISO6391Codes = getLanguageCodes(ISO6391Languages); + +const elasticLanguages: LegacyElasticObject = availableLanguages + .filter(item => Boolean(item?.elastic && item?.franc)) + .reduce( + (prev, next) => ({ + ...prev, + [next.franc!]: { + franc: next.franc!, + elastic: next.elastic!, + ISO639_1: ['cjk', 'ckb'].includes(next.franc!) ? null : next?.ISO639_1 || null, + }, + }), + {} as LegacyElasticObject + ); + +export type { LanguageCode }; + +export { + elasticLanguages, + availableLanguages, + ISO6391Codes, + languageMapper as language, + getLanguageSchema, +}; diff --git a/app/shared/specs/languages.spec.js b/app/shared/specs/languages.spec.js index 415396b8ea..97acbb591f 100644 --- a/app/shared/specs/languages.spec.js +++ b/app/shared/specs/languages.spec.js @@ -10,8 +10,9 @@ describe('languages', () => { it('should return a list of all languages for the passed purpose', () => { expect(languages.getAll('ISO639_1').length).toBe(31); - expect(languages.getAll('ISO639_1')[5]).toBe(languages.data[7].ISO639_1); expect(languages.getAll('franc').length).toBe(33); + + expect(languages.getAll('ISO639_1')[5]).toBe(languages.data[6].ISO639_1); expect(languages.getAll('franc')[5]).toBe(languages.data[5].franc); }); }); diff --git a/app/shared/types/commonSchemas.ts b/app/shared/types/commonSchemas.ts index ac5ca36498..17fccc396e 100644 --- a/app/shared/types/commonSchemas.ts +++ b/app/shared/types/commonSchemas.ts @@ -251,6 +251,9 @@ export const languageSchema = { rtl: { type: 'boolean' }, default: { type: 'boolean' }, ISO639_3: { type: 'string' }, + franc: { type: 'string' }, + elastic: { type: 'string' }, + ISO639_1: { type: 'string' }, localized_label: { type: 'string' }, translationAvailable: { type: 'boolean' }, }, diff --git a/app/shared/types/commonTypes.d.ts b/app/shared/types/commonTypes.d.ts index 6c9af220d6..d0edf3b932 100644 --- a/app/shared/types/commonTypes.d.ts +++ b/app/shared/types/commonTypes.d.ts @@ -244,6 +244,9 @@ export interface LanguageSchema { rtl?: boolean; default?: boolean; ISO639_3?: string; + franc?: string; + elastic?: string; + ISO639_1?: string; localized_label?: string; translationAvailable?: boolean; } @@ -255,6 +258,9 @@ export type LanguagesListSchema = { rtl?: boolean; default?: boolean; ISO639_3?: string; + franc?: string; + elastic?: string; + ISO639_1?: string; localized_label?: string; translationAvailable?: boolean; }[];