XS websites can use several user interface languages. The process of translating your websites to other languages is called Localisation. Adding support for additional locales doesn’t affect the metadata, it affects the client facing website user interface language only. I.e. messages, labels, text on buttons, in menu’s and so on.
The instructions in this article are for the French language. Additional languages (German and Spanish) are scheduled for future versions of XS.
Information about using tags versus using condition blocks and literal text in the code editor
It is recommended that you use xs tags whenever possible. If you do, the same term will be displayed the same everywhere it is used, and additional languages will be automatically used – e.g. if you want to add German or Spanish later on.
So for example, use
If you are to add German later in time (locale 4) then you will have to manually add it in the above example, but it will be automatically available if you use a locale or constant tag instead.
You can of course only use tags for values that are stored in the database or in constant files. If not, then your only option is to use literal text like in the print() example above.
If you need to use apostrophes in your literals then use the HTML code ' instead. For example:
If you need to use commas then use , instead, e.g.
For more information about using the XS coding language, read the article Infradox XS customisation.
Note that there’s a difference between the and the tags. The first takes values from the constants files, the latter takes values entered in the (backoffice) repository and falls back to constants files if no value is found.
How to enable additional languages in back office
Go to Site Configuration, General settings, User interface language, Country & Timezone – and enable French by ticking the checkbox. Click Save at the bottom of the page.
If you use the default website templates, a language dropdown will automatically appear above the main menu. If you have a custom header/menu template, then you will need to make changes to the template in the code editor. You can then also enable additional languages without making the language dropdown visible on the client facing pages – that way you can work on your translations and hide the language menu until you’re done (see below).
Switch language question
If a user from a country for which you have enabled a locale visits your website, then you can ask the user if he/she wants to switch languages. The question will appear only once per session, and only if the current locale is not already the user’s locale. E.g. if the website is displayed in English and the user’s IP address is in France, then ask if the user wants to switch to French.
If you want to use this function, then tick the checkbox for “Enable language switching question” (in Site configuration > General settings > User interface language.
Working on translations without showing the language menu on the client facing pages
If you need to switch between languages while the drop down for this is not (yet) showing on the client facing pages, the use the following URL:
- www.websitename.com/locale/1?r=/ for locale 1 (English)
- www.websitename.com/locale/2?r=/ for locale 2 (Dutch)
- www.websitename.com/locale/3?r=/ for locale 3 (French)
Pages with editable text on the client facing pages
Several pages can be edited directly on the client facing pages. For example the Contact us page. If no text is found for the active locale, then the text that exists for the first locale is automatically copied. You can click the text to show the editor and you can then translate the page text.
It is recommended that you switch to “source view” in the editor so that you can make sure not to replace the markup, but just the text. To switch the editor to “source view” – click the right-most icon in the editor toolbar. When you hover over the button it will display a hint “Show Source”.
* Note that there are pages that you may not be able to see in the normal menu when you are logged in (which you are if you are making changes to texts on pages). You can enter the URL for those pages in your browser’s address bar.
For example (replace www.mywebsite.com with the name of your website) http://www.mywebsite.com/register
- /register for the registration page
- /loginpage for the fullscreen version of the login page
- /activate/x/a for the account activation page (note that the page won’t work but you will be able to change the text on it)
- /resendactivation for the page that one can use to send the actication again (if the user didn’t receive it)
* Also don’t forget to change the text that is shown in “pop ups” – so without direct URL access. For example:
- The terms & conditions text that is displayed when you click the “accept” link on the registration page.
- The delivery terms that are displayed via a link on the cart/order page
Literals that you have used in the code editor
If you have used literal text in your customised templates, the use the code editor to add translated texts where necessary. You can use the print tag for this purpose. For example:
Or if you want to skip Dutch,
Note that the literals are within apostrophes and start with the locale number (1 for English, 2 for Dutch and so on). So if you need an apostrophe in your literal text, then use its html code instead. E.g. use ' for an apostrophe.
Content field labels
To change the labels for content fields (e.g. credit, caption, headline and so on) edit the metadata repository. Comma separate the labels in the order English, Dutch, French, German, Spanish. You can skip languages that you don’t want to use. Eg. for just English and French you would enter English,,French – note the two commas between the words.
Labels, default texts et cetera
XS will automatically take default values from the constants files if there’s no value specified in Back office. This is the case for many, but not all labels (read below). It is recommended that you remove all values that you may have entered in all sections of Site configuration, Pages and menu. If you do this you won’t have to add localised labels in Back office, not even if additional languages become available in later versions. Note that you can change the constants files if you wish.
Lists for dropdowns used in forms et cetera.
If you have uploaded lists that you use in your forms, e.g. a list with company types for the registration form and/or a list with subjects for the contact us form and so on – then you should also upload those list files with your translations. If you have configured lists and the list for the active language is not available, then the English version is used. E.g. companytypes_us.txt. To add company types in French, you should upload companytype_fr.txt
You can upload your lists via Site Configuration > Website files > Website list files. The page explains what file names you should use.
Labels and values that you must translate in backoffice manually
Custom search filters
If you have defined custom search filters, then you will have to add translations for the additional language that you are using. If for example you have a custom filter for Gender, then add the values for French in the format 3=word (see below).
The example above shows filter settings for English (1) and French (3). You can skip locales that you don’t use.
The labels that you enter for the input fields on the cart (also shown on orders) must be entered manually as there are no defaults for these fields. Go to Site configuration, Cart page and enter the labels in the sections Detail form rights managed images and Detail form rights managed video (if you have video).
The order in which you enter the labels is important so please read the instructions that are shown on the backoffice pages carefully. If you don’t use certain languages/locales, then you don’t need to enter a label for that locale – just use a comma instead. For example:
The above example lists the label for English and French only. Dutch (the 2nd locale) is not entered – note the two commas.
The textbox for predefined values requires you to separate options with semicolons, and locales with commas. For example:
Book;Magazine;Website, Boek;Tijdschrift;Website, Livre;Magazine;Site Internet
The example above uses three options for each language (English, Dutch and French). The options are separated with a semicolon, and the languages are separated with a comma.
The titles and descriptions are stored in the database. If you enable a new language/locale after you have already created galleries, then the database doesn’t have the versions for the new language yet. To be able to translate existing gallery titles and descriptions, you must first use the synchronize function. This will create a copy of the gallery data for the selected language that you can then translate.
Open the Gallery manager (from the Admin toolbar). Select French in the drop down at the top on the right. Click the “Sync” button next to the drop down. Confirm and wait for the website to reload. You can now open the Gallery manager again. Select French again and then you can start the translating process.
NOTE that if you use custom pages (e.g. a custom home page) that lists gallery titles, then your translated titles may not immediately show. This has to do with caching. It is recommended to translate many titles at once and to the clear the server cache via Site configuration > Data services. Click both the buttons Clear database cache and Clear parsed strings cache. Then reload the page you want to check.
XS websites send several e-mails, both to end users and administrators. You can change and/or translate the templates via Site configuration, e-mail templates. You can find more info here.
The following templates are in the English locale folder only. These (admin notification) messages are always in English (unless you create local copies in other languages).
- adminsearchreqnotif.txt – admin notification for a new search request
- adminusernotification.txt – admin notification for a new user
- adminordernotification.txt – notifcation about a new order or an order (status) change
- ceform.txt – e-mail for properties posted with custom forms
- contactus.txt – e-mail for properties posted by the “contact us” form
- myaccount.txt – notification sent to let you know a user changed his/her account details or requested you to do this
- pcquote.txt – e-mail sent when a user posted a “quote request” with the price calculator dialog
- printform.txt – e-mail sent when a user posted a “buy print” request
- quotechangetoadmin.txt – notification sent when a user replies to a quote request
- quoterequest.txt – notification sent when a new quote request is posted by a user
- security.txt – notifications about possible security problems
- sysadmin.txt – notification that’s sent when someone logs in the sysadmin account
The following templates are available in all folders and need to be changed/translated as required
- activation.txt – the e-mail a new user receives with a link to activate the account
- adminuserordernotification.txt -notification sent to a user when an order is created in his/her account by an admin
- admoprops.txt – notification to let the user know his/her order has changed
- contributorcontact.txt – e-mail sent to a contributor when a user uses the “contact contributor” form
- cprofilelink.txt – e-mail when a user sends a link to a contributor’s profile
- invoice1.txt – e-mail for sending invoices (PDF attachment) to users
- invoicenotification.txt – e-mail notification to let the user know a new invoice was created for him/her
- invreminder.txt – e-mail sent about unpaid invoices
- lightboxajaxsmtp.txt – lightbox link e-mails that users and admins can send
- pagelinkajax.txt – e-mail used to send links to pages by users (e.g. a preview page, a gallery page and so on)
- passwordchanged.txt – e-mail to let the user know his/her password was changed
- passwordreset.txt – e-mail with a link to reset the user’s password. Passwords are never sent
- quotechangetouser.txt – e-mail sent to the user when an admin changes a quote request
- resendactivation.txt – e-mail sent to the user when he/she posts the “resend my activation e-mail” form
- reservationreminder.txt – e-mail sent to let the user know a reservation is about to expire or has expired
- reservationreminders.txt – e-mail sent to let the user know multiple reservations are about to expire or have expired
- restrictionreminder.txt – e-mail sent to let the user know a restrictionis about to expire or has expired
- restrictionreminders.txt – e-mail sent to let the user know multiple restrictions are about to expire or have expired
- searchreqnotification.txt – e-mail sent to the user when an admin changes a search request
- sendfileajaxsmtp.txt – template used to send files by e-mail (as attachment) from the order pages
- usageconfirmation.txt – used to send reminders to users if there’s a file that is waiting for usage confirmation