Why IDML Formatting Can Produce Translation Tags, and What to Check in InDesign

A document goes out for translation as IDML and the translator writes back: the file is full of tags. Some segments have a tag pair around a single letter. Others have a dozen tags in one sentence. The translator asks whether they can be deleted. The layout side asks why they are there at all.

This post is about the second question, and about what to check in InDesign before the next export.

Where the tags in an IDML come from

IDML is a ZIP archive. Inside it, the Stories/ folder holds one XML file per story, and each paragraph is a ParagraphStyleRange element. Inside the paragraph, the text is split into CharacterStyleRange elements. A range is a run of text in which every character attribute is the same. Where an attribute changes, InDesign closes the range and opens a new one.

A paragraph set entirely in its paragraph style, with no breaks or inline objects in it, is one range. Put one word in bold and it becomes three ranges: the text before the word, the word, the text after it.

Character formatting changes therefore create range boundaries in the IDML before any translation tool has touched the file. The example below shows how the Okapi IDML filter renders two of them as paired inline codes; it does not establish how Trados or memoQ will display the same IDML.

Bold formatting on winter becomes its own CharacterStyleRange in IDML and a paired inline code in the CAT segment.

Which formatting changes create a range boundary

Any character attribute that differs from the text around it starts a new range. In the story XML these show up as attributes on the CharacterStyleRange element or in its Properties child. Attributes to inspect include AppliedCharacterStyle, FontStyle, PointSize, AppliedFont, Position, KerningValue, Tracking, BaselineShift, HorizontalScale, Leading and AppliedLanguage.

The attribute name does not tell you why it is there. A Tracking value may be a fix for one line of English that ran a word too long, or the consistent treatment of a product name. A local PointSize may be a deliberate emphasis or a squeeze to fit a caption. An AppliedLanguage difference may not be visible in the layout at all, and it can be an unintended difference or an intentional setting, since the language controls hyphenation and the spelling dictionary.

Formatting is also not the only source of tags. In the Okapi output for the test file below, a footnote marker and an anchored rectangle each appeared as a placeholder code (ph). These codes represent document structure that needs to be preserved.

Why a tag appears in the middle of a word

Manual kerning can produce this pattern. Kerning is applied between two characters, so InDesign usually stores it as a range that contains a single character with a KerningValue attribute. (A kerning value applied across a longer run of text produces a longer range; the single-character form is the common one.) That range differs from the text on both sides.

To see what that looks like in a bilingual file, I took a one-paragraph IDML exported from InDesign and added two settings directly to the XML: a kerning value on the letter p in "copper", and a local bold on "winter". Extracted with the Okapi IDML filter, the segment reads:

Independent frame BRAVO describes a co<bpt id="1">&lt;content-1></bpt>p<ept id="1">&lt;/content-1></ept>per telescope aimed at <bpt id="2">&lt;content-2></bpt>winter<ept id="2">&lt;/content-2></ept> stars.

(bpt and ept are XLIFF's begin and end markers for a paired inline code; the content-1 inside them is the filter's name for the range.)

The first pair records a kerning setting between two letters of one word. The second pair records a bold setting on a word that, in this example, is meant to stay bold in the translation. The bpt and ept markers alone do not explain why either setting was applied.

Which source formatting to keep or clear before export

Decide what the formatting is for before clearing it. Preserve formatting intended to follow the content: a word that is bold because it is a warning, a product name in a character style, a superscript that is part of a unit. Clear an adjustment only when you have identified it as a fix for the source-language layout: kerning between two letters of an English word, tracking that pulled the last word of a line back up, a local leading change on three lines that were too tall. Where you cannot tell, leave it alone.

How to find and clear the overrides in InDesign

Work on a copy of the InDesign document.

The IDML you are about to send is one way to inspect the source formatting. Copy it, rename the copy to .zip, extract it, and search the Stories/ folder with find-in-files for KerningValue=, Tracking=, BaselineShift=, HorizontalScale= and AppliedLanguage=. These attributes are written only where the text departs from its styles, so each hit is a local override. The searches identify ranges to inspect; they do not tell you what each override is for, and they are not a complete check of all character- and paragraph-level overrides. A uniform override across a whole paragraph does not, by itself, create an internal range boundary.

In InDesign, the tool for clearing local formatting is the Clear Overrides in Selection button on the Paragraph Styles panel. It removes every override in the selection, character-level and paragraph-level, and returns the text to what its styles define. That includes overrides you meant to keep, which is why the order matters.

  1. Define a character style for each kind of formatting you intend to keep. A Bold character style that leaves point size unspecified does not set the text size; after overrides are cleared, the size follows the paragraph style unless the character style defines it. If your emphasis also changes the point size, that change has to be in a style as well, which may mean one style per size. Paragraph-level formatting you need to keep belongs in paragraph styles in the same way.
  2. Convert the local formatting to those styles with Find/Change. If you are preserving different point sizes, process each size separately with the matching character style; the following example applies where one Bold character style is sufficient. On the Text tab, leave Find what and Change to empty, set Search to Document, set Find Format to Font Style: Bold, and set Change Format to apply the Bold character style. Use Find Next on the first few matches to confirm they are the emphasis you expect before you use Change All. Repeat for italic. Other formatting you want to keep needs its own search criteria and its own style.
  3. Review the AppliedLanguage hits from the XML search. A local language override is cleared along with the other overrides. Where a language difference is intentional, preserve it together with the other attributes required for that text.
  4. Clear all overrides in a story only after you have confirmed that every remaining override in it can be removed. If any are unresolved, leave that story unchanged. Once that condition is met, place the cursor in the story, select all of its text, and click Clear Overrides in Selection. The character styles you applied in step 2 are not overrides, so they stay; the remaining kerning, tracking and baseline shifts go. Check footnotes, table cells and text inside anchored frames separately before treating the cleanup as complete.
  5. Export the IDML again and repeat the XML searches. Look at what is still there and decide whether each remaining hit is one you chose to keep.

This changes the layout of the copy. Lines that were held together by tracking will break differently.

What cannot be removed

Footnote references, anchored objects, index markers, cross-references and inline tables all appear as tags, and they have to. They are structure, and the target document needs them in the corresponding places. Character styles that mark meaning also stay.

If you are the translator

If you receive the IDML for translation, do not delete tags simply because they interrupt a word. Ask the document owner to review the source formatting. The cleanup described here takes place in InDesign, before a new IDML is exported.

Related

Share: X Email