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

Retrieve system language on Android #47977

Merged
merged 1 commit into from
Mar 14, 2021

Conversation

BrettDong
Copy link
Member

@BrettDong BrettDong commented Mar 11, 2021

Summary

I18N "Retrieve system language on Android"

Purpose of change

Android version does not read system language, so the game is in English no matter what language the Android system is. The player has to go to the options menu and manually select the language they recognise. It is observed that this is a hurdle for players who have zero knowledge of English.

Describe the solution

  • Probe system language in the Java side
  • Read system language in the C++ side through JNI

Testing

arm64 apk built by GitHub Action: https://github.com/BrettDong/Cataclysm-DDA/releases/tag/SystemLanguage

  • Tested on Huawei EMUI 9.1, Android 9:
System Language System Country/Region Detected Language Code Mapped Game Language
Simplified Chinese China zh_Hans_CN zh_CN
Traditional Chinese Hong Kong SAR zh_Hant_HK zh_TW
Traditional Chinese Taiwan zh_Hant_TW zh_TW
Japanese Japan ja_JP ja
French Canada fr_CA fr
English Canada en_CA en
  • Tested on Xiaomi MIUI 12, Android 10:
System Language System Country/Region Detected Language Code Mapped Game Language
Simplified Chinese China zh_CN zh_CN
  • Tested on Xiaomi 10 Pro, MIUI 12, Android 11:
System Language System Country/Region Detected Language Code Mapped Game Language
Simplified Chinese China zh_CN zh_CN

@BrettDong BrettDong added Translation I18n [C++] Changes (can be) made in C++. Previously named `Code` OS: Android Issues related to Android operating system labels Mar 11, 2021
@actual-nh
Copy link
Contributor

actual-nh commented Mar 11, 2021

Suggestion: for Travis, move android to the first stage. Let me know if you'd like me to put in a PR to your branch for this.

EDIT: The heart above, BTW, is for the poor players on Android with no knowledge of English (my spouse is not a native English speaker, which helps make me aware of what a difficult language it is to learn).

@BrettDong BrettDong force-pushed the android-lang branch 3 times, most recently from 839f074 to 7bc9d40 Compare March 11, 2021 15:06
@BrettDong BrettDong marked this pull request as ready for review March 11, 2021 15:47
@ZhilkinSerg
Copy link
Contributor

@ZhilkinSerg
Copy link
Contributor

ZhilkinSerg commented Mar 13, 2021

When game "Language" option is set to "System Language" debug.log says:

  • Desktop version - Language is set to: 'ru';
  • Mobile version - Language is set to: 'ru_RU'.

Mobile version did not switch language to Russian automatically.

@BrettDong BrettDong force-pushed the android-lang branch 3 times, most recently from 2b1c95e to daac226 Compare March 14, 2021 04:35
@BrettDong
Copy link
Member Author

The latest commit 1388c05 should be working now.

@ZhilkinSerg
Copy link
Contributor

Yes, seems to be working. Tested in a couple of languages - game language is changed automatically when set to "System language". Links with APK for testing are above.

@BrettDong
Copy link
Member Author

I feel this version is ready for merge.

@ZhilkinSerg ZhilkinSerg merged commit b43409d into CleverRaven:master Mar 14, 2021
@BrettDong BrettDong deleted the android-lang branch March 14, 2021 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` OS: Android Issues related to Android operating system Translation I18n
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants