bluesky-social / social-app

The Bluesky Social application for Web, iOS, and Android
https://bsky.app
MIT License
10.12k stars 1.29k forks source link

Problem of languagePrefs (BCP 47 and ISO 639-1) #4316

Open KuwaLee opened 5 months ago

KuwaLee commented 5 months ago

Describe the bug

If change the app display language before login, the AppLanguage code will be added to languagePrefs.contentLanguages array, instead of add LANGUAGES

AppLanguage is manage by lingui, and it use BCP 47 which can contain region code (for example zh-TW) LANGUAGES is set of ISO 639 (in this case it will only have zh)

That will make (for this example) zh-TW stuck in contentLanguages and settings in UI will neither show nor be able to removing it.

And

      if (!preferredLangsCode2.length || preferredLangsCode2.length === 0) {
        return slices
      }

this code will take no effect in src\lib\api\feed-manip.ts, since there is always one string in array (for this example zh-TW)

The only possible way to remove (for this example) zh-TW is to reset all settings

Details

KuwaLee commented 5 months ago

I discover this bug while I tested this in #4314

Plus, I would like to know if its support to use region in code2 for example zh-CN and zh-TW, or it stick strictly only ISO 639-2?