codeant-ai-for-open-source[bot] commented on code in PR #41651:
URL: https://github.com/apache/superset/pull/41651#discussion_r3509908470
##########
scripts/translations/backfill_po.py:
##########
@@ -152,6 +152,60 @@ def _is_missing(entry: polib.POEntry) -> bool:
return not entry.msgstr
+# msgids that must never be machine-translated: literal tokens compared against
+# source (SQL keywords, confirmation words), enum values (d3 interpolation
+# modes), icon names (e.g. "bolt" -> the ⚡ Explore control icon), API field
+# names, code constants, and example placeholders. Seeded from the
+# "# Не переводить" (do-not-translate) markers a human translator curated in
the
+# ru catalog; these strings are language-independent, so the set applies to
+# every catalog. Translating them can break icon lookups, enum matching, or API
+# contracts, or is simply meaningless (proper nouns, example values).
+DO_NOT_TRANSLATE: frozenset[str] = frozenset(
+ {
+ "10000",
+ "DELETE",
+ "ECharts",
+ "EMAIL_REPORTS_CTA",
+ "GROUP BY",
+ "NOT GROUPED BY",
+ "OVERWRITE",
+ "TEMPORAL_RANGE",
+ "WFS",
+ "WMS",
+ "XYZ",
+ "bolt",
+ "crontab",
+ "error_message",
+ "pivoted_xlsx",
+ "schema1,schema2",
+ "sql",
+ "step-after",
+ "step-before",
+ "superset.example.com",
+ "your-project-1234-a1",
+ }
+)
+
+# Translator comment (in any catalog) explicitly marking an entry off-limits,
+# e.g. the ru catalog's "# Не переводить". Honored so a human translator's
+# deliberate decision to leave a string untranslated is never overridden.
+_DO_NOT_TRANSLATE_COMMENT = re.compile(
+ r"не\s+переводить|do[\s-]?not[\s-]?translate|don'?t\s+translate",
+ re.IGNORECASE,
+)
Review Comment:
**Suggestion:** Add an explicit type annotation to this newly introduced
module-level regex variable. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This is newly introduced Python code and the module-level regex variable is
assigned without an explicit type annotation, which matches the type-hinting
rule for relevant variables that can be annotated.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=81b5b88e47a34d979ee81fa5d11c5e58&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=81b5b88e47a34d979ee81fa5d11c5e58&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** scripts/translations/backfill_po.py
**Line:** 192:195
**Comment:**
*Custom Rule: Add an explicit type annotation to this newly introduced
module-level regex variable.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41651&comment_hash=aeec6acb22e118662f3a8ae4d29d467943df44eb839afcf16a117cae92df8265&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41651&comment_hash=aeec6acb22e118662f3a8ae4d29d467943df44eb839afcf16a117cae92df8265&reaction=dislike'>👎</a>
##########
scripts/translations/backfill_po.py:
##########
@@ -647,6 +701,15 @@ def backfill(
missing: list[polib.POEntry] = [e for e in cat if e.msgid and
_is_missing(e)]
print(f"Found {len(missing)} untranslated entries for '{lang}'.",
file=sys.stderr)
+ skipped_dnt = [e for e in missing if _is_do_not_translate(e)]
Review Comment:
**Suggestion:** Add a concrete type annotation for this new local collection
variable to satisfy the type-hinting rule. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This new local list variable is introduced without an explicit type
annotation even though its type is clear, so it fits the custom rule requiring
type hints on relevant annotated variables.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=482582e1a46341f1a6b70bac044f006c&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=482582e1a46341f1a6b70bac044f006c&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** scripts/translations/backfill_po.py
**Line:** 704:704
**Comment:**
*Custom Rule: Add a concrete type annotation for this new local
collection variable to satisfy the type-hinting rule.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41651&comment_hash=1f0316dcb9d807a6850ff8c5997470a18b94892d3ea5a17d1c0f398935158fe9&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41651&comment_hash=1f0316dcb9d807a6850ff8c5997470a18b94892d3ea5a17d1c0f398935158fe9&reaction=dislike'>👎</a>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]