By using this website you implicitly accept our cookies. For more informations read our Cookie policy

Translations

In Marketcloud you can add multiple languages to your store and multiple translations to your products, categories, brands and more.

Table of contents

  1. Adding languages to your store
  2. Translating a product
  3. Using the translation in your code

Adding languages to your store

The first thing to do is to log into your store's dashboard and open the localization settings tab by clicking on system > localization.

To add a new language to your store, simply select a language from the selection menu and click "Add".

At this point you are able to add a translation (for the selected language) to each of the resources supporting translations:

  • Products
  • Brands
  • Categories
  • Collections
  • Notifications

Translating a product

Let's try it out. To translate a product, open the edit view of a single product by clicking on Inventory > Products and now click on one of your products. Here you can edit the product's properties and in the top right corner you can click on the dropdown menu and then on the edit translations button.

In the current view you can select the language you want to translate the product to and you can switch between all your store's languages.

As you can see, the view is almost the same as the edit product view, so you should already be familiar with it, the difference is that every information you change here will not affect the base product, just its translations.

With the same process you can translate the other resources listed above, just remember to navigate to the correct resource.

Using the translation in your code

Nerd alert

The following paragraph is meant for developers, so if you're not a developer and it doesn't make any sense to you, don't worry! The developer(s) building your store will surely understand this :)

Once a product (or another resource) has translations, you will se an attached property called "locales" to your JSON objects. This top level property contains other properties, each one represents a translation, let's see an example:


{
  "name" : "Javascript sticker"
  ...
  "locales": {
      "de-DE": {
        "name" : "Javascript Aufkleber",
        "description" : "Ein Javascript Aufkleber",
        "slug" : "javascript-aufkleber "
      }, 
      "it-IT": {
          "description": "Un adesivo javascript", 
          "name": "Adesivo Javascript", 
          "slug": "adesivo-javascript"
      },
      ...
  }
  ...
}

In this way, all you have to do to translate resources in your code, is to access the same property but filtered by locale:


  // Javascript example

  marketcloud.products.list({
    "slug" : "javascript-sticker"
  })
  .then( (response) => {

    var product = response.data[0];

    var germanProductName = product.locales["de-DE"].name;
    var italianProductName = product.locales["de-DE"].name;
  })
  ...

Questions?

We're super happy to help with any question you might have! Send us an email, or get in touch with us in our Slack channel !