mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-05 13:02:54 +00:00
730 lines
12 KiB
TypeScript
730 lines
12 KiB
TypeScript
/*
|
|
* Copyright (C) 2019 StApps
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the Free
|
|
* Software Foundation, version 3.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
* more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with
|
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
/**
|
|
* An Language
|
|
*/
|
|
export interface SCLanguage {
|
|
/**
|
|
* The two letter ISO 639-1 Code of the Language
|
|
*
|
|
* @filterable
|
|
*/
|
|
code: SCLanguageCode;
|
|
|
|
/**
|
|
* The Fulltext name of the Language
|
|
*
|
|
* @filterable
|
|
*/
|
|
name: SCLanguageName;
|
|
}
|
|
|
|
/**
|
|
* A list of possible languages in english
|
|
*
|
|
* @see https://en.wikipedia.org/wiki/ISO_639-1
|
|
*/
|
|
export type SCLanguageName =
|
|
'afar'
|
|
| 'abkhazian'
|
|
| 'avestan'
|
|
| 'afrikaans'
|
|
| 'akan'
|
|
| 'amharic'
|
|
| 'aragonese'
|
|
| 'arabic'
|
|
| 'assamese'
|
|
| 'avaric'
|
|
| 'aymara'
|
|
| 'azerbaijani'
|
|
| 'bashkir'
|
|
| 'belarusian'
|
|
| 'bulgarian'
|
|
| 'bihari languages'
|
|
| 'bislama'
|
|
| 'bambara'
|
|
| 'bengali'
|
|
| 'tibetan'
|
|
| 'breton'
|
|
| 'bosnian'
|
|
| 'catalan; valencian'
|
|
| 'chechen'
|
|
| 'chamorro'
|
|
| 'corsican'
|
|
| 'cree'
|
|
| 'czech'
|
|
| 'church slavic; old slavonic; church slavonic; old bulgarian; old church slavonic'
|
|
| 'chuvash'
|
|
| 'welsh'
|
|
| 'danish'
|
|
| 'german'
|
|
| 'divehi; dhivehi; maldivian'
|
|
| 'dzongkha'
|
|
| 'ewe'
|
|
| 'greek, modern (1453-)'
|
|
| 'english'
|
|
| 'esperanto'
|
|
| 'spanish; castilian'
|
|
| 'estonian'
|
|
| 'basque'
|
|
| 'persian'
|
|
| 'fulah'
|
|
| 'finnish'
|
|
| 'fijian'
|
|
| 'filipino'
|
|
| 'faroese'
|
|
| 'french'
|
|
| 'western frisian'
|
|
| 'irish'
|
|
| 'gaelic; scottish gaelic'
|
|
| 'galician'
|
|
| 'guarani'
|
|
| 'gujarati'
|
|
| 'manx'
|
|
| 'hausa'
|
|
| 'hebrew'
|
|
| 'hindi'
|
|
| 'hiri motu'
|
|
| 'croatian'
|
|
| 'haitian; haitian creole'
|
|
| 'hungarian'
|
|
| 'armenian'
|
|
| 'herero'
|
|
| 'interlingua (international auxiliary language association)'
|
|
| 'indonesian'
|
|
| 'interlingue; occidental'
|
|
| 'igbo'
|
|
| 'sichuan yi; nuosu'
|
|
| 'inupiaq'
|
|
| 'ido'
|
|
| 'icelandic'
|
|
| 'italian'
|
|
| 'inuktitut'
|
|
| 'japanese'
|
|
| 'javanese'
|
|
| 'georgian'
|
|
| 'kongo'
|
|
| 'kikuyu; gikuyu'
|
|
| 'kuanyama; kwanyama'
|
|
| 'kazakh'
|
|
| 'kalaallisut; greenlandic'
|
|
| 'central khmer'
|
|
| 'kannada'
|
|
| 'korean'
|
|
| 'kanuri'
|
|
| 'kashmiri'
|
|
| 'kurdish'
|
|
| 'komi'
|
|
| 'cornish'
|
|
| 'kirghiz; kyrgyz'
|
|
| 'latin'
|
|
| 'luxembourgish; letzeburgesch'
|
|
| 'ganda'
|
|
| 'limburgan; limburger; limburgish'
|
|
| 'lingala'
|
|
| 'lao'
|
|
| 'lithuanian'
|
|
| 'luba-katanga'
|
|
| 'latvian'
|
|
| 'malagasy'
|
|
| 'marshallese'
|
|
| 'maori'
|
|
| 'macedonian'
|
|
| 'malayalam'
|
|
| 'mongolian'
|
|
| 'marathi'
|
|
| 'malay'
|
|
| 'maltese'
|
|
| 'burmese'
|
|
| 'nauru'
|
|
| 'bokmål, norwegian; norwegian bokmål'
|
|
| 'ndebele, north; north ndebele'
|
|
| 'nepali'
|
|
| 'ndonga'
|
|
| 'dutch; flemish'
|
|
| 'norwegian nynorsk; nynorsk, norwegian'
|
|
| 'norwegian'
|
|
| 'ndebele, south; south ndebele'
|
|
| 'navajo; navaho'
|
|
| 'chichewa; chewa; nyanja'
|
|
| 'occitan (post 1500); provençal'
|
|
| 'ojibwa'
|
|
| 'oromo'
|
|
| 'oriya'
|
|
| 'ossetian; ossetic'
|
|
| 'panjabi; punjabi'
|
|
| 'pali'
|
|
| 'polish'
|
|
| 'pushto; pashto'
|
|
| 'portuguese'
|
|
| 'quechua'
|
|
| 'romansh'
|
|
| 'rundi'
|
|
| 'romanian; moldavian; moldovan'
|
|
| 'russian'
|
|
| 'kinyarwanda'
|
|
| 'sanskrit'
|
|
| 'sardinian'
|
|
| 'sindhi'
|
|
| 'northern sami'
|
|
| 'sango'
|
|
| 'sinhala; sinhalese'
|
|
| 'slovak'
|
|
| 'slovenian'
|
|
| 'samoan'
|
|
| 'shona'
|
|
| 'somali'
|
|
| 'albanian'
|
|
| 'serbian'
|
|
| 'swati'
|
|
| 'sotho, southern'
|
|
| 'sundanese'
|
|
| 'swedish'
|
|
| 'swahili'
|
|
| 'tamil'
|
|
| 'telugu'
|
|
| 'tajik'
|
|
| 'thai'
|
|
| 'tigrinya'
|
|
| 'turkmen'
|
|
| 'tagalog'
|
|
| 'tswana'
|
|
| 'tonga (tonga islands)'
|
|
| 'turkish'
|
|
| 'tsonga'
|
|
| 'tatar'
|
|
| 'twi'
|
|
| 'tahitian'
|
|
| 'uighur; uyghur'
|
|
| 'ukrainian'
|
|
| 'urdu'
|
|
| 'uzbek'
|
|
| 'venda'
|
|
| 'vietnamese'
|
|
| 'volapük'
|
|
| 'walloon'
|
|
| 'wolof'
|
|
| 'xhosa'
|
|
| 'yiddish'
|
|
| 'yoruba'
|
|
| 'zhuang; chuang'
|
|
| 'chinese'
|
|
| 'zulu';
|
|
|
|
/**
|
|
* A List of all possible Languages as ISO 639-1 Codes
|
|
*
|
|
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
|
*/
|
|
export type SCLanguageCode =
|
|
'aa'
|
|
| 'ab'
|
|
| 'ae'
|
|
| 'af'
|
|
| 'ak'
|
|
| 'am'
|
|
| 'an'
|
|
| 'ar'
|
|
| 'as'
|
|
| 'av'
|
|
| 'ay'
|
|
| 'az'
|
|
| 'ba'
|
|
| 'be'
|
|
| 'bg'
|
|
| 'bh'
|
|
| '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'
|
|
| 'fl'
|
|
| 'fo'
|
|
| 'fr'
|
|
| 'fy'
|
|
| 'ga'
|
|
| 'gd'
|
|
| 'gl'
|
|
| 'gn'
|
|
| 'gu'
|
|
| 'gv'
|
|
| 'ha'
|
|
| 'he'
|
|
| 'hi'
|
|
| 'ho'
|
|
| 'hr'
|
|
| 'ht'
|
|
| 'hu'
|
|
| 'hy'
|
|
| 'hz'
|
|
| 'ia'
|
|
| 'id'
|
|
| 'ia'
|
|
| 'ig'
|
|
| 'ii'
|
|
| 'ik'
|
|
| 'io'
|
|
| 'is'
|
|
| 'it'
|
|
| 'iu'
|
|
| 'ja'
|
|
| 'jv'
|
|
|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
|
| 'ur'
|
|
| 'uz'
|
|
| 've'
|
|
| 'vi'
|
|
| 'vo'
|
|
| 'wa'
|
|
| 'wo'
|
|
| 'xh'
|
|
| 'yi'
|
|
| 'yo'
|
|
| 'za'
|
|
| 'zh'
|
|
| 'zu';
|
|
|
|
/**
|
|
* A list of possible nationalities
|
|
*
|
|
* @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
*/
|
|
export type SCNationality =
|
|
'Afghanistan'
|
|
| 'Åland Islands'
|
|
| 'Albania'
|
|
| 'Algeria'
|
|
| 'American Samoa'
|
|
| 'Andorra'
|
|
| 'Angola'
|
|
| 'Anguilla'
|
|
| 'Antarctica'
|
|
| 'Antigua and Barbuda'
|
|
| 'Argentina'
|
|
| 'Armenia'
|
|
| 'Aruba'
|
|
| 'Australia'
|
|
| 'Austria'
|
|
| 'Azerbaijan'
|
|
| 'Bahamas'
|
|
| 'Bahrain'
|
|
| 'Bangladesh'
|
|
| 'Barbados'
|
|
| 'Belarus'
|
|
| 'Belgium'
|
|
| 'Belize'
|
|
| 'Benin'
|
|
| 'Bermuda'
|
|
| 'Bhutan'
|
|
| 'Bolivia (Plurinational State of)'
|
|
| 'Bonaire, Sint Eustatius and Saba'
|
|
| 'Bosnia and Herzegovina'
|
|
| 'Botswana'
|
|
| 'Bouvet Island'
|
|
| 'Brazil'
|
|
| 'British Indian Ocean Territory'
|
|
| 'Brunei Darussalam'
|
|
| 'Bulgaria'
|
|
| 'Burkina Faso'
|
|
| 'Burundi'
|
|
| 'Cambodia'
|
|
| 'Cameroon'
|
|
| 'Canada'
|
|
| 'Cabo Verde'
|
|
| 'Cayman Islands'
|
|
| 'Central African Republic'
|
|
| 'Chad'
|
|
| 'Chile'
|
|
| 'China'
|
|
| 'Christmas Island'
|
|
| 'Cocos (Keeling) Islands'
|
|
| 'Colombia'
|
|
| 'Comoros'
|
|
| 'Congo'
|
|
| 'Congo (Democratic Republic of the)'
|
|
| 'Cook Islands'
|
|
| 'Costa Rica'
|
|
| 'Côte d\'Ivoire'
|
|
| 'Croatia'
|
|
| 'Cuba'
|
|
| 'Curaçao'
|
|
| 'Cyprus'
|
|
| 'Czech Republic'
|
|
| 'Denmark'
|
|
| 'Djibouti'
|
|
| 'Dominica'
|
|
| 'Dominican Republic'
|
|
| 'Ecuador'
|
|
| 'Egypt'
|
|
| 'El Salvador'
|
|
| 'Equatorial Guinea'
|
|
| 'Eritrea'
|
|
| 'Estonia'
|
|
| 'Ethiopia'
|
|
| 'Falkland Islands (Malvinas)'
|
|
| 'Faroe Islands'
|
|
| 'Fiji'
|
|
| 'Finland'
|
|
| 'France'
|
|
| 'French Guiana'
|
|
| 'French Polynesia'
|
|
| 'French Southern Territories'
|
|
| 'Gabon'
|
|
| 'Gambia'
|
|
| 'Georgia'
|
|
| 'Germany'
|
|
| 'Ghana'
|
|
| 'Gibraltar'
|
|
| 'Greece'
|
|
| 'Greenland'
|
|
| 'Grenada'
|
|
| 'Guadeloupe'
|
|
| 'Guam'
|
|
| 'Guatemala'
|
|
| 'Guernsey'
|
|
| 'Guinea'
|
|
| 'Guinea-Bissau'
|
|
| 'Guyana'
|
|
| 'Haiti'
|
|
| 'Heard Island and McDonald Islands'
|
|
| 'Holy See'
|
|
| 'Honduras'
|
|
| 'Hong Kong'
|
|
| 'Hungary'
|
|
| 'Iceland'
|
|
| 'India'
|
|
| 'Indonesia'
|
|
| 'Iran (Islamic Republic of)'
|
|
| 'Iraq'
|
|
| 'Ireland'
|
|
| 'Isle of Man'
|
|
| 'Israel'
|
|
| 'Italy'
|
|
| 'Jamaica'
|
|
| 'Japan'
|
|
| 'Jersey'
|
|
| 'Jordan'
|
|
| 'Kazakhstan'
|
|
| 'Kenya'
|
|
| 'Kiribati'
|
|
| 'Korea (Democratic People\'s Republic of)'
|
|
| 'Korea (Republic of)'
|
|
| 'Kuwait'
|
|
| 'Kyrgyzstan'
|
|
| 'Lao People\'s Democratic Republic'
|
|
| 'Latvia'
|
|
| 'Lebanon'
|
|
| 'Lesotho'
|
|
| 'Liberia'
|
|
| 'Libya'
|
|
| 'Liechtenstein'
|
|
| 'Lithuania'
|
|
| 'Luxembourg'
|
|
| 'Macao'
|
|
| 'Macedonia (the former Yugoslav Republic of)'
|
|
| 'Madagascar'
|
|
| 'Malawi'
|
|
| 'Malaysia'
|
|
| 'Maldives'
|
|
| 'Mali'
|
|
| 'Malta'
|
|
| 'Marshall Islands'
|
|
| 'Martinique'
|
|
| 'Mauritania'
|
|
| 'Mauritius'
|
|
| 'Mayotte'
|
|
| 'Mexico'
|
|
| 'Micronesia (Federated States of)'
|
|
| 'Moldova (Republic of)'
|
|
| 'Monaco'
|
|
| 'Mongolia'
|
|
| 'Montenegro'
|
|
| 'Montserrat'
|
|
| 'Morocco'
|
|
| 'Mozambique'
|
|
| 'Myanmar'
|
|
| 'Namibia'
|
|
| 'Nauru'
|
|
| 'Nepal'
|
|
| 'Netherlands'
|
|
| 'New Caledonia'
|
|
| 'New Zealand'
|
|
| 'Nicaragua'
|
|
| 'Niger'
|
|
| 'Nigeria'
|
|
| 'Niue'
|
|
| 'Norfolk Island'
|
|
| 'Northern Mariana Islands'
|
|
| 'Norway'
|
|
| 'Oman'
|
|
| 'Pakistan'
|
|
| 'Palau'
|
|
| 'Palestine, State of'
|
|
| 'Panama'
|
|
| 'Papua New Guinea'
|
|
| 'Paraguay'
|
|
| 'Peru'
|
|
| 'Philippines'
|
|
| 'Pitcairn'
|
|
| 'Poland'
|
|
| 'Portugal'
|
|
| 'Puerto Rico'
|
|
| 'Qatar'
|
|
| 'Réunion'
|
|
| 'Romania'
|
|
| 'Russian Federation'
|
|
| 'Rwanda'
|
|
| 'Saint Barthélemy'
|
|
| 'Saint Helena, Ascension and Tristan da Cunha'
|
|
| 'Saint Kitts and Nevis'
|
|
| 'Saint Lucia'
|
|
| 'Saint Martin (French part)'
|
|
| 'Saint Pierre and Miquelon'
|
|
| 'Saint Vincent and the Grenadines'
|
|
| 'Samoa'
|
|
| 'San Marino'
|
|
| 'Sao Tome and Principe'
|
|
| 'Saudi Arabia'
|
|
| 'Senegal'
|
|
| 'Serbia'
|
|
| 'Seychelles'
|
|
| 'Sierra Leone'
|
|
| 'Singapore'
|
|
| 'Sint Maarten (Dutch part)'
|
|
| 'Slovakia'
|
|
| 'Slovenia'
|
|
| 'Solomon Islands'
|
|
| 'Somalia'
|
|
| 'South Africa'
|
|
| 'South Georgia and the South Sandwich Islands'
|
|
| 'South Sudan'
|
|
| 'Spain'
|
|
| 'Sri Lanka'
|
|
| 'Sudan'
|
|
| 'Suriname'
|
|
| 'Svalbard and Jan Mayen'
|
|
| 'Swaziland'
|
|
| 'Sweden'
|
|
| 'Switzerland'
|
|
| 'Syrian Arab Republic'
|
|
| 'Taiwan, Province of China'
|
|
| 'Tajikistan'
|
|
| 'Tanzania, United Republic of'
|
|
| 'Thailand'
|
|
| 'Timor-Leste'
|
|
| 'Togo'
|
|
| 'Tokelau'
|
|
| 'Tonga'
|
|
| 'Trinidad and Tobago'
|
|
| 'Tunisia'
|
|
| 'Turkey'
|
|
| 'Turkmenistan'
|
|
| 'Turks and Caicos Islands'
|
|
| 'Tuvalu'
|
|
| 'Uganda'
|
|
| 'Ukraine'
|
|
| 'United Arab Emirates'
|
|
| 'United Kingdom of Great Britain and Northern Ireland'
|
|
| 'United States of America'
|
|
| 'United States Minor Outlying Islands'
|
|
| 'Uruguay'
|
|
| 'Uzbekistan'
|
|
| 'Vanuatu'
|
|
| 'Venezuela (Bolivarian Republic of)'
|
|
| 'Viet Nam'
|
|
| 'Virgin Islands (British)'
|
|
| 'Virgin Islands (U.S.)'
|
|
| 'Wallis and Futuna'
|
|
| 'Western Sahara'
|
|
| 'Yemen'
|
|
| 'Zambia'
|
|
| 'Zimbabwe';
|
|
|
|
/**
|
|
* Translations for specific languages
|
|
*
|
|
* @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
|
*/
|
|
export interface SCTranslations<T> {
|
|
/**
|
|
* German translations
|
|
*/
|
|
de?: T;
|
|
|
|
/**
|
|
* English translations
|
|
*/
|
|
en?: T;
|
|
}
|
|
|
|
/**
|
|
* Type to represent requiredness of translation properties.
|
|
* Will be changed from RecursivePartial to RecursiveRequired in the future.
|
|
* (Source: https://stackoverflow.com/a/51365037)
|
|
*/
|
|
type RecursivePartial<T> = {
|
|
[P in keyof T]-?:
|
|
T[P] extends Array<infer U> ? Array<RecursivePartial<U>> :
|
|
T[P] extends object ? RecursivePartial<T[P]> :
|
|
T[P];
|
|
};
|
|
|
|
/**
|
|
* Type to recursively map keys in <T> to a string value (used for translation)
|
|
*/
|
|
type SCRequiredTranslationKeys<T> = {
|
|
[key in keyof RecursivePartial<T>]: string;
|
|
};
|
|
|
|
/**
|
|
* Type that allows mapping from available keys of SCTranslations to SCRequiredTranslationKeys
|
|
*/
|
|
type SCRequiredTranslation<T> = {
|
|
[key in keyof SCTranslations<T>]: SCRequiredTranslationKeys<T>;
|
|
};
|
|
|
|
/**
|
|
* Interface to be implemented by all Meta classes
|
|
*/
|
|
export interface SCMetaTranslations<T> {
|
|
/**
|
|
* Field translations
|
|
*/
|
|
fieldTranslations: SCRequiredTranslation<T>;
|
|
/**
|
|
* Field value translations
|
|
*/
|
|
fieldValueTranslations: unknown;
|
|
}
|