Skip to content

Building a Multilingual Product Catalog

Selling in a second country usually starts with a spreadsheet of translations and a column called name_de. By the third language there are name_fr, description_fr and name_de_at, every query has to know which column to read, and adding Italian is a database migration.

There is a better shape for translated content, and it is the one the web already uses.

One field, many languages

Instead of one column per language, make every text meant for people a list of values, each tagged with its language. That is how JSON-LD represents translated text, and how ObjectsGrid stores name, description and every other localized field, as language-tagged strings:

"name": [
  {"at_language": "en", "at_value": "Trail Running Shoe"},
  {"at_language": "de", "at_value": "Trailrunning-Schuh"},
  {"at_language": "de-AT", "at_value": "Trailrunning-Schuh"},
  {"at_language": "fr", "at_value": "Chaussure de trail"}
]

Adding a language is adding an entry. No schema change, no migration, and products that aren't translated yet simply have fewer entries.

Use real language tags

Tag each value with a BCP 47 language tag: en, de, fr, and a region where it matters, de-AT for Austria or fr-CA for Canada. They are the same tags browsers send in Accept-Language, HTML uses in lang and search engines use in hreflang, so one value flows from your catalog to the page without translation tables.

Tag the language, not the country: Swiss shoppers read de-CH, fr-CH and it-CH, and Spanish is one language in twenty countries.

Fall back gracefully

Not every product will be translated into every language on day one. Decide the fallback order once, and apply it everywhere:

  1. The exact tag the shopper asked for, de-AT.
  2. The base language, de.
  3. Your default language, en.
function pick(values, wanted, fallback = "en") {
  const base = wanted.split("-")[0];
  return (values.find((v) => v.at_language === wanted)
       ?? values.find((v) => v.at_language === base)
       ?? values.find((v) => v.at_language === fallback)
       ?? values[0])?.at_value;
}

With the REST API you can also ask for one language with the lang parameter; with GraphQL, select at_language and at_value and pick on the client. Either way, a list request is billed once, however many languages it carries.

Translate text, not facts

Only text meant for people is localized. Everything else stays the same in every language, and should be stored once:

  • Identifiers: SKU, GTIN, MPN.
  • Measurements: a weight of 280 grams is a number and a unit, a QuantitativeValue; format it for the reader at display time.
  • Enumerations: availability is https://schema.org/InStock in every language; translate its label in your UI.
  • Codes: countries are ISO 3166 (DE), currencies ISO 4217 (EUR).

Prices belong to markets, not languages

A German-speaking shopper in Switzerland pays in francs; one in Germany pays in euros. Keep prices out of the product and in Offers, each with its price, priceCurrency and eligibleRegion, and choose the offer by the shopper's market, not by the language of the page.

Tell search engines about every language

  • Give each language its own URL, such as /de/ and /fr/, rather than switching language by cookie: search engines index URLs, not cookies.
  • Link the versions to each other with hreflang, including x-default for the fallback:
<link rel="alternate" hreflang="en" href="https://shop.example.com/en/trail-running-shoe">
<link rel="alternate" hreflang="de" href="https://shop.example.com/de/trailrunning-schuh">
<link rel="alternate" hreflang="x-default" href="https://shop.example.com/en/trail-running-shoe">
  • Publish structured data in the page's language, with the offer for that page's market.

Keep your data where your market needs it

Selling in the EU and the US often comes with rules on where customer data lives. ObjectsGrid lets you choose the EU or the US for each Organization Account, so each market's data stays in its region; see Security and compliance.

A catalog built this way grows by language without growing in complexity. The data model guide has the details.