-
Notifications
You must be signed in to change notification settings - Fork 8k
fix: honor the selected app locale everywhere (All-in-one) #6044
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
Closed
eliotcougar
wants to merge
9
commits into
2dust:master
from
eliotcougar:codex/fix-app-locale-context
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1c5cd4c
Fix per-app locale handling across contexts
eliotcougar d66d77a
Fix stale Arabic menu workflow labels
eliotcougar 42b250c
Localize service results at the UI boundary
eliotcougar ca779ef
Localize profile row delay units
eliotcougar 3504084
Localize retained UI feedback at presentation boundaries
eliotcougar ca6cfcf
Polish app locale changes for review
eliotcougar 019c768
Audit and refine all locale catalogs
eliotcougar 137cfda
Refine localized settings text
eliotcougar d571a73
Clarify subscription proxy chain settings
eliotcougar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
11 changes: 11 additions & 0 deletions
11
V2rayNG/app/src/main/java/com/v2ray/ang/dto/ConnectionTestResult.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.v2ray.ang.dto | ||
|
|
||
| import java.io.Serializable | ||
|
|
||
| /** Locale-neutral result sent from the daemon for presentation by the UI process. */ | ||
| data class ConnectionTestResult( | ||
| val delayMillis: Long, | ||
| val errorMessage: String = "", | ||
| val country: String? = null, | ||
| val ipAddress: String? = null, | ||
| ) : Serializable |
9 changes: 1 addition & 8 deletions
9
V2rayNG/app/src/main/java/com/v2ray/ang/dto/entities/ServerAffiliationInfo.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,3 @@ | ||
| package com.v2ray.ang.dto.entities | ||
|
|
||
| data class ServerAffiliationInfo(var testDelayMillis: Long = 0L) { | ||
| fun getTestDelayString(): String { | ||
| if (testDelayMillis == 0L) { | ||
| return "" | ||
| } | ||
| return testDelayMillis.toString() + "ms" | ||
| } | ||
| } | ||
| data class ServerAffiliationInfo(var testDelayMillis: Long = 0L) |
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
58 changes: 47 additions & 11 deletions
58
V2rayNG/app/src/main/java/com/v2ray/ang/enums/Language.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,56 @@ | ||
| package com.v2ray.ang.enums | ||
|
|
||
| enum class Language(val code: String) { | ||
| AUTO("auto"), | ||
| ENGLISH("en"), | ||
| CHINA("zh-rCN"), | ||
| TRADITIONAL_CHINESE("zh-rTW"), | ||
| VIETNAMESE("vi"), | ||
| RUSSIAN("ru"), | ||
| PERSIAN("fa"), | ||
| ARABIC("ar"), | ||
| BANGLA("bn"), | ||
| BAKHTIARI("bqi-rIR"); | ||
| import androidx.core.os.LocaleListCompat | ||
| import java.util.Locale | ||
|
|
||
| enum class Language(val code: String, val languageTag: String) { | ||
| AUTO("auto", ""), | ||
| ENGLISH("en", "en"), | ||
| CHINA("zh-rCN", "zh-CN"), | ||
| TRADITIONAL_CHINESE("zh-rTW", "zh-TW"), | ||
| VIETNAMESE("vi", "vi"), | ||
| RUSSIAN("ru", "ru"), | ||
| PERSIAN("fa", "fa"), | ||
| ARABIC("ar", "ar"), | ||
| BANGLA("bn", "bn"), | ||
| BAKHTIARI("bqi-rIR", "bqi-IR"); | ||
|
|
||
| val locale: Locale? | ||
| get() = languageTag.takeIf { it.isNotEmpty() }?.let(Locale::forLanguageTag) | ||
|
|
||
| fun toLocaleList(): LocaleListCompat = | ||
| if (languageTag.isEmpty()) { | ||
| LocaleListCompat.getEmptyLocaleList() | ||
| } else { | ||
| LocaleListCompat.forLanguageTags(languageTag) | ||
| } | ||
|
|
||
| companion object { | ||
| fun fromCode(code: String): Language { | ||
| return entries.find { it.code == code } ?: AUTO | ||
| } | ||
|
|
||
| fun fromLanguageTag(languageTag: String?): Language { | ||
| if (languageTag.isNullOrBlank()) return AUTO | ||
|
|
||
| val locale = Locale.forLanguageTag(languageTag) | ||
| return when (locale.language) { | ||
| "en" -> ENGLISH | ||
| "zh" -> if ( | ||
| locale.script == "Hant" || locale.country in setOf("TW", "HK", "MO") | ||
| ) { | ||
| TRADITIONAL_CHINESE | ||
| } else { | ||
| CHINA | ||
| } | ||
| "vi" -> VIETNAMESE | ||
| "ru" -> RUSSIAN | ||
| "fa" -> PERSIAN | ||
| "ar" -> ARABIC | ||
| "bn" -> BANGLA | ||
| "bqi" -> BAKHTIARI | ||
| else -> AUTO | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不要反复的改了,上次已经回滚过一次
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version string rendering moved from core to UI (About and Update screens)