fix: honor the selected app locale everywhere (All-in-one) - #6044
Closed
eliotcougar wants to merge 9 commits into
Closed
fix: honor the selected app locale everywhere (All-in-one)#6044eliotcougar wants to merge 9 commits into
eliotcougar wants to merge 9 commits into
Conversation
Use AndroidX and framework per-app locale APIs, migrate the existing language preference, and expose the generated locale config to Android 13+ settings. Resolve strings through the selected app locale in application, ViewModel, launcher, tile, and service contexts. Replace framework OK/Cancel resources and refresh retained localized UI state after locale changes.
Review all 443 resources across Arabic, Bengali, Bakhtiari, Persian, Russian, Vietnamese, Simplified Chinese, and Traditional Chinese. Correct semantic mismatches against their UI call sites, replace awkward or untranslated visual text, preserve xray-core field names and protocol identifiers, and keep every catalog row- and array-aligned. Bakhtiari orthography and lexicon references: https://www.diva-portal.org/smash/get/diva2:1231755/FULLTEXT02.pdf and https://uu.diva-portal.org/smash/record.jsf?pid=diva2:758171. Unit terminology reference: https://cldr.unicode.org/translation/units/unit-names-and-patterns.
eliotcougar
marked this pull request as ready for review
August 8, 2026 22:36
Contributor
|
@eliotcougar Great and thank you for your help, and for addressing my report and improving the program and the program languages. |
Owner
|
感谢
|
2dust
reviewed
Aug 9, 2026
| * @return Version string of the V2Ray core, or null if it cannot be read. | ||
| */ | ||
| fun getLibVersion(): String { | ||
| fun getLibVersion(): String? { |
Contributor
Author
There was a problem hiding this comment.
Version string rendering moved from core to UI (About and Update screens)
Contributor
Author
Sigh... It's not AI, it's me... Alright, I'll split the cleanup work from the #6005 fix. |
eliotcougar
marked this pull request as draft
August 9, 2026 10:36
Owner
|
如果不是ai ,也不要在一个 pr 中 提交如此多的修改。 |
This was referenced Aug 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context and series
Fixes #6005. For real this time.
This is part 3 of 3 extracted from the original combined localization audit in #6021.
Root cause: why present translations looked missing
The affected resources were present and correctly named. The bug came from which
Contextresolved them.The previous implementation stored the chosen language in MMKV and wrapped
BaseComponentActivitywith a custom locale configuration. That changed resources obtained from the activity, including most direct ComposestringResource(...)calls, but it did not establish an application-wide per-app locale.Several kinds of text were produced elsewhere:
AndroidViewModeland repository code used the rawApplicationcontext.applicationContext.android.R.string.okandandroid.R.string.cancel, which belong to framework resources rather than the app's locale catalogs.Those contexts continued to use the device locale. A single Compose screen could therefore combine correctly localized strings from its activity with Persian, English, or another device-language string created outside that activity. This explains both otherwise puzzling observations from #6021:
The
values-bqi-rIRresource directory was not itself the cause.bqi-rIRis the Android resource-qualifier form; the runtime per-app locale API instead receives the BCP 47 language tagbqi-IR. The old code treated the stored resource-style code as the entire locale mechanism and never synchronized it with Android's app-locale APIs.This implementation follows Android's current per-app language guidance and uses
ContextCompat.getContextForLanguagefor resource access outside anAppCompatActivity.Locale infrastructure
Use the platform and AndroidX app-locale APIs
ComponentActivitytoAppCompatActivity, as required for backward-compatibleAppCompatDelegate.setApplicationLocales(...)handling.AppLocaleManagerfor setting, reading, migrating, and applying the selected locale.zh-rCN->zh-CNzh-rTW->zh-TWbqi-rIR->bqi-IRDeclare supported languages correctly
LocaleConfigsupport and explicitly filters it to the nine maintained locales.resources.properties.Apply the locale outside activities
ApplicationandBaseViewModelresources through a locale-aware context.MainRepository, including the synthetic All group.MyContextWrapper; locale behavior now has one AndroidX/platform-backed owner.Keep core and service data locale-neutral
Part 2 initially exposed more localized failures, but subsequent upstream architecture deliberately removed Android resources from
/core. This PR preserves that separation.CoreServiceManagerno longer formats connection-test UI sentences.ConnectionTestResultcontaining delay, diagnostic detail, country code, and IP address.MainViewModelformats that result only at the UI boundary using the currently selected app locale.MainStatusstate instead of retained localized strings, so activity recreation or a locale change cannot leave stale text behind.Other localization and UI polish
Units and connection status
Unknownvalue when the native-core version, country, or IP value is unavailable instead of leaking an English sentinel.Framework and cached UI text
OKandCancelresources with app-owned translations in dialogs and notifications.Settings and menu wording
domain:address,…syntax.URLcapitalization.Routing clarity
Subscription proxy-chain clarity
Resource consistency
Impact