Skip to main content
← All guides

8 min read

SFCC: translate a multilingual catalog (xml:lang) in Excel

By Quentin Delepierre, Salesforce Commerce Cloud consultant

In a Salesforce Commerce Cloud catalog export, each translated text is a tag with an xml:lang attribute. In Excel, ExcelifyXML turns it into one column per language: you translate in the spreadsheet, then rebuild the XML to import back. Here are the exact column names, the steps, and what happens when you add a language, empty a cell or translate HTML.

Got your own XML? Drop it in and see it as a table, free and with no account. For an Excel file you can edit and then rebuild into an XML that keeps its structure, a free account is all you need.

Transform a file

Simple Excel table, free with no account, for files up to 1 MB. File that rebuilds into XML: free account, 3 free credits, no credit card.

Download an example result (.xlsx)Example source XML

How SFCC stores translated texts

In a catalog export, a localized text is repeated once per language, the language being carried by xml:lang: x-default for the default value, then fr-FR, en-GB… This applies to the name (display-name), the short description (short-description), the long description (long-description) and translated custom attributes. Invented example, with two products:

Extract from an invented catalog
<catalog xmlns="http://www.demandware.com/xml/impex/catalog/2006-10-31" catalog-id="demo-catalog">
  <product product-id="P100">
    <display-name xml:lang="x-default">Linen shirt</display-name>
    <display-name xml:lang="fr-FR">Chemise en lin</display-name>
    <display-name xml:lang="en-GB">Linen shirt</display-name>
    <short-description xml:lang="x-default">Light summer shirt.</short-description>
    <short-description xml:lang="fr-FR">Chemise légère pour l'été.</short-description>
    <long-description xml:lang="x-default">&lt;p&gt;Pure linen.&lt;/p&gt;</long-description>
    <long-description xml:lang="fr-FR"><![CDATA[<p>Pur lin.</p>]]></long-description>
    <custom-attributes>
      <custom-attribute attribute-id="careInstructions" xml:lang="x-default">Machine wash cold</custom-attribute>
      <custom-attribute attribute-id="careInstructions" xml:lang="fr-FR">Lavage en machine à froid</custom-attribute>
      <custom-attribute attribute-id="badge">new</custom-attribute>
    </custom-attributes>
  </product>
  <product product-id="P200">
    <display-name xml:lang="x-default">Wool scarf</display-name>
    <display-name xml:lang="fr-FR">Écharpe en laine</display-name>
    <display-name xml:lang="en-GB">Wool scarf</display-name>
    <short-description xml:lang="x-default">Warm winter scarf.</short-description>
    <long-description xml:lang="x-default">&lt;p&gt;Soft wool.&lt;/p&gt;</long-description>
    <custom-attributes>
      <custom-attribute attribute-id="careInstructions" xml:lang="x-default">Hand wash</custom-attribute>
      <custom-attribute attribute-id="badge">sale</custom-attribute>
    </custom-attributes>
  </product>
</catalog>

One column per language

ExcelifyXML names each column after the field, then the language in square brackets. For custom attributes, the column carries the attribute ID, then the language. Here are the columns the engine gives for the example, one row per product:

  • As soon as one product has a language for a field, that field has a column for that language, for every product: the cell is empty for those with no text in that language (here short-description[fr-FR] of P200). Filling one of these cells creates the tag, with its xml:lang.
  • A site-specific attribute also carries the site, placed before the language: custom-attribute[badge][SiteFR][fr-FR].
  • A field that exists in a single language in the whole file has no per-language column: it has two columns, the text (short-description) and its language (short-description.@xml:lang). Don't edit the language column, it changes the tag's language.
The resulting columns
@product-id , display-name[x-default] , display-name[fr-FR] , display-name[en-GB] , short-description[x-default] , short-description[fr-FR] , long-description[x-default] , long-description[fr-FR] , custom-attributes.custom-attribute[careInstructions][x-default] , custom-attributes.custom-attribute[careInstructions][fr-FR] , custom-attributes.custom-attribute[badge]
P100 , Linen shirt , Chemise en lin , Linen shirt , Light summer shirt. , Chemise légère pour l'été. , <p>Pure linen.</p> , <p>Pur lin.</p> , Machine wash cold , Lavage en machine à froid , new
P200 , Wool scarf , Écharpe en laine , Wool scarf , Warm winter scarf. , , <p>Soft wool.</p> , , Hand wash , , sale

The flow, from export to re-import

  1. Export the catalog from Business Manager.
  2. If a language to translate isn't in the export yet, add it first (next section).
  3. Drop the file on ExcelifyXML. In the free preview, check that the row is a product (a file that also holds categories adds a _type column), confirm with “Transform to CSV — 1 credit” and choose the Excel file (.xlsx).
  4. Prepare the translators' work: in a copy, keep the product ID, the x-default column as a reference and the columns of the language to fill. Filter the language column on empty cells to spot what is left to translate. They rename no header.
  5. Bring the translations back into the original file with Paste Special › Values, save, then drop the Excel file, alone, on the Rebuild page (free).
  6. Import the XML into Business Manager, on a sandbox first, in Merge mode.

Adding a language that isn't in the export

The rebuild only writes the languages the original file holds. A column added by hand in the spreadsheet, for example display-name[it-IT], and filled in, doesn't go through: the rebuild stops on the “Filled cells won't be in the XML” screen, which lists the column (“added column, not in the original file”) and the rows at stake. A column added but left empty triggers nothing and writes nothing. The same stop applies to a custom attribute, such as custom-attribute[careInstructions][it-IT].

For a language to exist, one tag of that language in the original XML is enough, on a single product. The simplest way: add an empty tag to the first product, right after the other languages of the same field, then transform that edited file. Example for Italian:

  • The display-name[it-IT] column appears, for every product, right after display-name[en-GB]. The preview flags the empty tag (it disappears if nobody fills it); that is expected.
  • Do the same for each field to translate (short-description, long-description, custom attributes), always in the first product and after the field's other languages: the column takes the place of the first tag met.
  • A cell left empty in the it-IT column writes nothing: only translated products get the tag, with xml:lang="it-IT".
  • Activate the language in Business Manager first: a language has to be activated before it can be used for catalog data.
An empty tag to create the it-IT column, in the first product
<display-name xml:lang="x-default">Linen shirt</display-name>
<display-name xml:lang="fr-FR">Chemise en lin</display-name>
<display-name xml:lang="en-GB">Linen shirt</display-name>
<display-name xml:lang="it-IT"/>

Another way: one row per text, adding a language by adding rows

If you'd rather not touch the XML, change the row tag: in the preview, open “Not the right row?”, choose “Another tag” and type display-name. The table becomes long: one row per text, with the product ID, the language and the text. Adding a language then means adding rows at the bottom of the table, one per product.

  • The two added rows are written: each product gets a <display-name xml:lang="it-IT"> after its other display-name tags. No column to create.
  • Same principle for custom attributes, with custom-attribute: the columns are product.@product-id, @attribute-id (the attribute ID), @xml:lang and #text.
  • The trade-off: one transformation per tag (1 credit each) and one table per field (name, descriptions, attributes). The wide table, one column per language, remains handier to compare languages side by side.
One row per display-name, with two rows added at the bottom for Italian
product.@product-id , @xml:lang , #text
P100 , x-default , Linen shirt
P100 , fr-FR , Chemise en lin
P100 , en-GB , Linen shirt
P200 , x-default , Wool scarf
P200 , fr-FR , Écharpe en laine
P200 , en-GB , Wool scarf
P100 , it-IT , Camicia di lino
P200 , it-IT , Sciarpa di lana

x-default: keep it filled

x-default is the default value. When a text doesn't exist in the requested language, SFCC falls back, according to the fallback set in Business Manager, to the language and then to the default value. Use the x-default column as the translators' reference, and don't empty it by accident: an emptied x-default cell removes the product's x-default tag, the other languages staying in place.

Emptied cells

  • A cell you empty removes its tag from the rebuilt XML (tested on an en-GB translation and on x-default). In Merge mode, Business Manager then keeps the existing value: the text isn't erased in SFCC. To erase a translation, do it in Business Manager.
  • A cell that was empty and that the translator didn't fill writes nothing: the product has no tag in that language, nothing is imported for it.
  • If a translator empties a cell meaning to fix it later, the existing translation stays as it is after a Merge re-import: review empty cells before rebuilding.

Long descriptions, HTML and line breaks

  • A description that contains markup (<p>, <ul>…) is written back as CDATA, whether it arrived as CDATA or with escaped angle brackets (&lt;p&gt;): the text is the same, the XML stays valid. A translator leaves the HTML tags alone and only edits the text between them; new HTML in a cell is also written as CDATA.
  • A character like “&” in plain text is written &amp;: nothing to do on your side.
  • Line breaks in a description (the &#13; of Business Manager exports) are kept. To add some in a cell, use your spreadsheet's shortcut (Alt+Enter on Windows, Ctrl+Option+Enter on Mac). In HTML, a line break doesn't change the display: use <br> or <p>.
  • Non-Latin alphabets (Japanese, Russian, Arabic…): the Excel file (.xlsx) keeps every character. With the CSV, save as “CSV UTF-8”, otherwise Excel replaces with “?” what its “CSV” can't write.

Many languages and sites: the 16,384-column limit

Each attribute × language × site combination is a column. With 60 translated, site-specific custom attributes, 22 languages and 13 sites, that makes 60 × 22 × 13 = 17,160 columns, above the 16,384 Excel keeps.

In that case the preview warns you and the Excel file (.xlsx) isn't offered; the CSV is still available, but a spreadsheet cuts it when it opens, and the rebuild stops on the cut CSV. To keep only some languages or sites, first prepare the file with “Prepare your file” (free, no account): you get back under Excel's limit before transforming.

  • One row per custom-attribute: when the table goes over 16,384 columns, the preview suggests it among the narrower row tags (“Not the right row?”). The table becomes long instead of wide: in this example, 17,160 rows per product but only 5 columns (product.@product-id, @attribute-id, @xml:lang, @site-id and #text), far from Excel's limits.
  • That row only holds the custom attributes: the other texts (display-name, descriptions) stay as they are in the XML. To translate them too, run a separate transformation with “Another tag” (display-name, for example). Each transformation costs 1 credit.
  • Shrink the file before dropping it: export fewer objects if your export allows it. In Merge mode, what isn't in the imported file isn't changed.

Transform your Business Manager export to translate its texts in Excel:

Transform a file