top of page
This website was created by Code Enhancement Studio
Writer's pictureQuentin Plomteux

Translate dynamic content in Wix

This is a chat summary of a question that has been asked on Velo's discord.


Wix offers an app to manage static content translation but it does not support dynamic content.

Here is an overview of a few techniques you could use to translate your Wix website database content using Velo.

1. For large content such as blog posts, stories

Having a collection where we duplicate content for each language. In the case of a blog post the collection would have the fields

{
    id: string,
    contentId: string,
    language: string,
    title: string, 
    content: string,
    isDefault: boolean
}

We added a field contentId as a key to link all duplicates of a given item. We flag one of the duplicates as default (e.g. English) and use it as the fallback version if a translation is missing.

2. For small translatable content such as Products, statistics

We use 2 collections, for instance, products and productsTranslations


The first collection keeps the universal information (weight, price, picture) and the second one stores translatable information (language, title, description).


productsTranslations has a reference field that points to an item of products so we can easily include it.

A benefit of this technique is that we can have different URLs for each language.

The drawback is if a translation is missing you don't have any product to show.


3. For small content with a fallback mechanism such as email

This will work only if we have a few fields of data to translate into a small number of languages.


In a single collection, use object fields instead of text fields and have all the text translated within an object.

{
    title:{default: 'Here is your download',french: 'Voici votre         telechargement'},
    action: {default: 'Click to download', french: 'clicker pour     télécharger'}
    downloadLink: "...",
    recipientName: "John Doe",
}

Technique 1 works well if our content is rarely modified after our initial translation and does not share critical information between translations.

It also lets us create dynamic pages with a common URL for all our languages (based on the contentId). It also works great with the dataset.


Here is an example of a dynamic page that translates according to the user language: https://en.kullentours.com/baeredygtighed/bicycling-with-wine-beer-tasting

Technique 2 is better if you have a lot of information that needs to be the same whatever the language or if you often update part of your data (such as price, inventory,....) This technique is also compatible with datasets as well.


Technique 3 is for consistency and if you need a single URL for all your translation but the problem is that it does not let you use datasets to bind your text elements. Also, translation will be hard to manage through the editor so I do not recommend it. More info about Wix Multilingual App and its limitation: - https://support.wix.com/en/article/wix-multilingual-translating-your-site - https://support.wix.com/en/article/wix-multilingual-translatable-content

55 views0 comments

Comments


Anchor 1

Need help with Velo ?

We provide tutoring and debugging session to all skills levels.

From amateurs to professional developers, help writing high-quality code for performance and security

Maybe later
bottom of page