Complete zh locale i18n: convert leftover literals, review translations, add zh-compile CI#18110
Merged
Conversation
Run `mvn clean test-compile -P with-zh-locale -DskipTests` on push/PR to master/rel/*/rc/* to guard the Chinese locale build, catching key-parity regressions and zh Messages class compile errors that the default EN-only CI misses.
Convert 185 raw English string literals in log/exception/setMessage
calls to MessagesClass constants across all i18n-enabled modules, so
they translate under the zh locale. Covers the leading-literal pass
(162 sites), trailing-fragment merges and missed siblings (23 sites,
e.g. DataNodeInternalRPCServiceImpl.getDataPartitionTableGeneratorProgress,
AstBuilder, WriteBackSink).
Review all 9258 zh translation pairs (37 file pairs); fix ~1100
untranslated and garbled/mixed-language messages while preserving
format specifiers and terms of art (TsFile, DataRegion, SQL keywords,
config keys, class/method names).
Fix a doubled-output bug in ConfigurationFileUtils.acquireTargetFileLock
where the full WAITING_TO_ACQUIRE_CONFIG_FILE_LOCK message was
concatenated with two fragment constants duplicating its middle/last
sentences (also leaving a stray {} unbound).
en/zh parity: 0 missing / 0 extra / 0 format-specifier mismatches;
both mvn test-compile and mvn test-compile -P with-zh-locale pass.
Convert 13 raw English string literals introduced by the master merge to DataNodeQueryMessages constants in Analysis.java (1) and StatementAnalyzer.java (12): requireNonNull precondition messages and a String.format exception template. Reuses 3 existing constants (EXPRESSION_IS_NULL, SCOPE_IS_NULL, MISSING_REQUIRED_ARGUMENT_S); adds 10 new ones to en + zh with matching translations. Document the convention in CLAUDE.md: never inline a user-facing English literal in log/exception/setMessage/requireNonNull/format calls; constant naming (PREFIX_NORMALIZED_MD5[:8]); en/zh parity; verify with spotless + both-locale compile.
The source referenced EXCEPTION_LATERALCOLUMNALIYREFERENCES_IS_NULL (typo) while the en/zh DataNodeQueryMessages define ...ALIASREFERENCES_, causing 'cannot find symbol'. The earlier single-module incremental compile masked it via a stale target class.
Add a Build-pitfall note: mvn compile -pl <module> builds against stale ~/.m2 jars and target/ classes, so it can mask 'cannot find symbol' for newly added/renamed *Messages constants or other cross- module API changes. Verify i18n / cross-module edits with a full- reactor mvn test-compile (both locales), and check the maven exit code directly rather than via 'mvn ... && echo' (set -e skips &&).
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #18110 +/- ##
===========================================
Coverage 41.81% 41.82%
Complexity 318 318
===========================================
Files 5296 5296
Lines 372207 373384 +1177
Branches 48183 48210 +27
===========================================
+ Hits 155629 156152 +523
- Misses 216578 217232 +654 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…tiveOptimizer, etc. Review-feedback fixes for PR #18110: - ManagerMessages ZH: fix 8 constants with doubled backslash escapes (\\t/\\n/\\\") that printed literal \t/\n/\" under zh locale instead of tab/newline/quote — same bug class as UtilMessages. - DataNodePipeMessages ZH: translate ~81 untranslated prose constants, fix 11 mixed-language '成功 transferred...' messages, fix half-width comma, correct 稀后->稍后 typo. - IterativeOptimizer: RULE_S_BEFORE_S_AFTER_S used %s in a LOG.debug (SLF4J) call, silently dropping 3 args; change %s -> {} in en+zh. - SessionMessages: fix doubled }} placeholder (en+zh). - Half-width punctuation between Chinese chars -> full-width in DataNodeMiscMessages, StorageEngineMessages, CommonMessages. - IoTConsensusServerImpl: merge a debug log split across two constants into one full-message constant; drop the two orphaned constants. - CLAUDE.md: prefix rule now matches the codebase's actual LOG_/MESSAGE_/EXCEPTION_ three-way convention; add exemption that pure-punctuation fragments should not be constants, and one message = one constant (not concatenated fragments).
The i18n conversion in CastFunctionUtils swapped the throw messages but the exception paths (long/double/text out-of-range, invalid boolean text) had no unit tests. Add focused UT covering each cast method's happy path and its SemanticException throw — 19 tests, all passing.
|
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.




Motivation
Finish the Chinese (
zh) locale i18n effort so that every user/log/exception-facing message flows through aMessagesClassconstant and renders correctly under the zh build, and add CI to keep the zh locale from regressing.iotdbuses compile-time i18n: each participating module has twin EN / ZHMessagesclasses swapped by thei18n.localeproperty (profilewith-zh-locale). The default CI only compiled the EN locale, so leftover raw English string literals and zh-key/en-key drift could slip in untested.Changes
Convert leftover raw literals → i18n constants. 185 call-sites across all i18n-enabled modules (datanode, confignode, node-commons, consensus, calc-commons, client libs, library-udf, api) that set a response message, threw an exception, or logged via
LOGGER.x(...)with a hard-coded English literal now reference a*Messagesconstant. Includes leading-literal conversions (162), trailing-fragment merges into single full-message constants, and missed siblings — e.g.DataNodeInternalRPCServiceImpl.getDataPartitionTableGeneratorProgress,AstBuilder"Supported formats",WriteBackSink.Exhaustive zh translation review. Reviewed all 9258 EN/ZH constant pairs (37 file pairs) and fixed ~1100 entries: untranslated prose (
zh == en), garbled/mixed-language log messages (e.g."任务 finishes 成功, time cost 是{} s"), a real output bug (UtilMessagesdoubled backslash),",,"double-comma typos, and a broken-Chinese"为 不"typo. Terms of art (TsFile, DataRegion, Consensus, SQL keywords, snake_case config keys, class/method names) are intentionally kept in English; format specifiers (%s/%d/{}) are preserved exactly.Add zh-locale CI. New
.github/workflows/zh-locale-compile.ymlrunsmvn clean test-compile -P with-zh-locale -DskipTestson push/PR tomaster/rel/*/rc/*— catches EN/ZH key-parity regressions and zhMessagesclass compile errors the EN-only CI misses.Bug fix.
ConfigurationFileUtils.acquireTargetFileLockloggedWAITING_TO_ACQUIRE_CONFIG_FILE_LOCK(already the full message) concatenated with two fragment constants that duplicated its middle/last sentences, producing doubled output and an unbound trailing{}. Simplified to the single constant; removed the now-orphaned fragments from EN + ZH.Verification
mvn test-compile -DskipTests— BUILD SUCCESS (EN)mvn test-compile -DskipTests -P with-zh-locale— BUILD SUCCESS (ZH)spotless:checkclean🤖 Generated with Claude Code