Prioritise language codes with regions (#7731)
* prioritise chinese and portugese * more language name cleanup * skip ast to fix false positive
This commit is contained in:
@@ -163,7 +163,7 @@ export const LANGUAGES: Language[] = [
|
||||
{code3: 'cad', code2: '', name: 'Caddo'},
|
||||
{code3: 'cai', code2: '', name: 'Central American Indian languages'},
|
||||
{code3: 'car', code2: '', name: 'Galibi Carib'},
|
||||
{code3: 'cat', code2: 'ca', name: 'Catalan; Valencian'},
|
||||
{code3: 'cat', code2: 'ca', name: 'Catalan'},
|
||||
{code3: 'cau', code2: '', name: 'Caucasian languages'},
|
||||
{code3: 'ceb', code2: '', name: 'Cebuano'},
|
||||
{code3: 'cel', code2: '', name: 'Celtic languages'},
|
||||
@@ -218,7 +218,7 @@ export const LANGUAGES: Language[] = [
|
||||
{code3: 'efi', code2: '', name: 'Efik'},
|
||||
{code3: 'egy', code2: '', name: 'Egyptian (Ancient)'},
|
||||
{code3: 'eka', code2: '', name: 'Ekajuk'},
|
||||
{code3: 'ell', code2: 'el', name: 'Greek, Modern (1453-)'},
|
||||
{code3: 'ell', code2: 'el', name: 'Greek'},
|
||||
{code3: 'elx', code2: '', name: 'Elamite'},
|
||||
{code3: 'eng', code2: 'en', name: 'English'},
|
||||
{code3: 'enm', code2: '', name: 'English, Middle (1100-1500)'},
|
||||
@@ -263,8 +263,8 @@ export const LANGUAGES: Language[] = [
|
||||
{code3: 'gor', code2: '', name: 'Gorontalo'},
|
||||
{code3: 'got', code2: '', name: 'Gothic'},
|
||||
{code3: 'grb', code2: '', name: 'Grebo'},
|
||||
{code3: 'grc', code2: '', name: 'Greek, Ancient (to 1453)'},
|
||||
{code3: 'gre', code2: 'el', name: 'Greek, Modern (1453-)'},
|
||||
{code3: 'grc', code2: '', name: 'Ancient Greek'},
|
||||
{code3: 'gre', code2: 'el', name: 'Greek'},
|
||||
{code3: 'grn', code2: 'gn', name: 'Guarani'},
|
||||
{code3: 'gsw', code2: '', name: 'Swiss German; Alemannic; Alsatian'},
|
||||
{code3: 'guj', code2: 'gu', name: 'Gujarati'},
|
||||
@@ -361,7 +361,7 @@ export const LANGUAGES: Language[] = [
|
||||
{code3: 'lit', code2: 'lt', name: 'Lithuanian'},
|
||||
{code3: 'lol', code2: '', name: 'Mongo'},
|
||||
{code3: 'loz', code2: '', name: 'Lozi'},
|
||||
{code3: 'ltz', code2: 'lb', name: 'Luxembourgish; Letzeburgesch'},
|
||||
{code3: 'ltz', code2: 'lb', name: 'Luxembourgish'},
|
||||
{code3: 'lua', code2: '', name: 'Luba-Lulua'},
|
||||
{code3: 'lub', code2: 'lu', name: 'Luba-Katanga'},
|
||||
{code3: 'lug', code2: 'lg', name: 'Ganda'},
|
||||
|
||||
@@ -348,8 +348,17 @@ function SearchLanguageDropdown({
|
||||
if (aIsUser && !bIsUser) return -1
|
||||
if (bIsUser && !aIsUser) return 1
|
||||
// prioritize "common" langs in the network
|
||||
const aIsCommon = !!APP_LANGUAGES.find(al => al.code2 === a.value)
|
||||
const bIsCommon = !!APP_LANGUAGES.find(al => al.code2 === b.value)
|
||||
const aIsCommon = !!APP_LANGUAGES.find(
|
||||
al =>
|
||||
// skip `ast`, because it uses a 3-letter code which conflicts with `as`
|
||||
// it begins with `a` anyway so still is top of the list
|
||||
al.code2 !== 'ast' && al.code2.startsWith(a.value),
|
||||
)
|
||||
const bIsCommon = !!APP_LANGUAGES.find(
|
||||
al =>
|
||||
// ditto
|
||||
al.code2 !== 'ast' && al.code2.startsWith(b.value),
|
||||
)
|
||||
if (aIsCommon && !bIsCommon) return -1
|
||||
if (bIsCommon && !aIsCommon) return 1
|
||||
// fall back to alphabetical
|
||||
|
||||
Reference in New Issue
Block a user