sadpandajoe commented on code in PR #44397:
URL: https://github.com/apache/superset/pull/44397#discussion_r4141928610


##########
scripts/translations/check_pot_drift.py:
##########
@@ -56,10 +56,12 @@
 ROOT_DIR = Path(__file__).resolve().parent.parent.parent
 DEFAULT_POT = ROOT_DIR / "superset" / "translations" / "messages.pot"
 
-# Kept in sync with the `pybabel extract` invocation in babel_update.sh.
+# Kept in sync with the `pybabel extract` invocation in babel_update.sh
+# (enforced by check_pot_drift_test.py).
 EXTRACT_FLAGS = [
     "--no-location",
     "--sort-output",
+    "--add-comments=i18n:",

Review Comment:
   Changing an `i18n:` comment without changing its msgid still passes the 
drift check, so a stale catalog can silently lose the context this PR adds. 
Could the check compare extracted comments as well as msgids and cover that 
regression?



##########
scripts/translations/babel_update.sh:
##########
@@ -40,11 +40,18 @@ cat <<'EOF'> "$LICENSE_TMP"
 EOF
 
 cd $ROOT_DIR
+# --add-comments=i18n:: carry translator context from the source into the
+# catalogs. A comment tagged `i18n:` immediately above a translatable string is
+# extracted as a `#. i18n: ...` comment on that entry, and (like the
+# do-not-translate marker below) propagates into every language catalog on the
+# `pybabel update` further down. Only `i18n:`-tagged comments are extracted, so
+# ordinary code comments near a string are not published to translators.
 pybabel extract \
   -F superset/translations/babel.cfg \
   -o superset/translations/messages.pot \
   --no-location \
   --sort-output \
+  --add-comments=i18n: \

Review Comment:
   The new extracted comments never reach `backfill_po.py`'s prompt, which only 
sends the msgid and existing translations. A missing translation for a term 
like `Slug` can therefore still be generated with the wrong sense. Could this 
pass the extracted context into the backfill prompt as well?



-- 
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]

Reply via email to