Localization
You can set up localization for your website and add product descriptions in different languages. This will help you be more customer-centric and increase loyalty to the game. You can perform localization for:
Site Localization
To localize the website interface:
- Open the project in Publisher Account.
- Click on Project Settings.
- In the General Settings window, select the languages you want to localize the site into.
- In the Project Name field, specify the localized project name in other languages.
- Click Save.
- In the side menu, click on Site Builder.
- In the card of your site, click on Open Site Builder.
- Go to the Language Settings section and set switches for the required languages to On.
- Choose where the language selection button will be located. In the Language selector position panel, select Header and/or Footer.
After enabling localization, all elements of the website interface will be translated into the selected languages. By default, text fields and translations prepared by Xsolla are used. To change the default translations, double-click on the text field and enter your own version.
Localization of product names and descriptions
To localize purchases on the site (for example, Virtual Items):
- Open the project in Publisher Account.
- Click on Project Settings.
- In the General Settings window, select the languages you want to localize the site into.
- In the Project Name field, specify the localized project name in other languages.
- Click Save.
- In the side menu, click Store.
- In the Virtual Items module, click on Configure or Connect.
- From the drop-down menu, select Create Item or click Edit Item in the context menu of an existing item.
- Add the Item name and Description to all languages for which you have enabled localization.
- Click Save changes.
- In the side menu, click Site Builder.
- In the card for your site, click on Open Site Builder.
- Go to the Language Settings section and set switches for the required languages to On.
- Go to Store section and select the group of items for which localization is configured.
Image localization
You can add an image with text written in a specific language to your website using custom HTML code. You can use a ready-made solution or add your own code.
Example of using an existing solution
- Open the project in Publisher Account.
- In the side menu, click Site Builder.
- In the card for your site, click Open Site Builder.
- Go to the Language Settings section and set switches for the required languages to On.
- Add the following content to the Custom Code block:
- html
<div class="image-container">
<img class="localised-image lazy loaded" data-src="https://cdn.xsolla.net/merchant-bucket-prod/files/uploaded/sitebuilder/71070/bc6d3c723c6381e85fbb929563922ecb.jpg" />
</div>
In the CSS section:
- css
.image-container {
text-align: center;
padding: 4em 1em;
}
.image-container img {
width: 100%;
}
In the JavaScript section:
- In the
htmlLang
parameter specify the language for which you are adding the localized image. - In the
localisedImage.dataset.src
parameter, specify the link to the localized image.
The maximum allowable image size is 10 MB.
- To add multiple languages for localization, duplicate the JavaScript code fragments with the necessary parameter values.
- javascript
const htmlLang = document.documentElement.lang;
const localisedImage = document.querySelector('.localised-image');
if (htmlLang === 'es') {
localisedImage.dataset.src = 'https://cdn.xsolla.net/merchant-bucket-prod/files/uploaded/sitebuilder/71070/bc6d3c723c6381e85fbb929563922ecb.jpg';
}
if (htmlLang === ‘it’) {
localisedImage.dataset.src = 'https://cdn.xsolla.net/merchant-bucket-prod/files/uploaded/sitebuilder/71070/bc6d3c723c6381e85fbb929563922ecb.jpg';
}
- Click Preview to see the changes. The image will be localized only for the languages you have specified in the Custom Code block.
Adding your own code
- In the Builder, click Add block and choose Custom code.
- Insert your own code to the block.
Found a typo or other text error? Select the text and press Ctrl+Enter.