Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zh_TW #202

Merged
merged 13 commits into from
Nov 29, 2022
Merged

Conversation

jhihyulin
Copy link
Contributor

Add Traditional Chinese (Taiwan)

@C10udburst
Copy link
Member

Fails to build: values-zh-TW: Error: Invalid resource directory name

@Sdarfeesh
Copy link
Contributor

Sdarfeesh commented Nov 12, 2022

It seems like the Traditional Chinese translation cannot load, could you fix that?

-2022-11-12-11-33-50.mp4

@jhihyulin
Copy link
Contributor Author

I don't know how to fix this bug, but now I can go into the application and skip the language setting and it will display normally, so the problem should be in the language code in app\src\main\java\com\lagradost\cloudstream3\ui\settings\SettingsGeneral.kt line 79, or in the other settings of the language setting file?

@Sdarfeesh
Copy link
Contributor

Sdarfeesh commented Nov 12, 2022

I don't know how to fix this bug, but now I can go into the application and skip the language setting and it will display normally, so the problem should be in the language code in app\src\main\java\com\lagradost\cloudstream3\ui\settings\SettingsGeneral.kt line 79, or in the other settings of the language setting file?

Triple("\uD83C\uDDF9\uD83C\uDDFC", "Chinese Traditional", "zh-Hant-TW"),

The language code should be same as values-* !!!

@jhihyulin
Copy link
Contributor Author

I don't know how to fix this bug, but now I can go into the application and skip the language setting and it will display normally, so the problem should be in the language code in app\src\main\java\com\lagradost\cloudstream3\ui\settings\SettingsGeneral.kt line 79, or in the other settings of the language setting file?

Triple("\uD83C\uDDF9\uD83C\uDDFC", "Chinese Traditional", "zh-Hant-TW"),

The language code should be same as values-* !!!

Triple("\uD83C\uDDF9\uD83C\uDDFC", "Traditional Chinese", "zh-rTW"),

Triple("\uD83C\uDDF9\uD83C\uDDFC", "Traditional Chinese", "zh-TW"),

Tried it, doesn't work

@Sdarfeesh
Copy link
Contributor

I don't know how to fix this bug, but now I can go into the application and skip the language setting and it will display normally, so the problem should be in the language code in app\src\main\java\com\lagradost\cloudstream3\ui\settings\SettingsGeneral.kt line 79, or in the other settings of the language setting file?

Triple("\uD83C\uDDF9\uD83C\uDDFC", "Chinese Traditional", "zh-Hant-TW"),

The language code should be same as values-* !!!

Triple("\uD83C\uDDF9\uD83C\uDDFC", "Traditional Chinese", "zh-rTW"),

Triple("\uD83C\uDDF9\uD83C\uDDFC", "Traditional Chinese", "zh-TW"),

Tried it, doesn't work

I found the problem, because ISO 639-1 codes only have zh code for Chinese, so it's not possible to add another Chinese language

@Sdarfeesh
Copy link
Contributor

I don't know how to fix this bug, but now I can go into the application and skip the language setting and it will display normally, so the problem should be in the language code in app\src\main\java\com\lagradost\cloudstream3\ui\settings\SettingsGeneral.kt line 79, or in the other settings of the language setting file?

Triple("\uD83C\uDDF9\uD83C\uDDFC", "Chinese Traditional", "zh-Hant-TW"),

The language code should be same as values-* !!!

Triple("\uD83C\uDDF9\uD83C\uDDFC", "Traditional Chinese", "zh-rTW"),

Triple("\uD83C\uDDF9\uD83C\uDDFC", "Traditional Chinese", "zh-TW"),

Tried it, doesn't work

You can try to use a code of ISO 639-1 codes that isn't used
(For example, tw)

@jhihyulin
Copy link
Contributor Author

I don't think using other code is the best option, which may cause the language to not be set automatically.

BTW, tw is already used in the ISO 639-1
Screenshot_2022-11-12-17-23-09-48_40deb401b9ffe8e1df2f1cc5ba480b12

@Blatzar
Copy link
Contributor

Blatzar commented Nov 12, 2022

Java Locale has Traditional Chinese but that cannot be instantiated given only a language code.

I think creating an exception hashmap and just manually mapping the locales there would be the least messy solution:

Right below appLanguages:

/**
 * Not all languages can be fetched from locale with a code.
 * This map allows sidestepping the default Locale(languageCode)
 * when setting the app language.
 **/
val appLanguageExceptions = hashMapOf(
    "zh-Hant-TW" to Locale.TRADITIONAL_CHINESE
)

and in https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/CommonActivity.kt#L113 you can add the exception like this:

val locale = appLanguageExceptions[languageCode] ?: Locale(languageCode)

@jhihyulin
Copy link
Contributor Author

The language can now be switched normally, but there is still a problem with the part where the language selection is displayed.

@Blatzar
Copy link
Contributor

Blatzar commented Nov 13, 2022

The language can now be switched normally, but there is still a problem with the part where the language selection is displayed.

What do you mean?

@jhihyulin
Copy link
Contributor Author

The language can now be switched normally, but there is still a problem with the part where the language selection is displayed.

What do you mean?

Like this
Select Traditional Chinese, the language of the interface is also Traditional Chinese, but the language menu shows that Simplified Chinese is selected.

Record_2022-11-13-17-27-47.mp4

@Blatzar
Copy link
Contributor

Blatzar commented Nov 15, 2022

Weird, I'll get to investigating soon

@Blatzar Blatzar merged commit 58593ac into recloudstream:master Nov 29, 2022
@Blatzar
Copy link
Contributor

Blatzar commented Nov 29, 2022

Sorry for the wait 😔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants