sadpandajoe commented on code in PR #44397:
URL: https://github.com/apache/superset/pull/44397#discussion_r4132304632
##########
superset/translations/messages.pot:
##########
@@ -2536,6 +2536,8 @@ msgstr ""
msgid "Back to all"
msgstr ""
+#. i18n: the database engine behind a connection (PostgreSQL, MySQL),
Review Comment:
These `# i18n:` comments only land in `messages.pot`; none of the 30
language catalogs (e.g. `superset/translations/de/LC_MESSAGES/messages.po`) are
regenerated or committed here, so a translator working directly in a catalog
file still sees `msgid "Backend"`/`"Host"`/`"Slug"` with no context until
someone reruns `babel_update.sh` and commits the result. Other PRs that add or
change translatable strings commit the regenerated catalogs in the same PR —
was leaving them out intentional here, or should this PR include them?
##########
tests/unit_tests/scripts/translations/check_pot_drift_test.py:
##########
@@ -236,3 +237,18 @@ def test_committed_template_matches_a_fresh_extraction()
-> None:
missing, stale = check_pot_drift.diff()
assert not missing, f"{len(missing)} string(s) in source missing from
messages.pot"
assert not stale, f"{len(stale)} string(s) in messages.pot no longer in
source"
+
+
+def test_extract_flags_match_babel_update_sh() -> None:
+ """``EXTRACT_FLAGS`` mirrors the ``pybabel extract`` call in
babel_update.sh.
+
+ Only ``-F`` and ``-o`` differ, since the drift check writes to a temporary
+ path. Any other flag added to one invocation and not the other fails here.
+ """
+ script = (_SCRIPT_PATH.parent /
"babel_update.sh").read_text(encoding="utf-8")
+ command = script[script.index("\npybabel extract") :]
+ command = command[: command.index(" .\n") + 2].replace("\\\n", " ")
+ args = shlex.split(command)[2:]
+ for flag in ("-F", "-o"):
+ del args[args.index(flag) : args.index(flag) + 2]
+ assert args == check_pot_drift.EXTRACT_FLAGS
Review Comment:
This only asserts the two `pybabel extract` invocations use the same flags;
it doesn't assert that a `# i18n:` comment actually reaches the extracted
output. If `--add-comments=i18n:` were later dropped from both invocations,
this test and `check_pot_drift.py`'s msgid-only drift check would both still
pass, and every translator comment would silently disappear from `messages.pot`
with nothing in CI to catch it. Could this also assert that extracting a tagged
string produces a `#. i18n:` comment on its entry?
--
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]