mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix display language not switching correctly to Chinese on native. (#6621)

* Update deviceLocales.ts

* Update deviceLocales.ts

authored by

Frudrax Cheng and committed by
GitHub
09ce65b2 c858700c

+23 -2
+23 -2
src/locale/deviceLocales.ts
··· 13 13 * 14 14 * {@link https://github.com/bluesky-social/social-app/pull/4461} 15 15 * {@link https://xml.coverpages.org/iso639a.html} 16 + * 17 + * Convert Chinese language tags for Native. 18 + * 19 + * {@link https://datatracker.ietf.org/doc/html/rfc5646#appendix-A} 20 + * {@link https://developer.apple.com/documentation/packagedescription/languagetag} 21 + * {@link https://gist.github.com/amake/0ac7724681ac1c178c6f95a5b09f03ce#new-locales-vs-old-locales-chinese} 16 22 */ 17 23 export function getLocales() { 18 24 const locales = defaultGetLocales?.() ?? [] ··· 32 38 // yiddish 33 39 locale.languageCode = 'yi' 34 40 } 41 + } 35 42 36 - // @ts-ignore checked above 37 - output.push(locale) 43 + if (typeof locale.languageTag === 'string') { 44 + if (locale.languageTag.startsWith('zh-Hans')) { 45 + // Simplified Chinese to zh-CN 46 + locale.languageTag = 'zh-CN' 47 + } 48 + if (locale.languageTag.startsWith('zh-Hant')) { 49 + // Traditional Chinese to zh-TW 50 + locale.languageTag = 'zh-TW' 51 + } 52 + if (locale.languageTag.startsWith('yue')) { 53 + // Cantonese (Yue) to zh-HK 54 + locale.languageTag = 'zh-HK' 55 + } 38 56 } 57 + 58 + // @ts-ignore checked above 59 + output.push(locale) 39 60 } 40 61 41 62 return output