about summary refs log tree commit diff
path: root/src/view/screens
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2025-03-04 14:03:11 +0000
committerGitHub <noreply@github.com>2025-03-04 06:03:11 -0800
commit67c394bc82d8a4316370672546377c8908b2d1f9 (patch)
treebec6e43e6b57cf3efc6840a594a55040f8581884 /src/view/screens
parentc995eb2f2fa3e73dcc6943078c85cd6a68f5370b (diff)
downloadvoidsky-67c394bc82d8a4316370672546377c8908b2d1f9.tar.zst
Prioritise language codes with regions (#7731)
* prioritise chinese and portugese

* more language name cleanup

* skip ast to fix false positive
Diffstat (limited to 'src/view/screens')
-rw-r--r--src/view/screens/Search/Search.tsx13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/view/screens/Search/Search.tsx b/src/view/screens/Search/Search.tsx
index 9651c722a..c3fe5012c 100644
--- a/src/view/screens/Search/Search.tsx
+++ b/src/view/screens/Search/Search.tsx
@@ -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