Repository navigation
translate: comparison words, PascalCase methods, keyword-safe names - #3690
Conversation
… a name A leading underscore is what silences the unused variable error, and the translator dropped it. A translated name that is a keyword in the target language, for example the one letter v becoming و, now gets a trailing underscore.
Pages now carry the standard style block; the markup around it is unchanged.
Translating to Persian now turns == != <= >= into the Persian words wherever they appear, since they can never be generics, and < and > as before where the parser sees a comparison. A method written in PascalCase (.Lower) is looked up under its snake_case table key, so it gets its Persian name. Type, method and plain identifiers share one helper that appends an underscore to a name that is a keyword, and joins the parts of a multi-word name with a ZWNJ when one part is a keyword.
The style block is new; the printed values and the markup around it match.
# Conflicts: # compiler/cli/cli_translate.salam
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 51 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
sha=974248b08736110a4ea8181be57537442a2ed8ba
🤖 Salam AI reviewVerdict: ✅ Good to merge commit SummaryThis pull request improves the Salam translator by making identifier, type, and method name translation keyword-safe, adding PascalCase-to-snake_case method lookup for Persian output, and emitting Persian word forms for non-generic comparison operators such as ==, !=, <=, and >=. It also regenerates the English and Persian layout_runtime_safe_types translate outputs to include the current runtime style block. The visible changes align with the stated goals, though several translation cases remain documented as unfixed. What changed
Review
Tests
Risks
|
More of the translator that #3352 left behind, taking the
translatesection from 12 of 34 on main to 24 of 35 on a build of this branch.==,!=,<=and>=into the Persian words wherever they appear (they cannot be generics), includingruleconditions and page conditions that the parser does not report as binary expressions.<and>still use the parsed-expression gaps, because they can be generics..Lower()or.StartsWith()is looked up under its snake_case key, so it gets its Persian name instead of a transliteration.tr_safe_name, which appends_to a name that is a keyword in the target language and joins the parts of a multi-word name with a ZWNJ when one part is a keyword (this also addresses the CodeRabbit comment on translate: keep leading underscores, avoid reserved names, refresh three outputs #3686, where type references skipped the check).layout_runtime_safe_typesoutputs (en and fa) regenerated; the printed values and the markup around the style block match the old files.Still failing in
translate, each needing its own change: names declared insideextern:andexport:blocks are translated (2 tests), snake_case aliases and methods called on a call result such as.with_code()(2), page component and attribute names and enum values such ascheckbox(4), value lists and Persian digits in page lines (2), and a multi-word name made of contextual keywords such asقاعده کل نیازمند(1).Summary by CodeRabbit