fix: localize runtime-generated UI text (5/3) - #6049
Open
eliotcougar wants to merge 2 commits into
Open
Conversation
eliotcougar
marked this pull request as ready for review
August 9, 2026 12:28
Contributor
Author
|
@2dust Tell me if you want it to be split even further. |
Keep connection-test and status data locale-neutral until the UI formats it, and localize delay units at their Compose presentation boundary.\n\nShow stable localized failures while retaining diagnostic exceptions in Logcat. Clarify routing rule matching and subscription entry/exit proxy behavior at the relevant UI call sites, and remove the now-unused core error resources.
eliotcougar
force-pushed
the
codex/issue-6005-runtime-localization
branch
from
August 10, 2026 08:01
ce16b09 to
bcd57fb
Compare
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
Follow-up to #6005.
This is the extracted part 5 of 3 in the localization series. It contains the runtime-code changes that were still bundled into the previous combined Part 3 draft in #6044, which itself was extracted from the original localization audit in #6021.
This branch is intentionally based on
master, with no commits copied from Parts 3 or 4. It is designed to follow those PRs in the series.Why runtime localization needs a separate boundary
Some text cannot be corrected by editing
strings.xmlalone. Connection tests, profile delays, exceptions, and retained main-screen status were being converted into display strings before the final UI knew which app locale to use.Formatting those values in a service or daemon path has two problems:
Contextcan resolve resources using the device language rather than the language selected in v2rayNG; andThis PR therefore transports structured or semantic data through runtime layers and applies localization only at a presentation boundary.
1. Keep the connection-test core path locale-neutral
Producer:
CoreServiceManagerMSG_MEASURE_DELAY_SUCCESStoMSG_MEASURE_DELAY_RESULT, because the message now represents either success or failure.ConnectionTestResultinstead of a finished UI sentence."(unknown) unknown"suffix inSpeedtestManager.The DTO contains only locale-neutral values:
delayMilliserrorMessagecountryipAddressThis keeps
CoreServiceManagerindependent of presentation wording. The raw failure remains useful as a diagnostic, while the UI chooses the localized sentence and fallback text. ISO country codes and IP addresses are deliberately not translated.Transport:
MainRepositoryandMainServiceEventConnectionTestResultfrom the service broadcast.MeasureDelayResultevent.StateStartFailurestate rather than displaying the service's raw exception text as a toast.Consumer:
MainViewModelconnection_test_availableand a separately localized delay value.connection_test_errorand a localized empty-message fallback.The complete producer → transport → consumer chain was updated together so no old string payload remains on the connection-test path.
2. Represent retained main-screen status semantically
MainUiStatepreviously retained already-formatted strings such as Connected, Testing, and connection-test results. AViewModelsurvives activity recreation, so such strings could remain in the old language after an app-locale change.This PR introduces
MainStatusvariants for:MainScreenasksMainViewModelto format the current semantic status when rendering. The selected app locale is therefore consulted at presentation time instead of being frozen into retained state.3. Localize TCPing and real-delay units in profile rows
ServerAffiliationInfo.getTestDelayString()previously appended the literal English unitmsbefore the value reached Compose.ServerAffiliationInfoandServersCachenow retain only the numeric millisecond value.ServerListItemformats that value withstringResource(R.string.server_test_delay_value, ...).The unit resource is provided in all nine maintained locale catalogs.
4. Separate diagnostic exceptions from localized user failures
Two exception paths previously exposed platform or exception text directly to users:
Both paths now log the original exception, including its diagnostic detail and stack trace, while showing the stable localized
toast_failuremessage in the UI. This avoids device-language/platform exception text in the interface without reducing Logcat usefulness.Startup failures follow the same principle: the core/service logs the technical cause, while the main UI displays
toast_services_failure.5. Clarify code-dependent settings UI
Routing rule matching
The old comma-separated hint was repeated inside the domain, IP, and process fields and incorrectly suggested choosing only one field.
The placement and wording now match how a
RulesetItemis converted into one Xray routing rule.Subscription proxy-chain endpoints
The labels Previous proxy config remarks and Next proxy config remarks described storage fields rather than their visible effect.
FormDropdownField.The labels remain mapped to the existing
prevProfileandnextProfilefields; no subscription data format or chain-building behavior changes.Resource ownership and focus
The new or code-dependent resources are supplied in English, Arabic, Bangla, Bakhtiari, Persian, Russian, Vietnamese, Simplified Chinese, and Traditional Chinese.
This PR changes exactly 16 resource identifiers per locale:
core_error_*resources removed after the core configuration path became resource-neutral.The catalogs retain identical identifiers, order, physical row alignment, and format placeholders. These resource identifiers do not overlap the identifiers changed by #6047 or #6048.
Impact