Skip to content

Text kept as raw DrawingML (_groupXml) bypasses translation, autoSpacing and lang — and is the copy that renders #720

Done

Description

@naohito2000

Text that the converter keeps as raw DrawingML never reaches the text pipeline, and it is the copy that gets rendered. Translation, autoSpacing and the lang tagging all miss it.

Found in a real import → translate session (an English 36-slide FCD → a Japanese sibling deck).

The mechanism

Some shapes are converted by storing the whole p:grpSp element as a string:

  • sdpm/sdpm/engine/converter/elements/dispatch.py:161,190 — elem["_groupXml"] = _et.tostring(shape._element, encoding='unicode')
  • sdpm/sdpm/engine/builder/elements/group.py:19 and sdpm/sdpm/engine/builder/__init__.py:388 — when _groupXml is present it is what gets written, so the group's child text values in the JSON are not used

_groupXml's value is a string under a key that is not in _TRANSLATABLE_KEYS (sdpm/scripts/translate_extract.py:32-39, mirrored in translate_apply.py:36). Both scripts walk dicts and lists generically, but only act on keys in that set — so the <a:t> elements inside the raw XML are invisible to them. For the same reason the string never passes through _apply_styled_text.

Three consequences, all from that one bypass

  1. Not translated. 37 strings stayed in English. Worse, the same string existed in both a styled element and the raw XML, and only the raw one is rendered — so fixing the element changed nothing on screen, which is a confusing failure to debug.

  2. autoSpacing cannot reach it. normalize_spacing's half-width space between Japanese and Latin runs is applied in _apply_styled_text, which the raw XML bypasses. In the field, spaces were removed from the raw XML's <a:t> by hand and could not be restored by turning autoSpacing back on — the setting has no effect on these shapes. Six slides were affected, and one lost its line breaks.

  3. lang="en-US" stays on Japanese runs (37 of them). sdpm/sdpm/engine/builder/formatting.py sets lang='ja-JP' on runs containing CJK, in the same bypassed function. This one is invisible in review: PowerPoint applies kinsoku only when the run language is ja-JP, while LibreOffice applies it regardless of language. So a PDF rendered through LibreOffice looks correct and the defect only appears in PowerPoint.

Suggested fix

Route the <a:t> text inside _groupXml through the same pipeline as every other string: visible to translate_extract / translate_apply, and run through the spacing and language steps on build.

If that is too large, the minimum is to say so: warn that a group's text does not pass the text pipeline, naming the slides. Right now there is no signal at all, and the only way to find it is to notice that an edit to the JSON did not change the rendered slide.


Found alongside two other engine issues from the same session, filed separately because they are fixed elsewhere in the tree.

Activity

  1. added
    bug
    kirocrew
    on Dec 2, 2026
  2. naohito2000 commented on Dec 2, 2026

    @naohito2000
    ContributorAuthor

    From the same session: #719 (notes and placeholder fontSize dropped silently) and #721 (Japanese built with a Latin-only font). The lang="en-US" consequence listed here is also what makes #721's font problem hard to see in a PDF review: LibreOffice applies kinsoku regardless of language, PowerPoint only on ja-JP.

  3. ShotaroKataoka commented on Dec 2, 2026

    @ShotaroKataoka
    Contributor

    🤖 KiroCrew automated comment — triage by KiroCrew on behalf of the maintainers.

    Thank you for tracing this to the one bypass. Confirmed on main (c43f773) by reading the code; I did not rebuild your deck.

    • The converter keeps the whole p:grpSp as a string when a group is rotated, holds freeforms or sub-pixel children (converter/elements/dispatch.py:158-161), or has a gradient group fill (:190). It also extracts the children into the JSON. So the JSON has two copies of the text.
    • The builder injects _groupXml and returns before it looks at the children (builder/elements/group.py:19-29). So the rendered copy is the raw one.
    • _TRANSLATABLE_KEYS (sdpm/scripts/translate_extract.py:33-40, translate_apply.py:36) does not include _groupXml. ja-JP tagging and autoSpacing live in _apply_styled_text (builder/formatting.py:293,318-322), which raw XML never passes through.

    Size: M for translating the <a:t> text in extract/apply plus lang tagging on build. L if spacing and styled text must also apply inside raw XML. S for the minimum warning.

    Overlap:

    Suggested fix:

    1. In translate_extract / translate_apply, walk the <a:t> text of _groupXml (and drop or sync the shadow child copies). Then the edited text is the rendered text.
    2. On build, tag CJK runs inside injected group XML with lang="ja-JP", using the same test _apply_styled_text uses.
    3. Until then, lint or the build should name the slides whose group text bypasses the text pipeline.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugkirocrew

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions