Forms placed on any page will persist on that page regardless of what language is set in the session. Multilingual forms are expected to make use of default language properties and display the language set in the session.
Default language variables have been set within language properties files in several languages in the following directory:
In these language properties files, common terms such as “Submit“, “Forgot Password“, “Name“, “month“, and many more have already been translated in multiple languages. However these default laguage variables can be over-ridden or new variables added on the dotCMS backend as global language variables.
To make sure all fields in your multi-lingual form are internationalized, first add them all as language variables, including all of their multilingual versions, and then add the EXACT case sensitive name of that variable on the Form Structure as a field.
Here's an example of how to internationalize form field labels for English and Spanish so that “First Name” and “Last Name” are internationalized:
First Name and Last Name set in English (note that the language property can't have spaces or special characters):
First Name and Last Name set as Spanish Language Variables using same Language key:
After setting the Language Keys, use those keys on the Form Structure as shown below:
When the Form is placed on a page and that page is viewed with the language setting set to English (language_id=1), or Spanish (language_id=2), the form will automatically translate the form labels using the Language Key values.
Example Form in English
Example form in Spanish