< Back to Multilingual Issues

Using multiple languages for fields

For true mutlilingual support, you may want to have topic and forum info in several languages and display in the appropriate language for each visitor. As of the 9.0.14 release, this is handled automatically for forum names and descriptions and topic names and descriptions. Note that if the currently selected language isn't available for a forum/topic, the version in your default language (as set at Admin -> Customizations -> Language) will be shown.

To apply to other fields, or for older versions, read on. New topic fields of the form languagenametitle and languagenamedescription will be automatically displayed as the value for {LINKTITLE} and {LINKDESCRIPTION} when the languagename language is selected and we're not on the add/edit pages. For example, the value of the field spanishtitle will automatically show as a link's title when browsing in Spanish. If a translation is not available for the user's selected language, the regular field's content will be shown (fallback is automatic).

Important: Make sure you decide which of your languages is the default language, and only add new fields for non-default languages. Let the default language use the standard fields.

For Additional Topic Fields In WSN 9.0+

Go to Admin Panel -> Topics -> Topic Fields and click "Add New Topic Field" at the top. Fill out the selections to match the standard version of the field (check the edit field page for the standard field), but specify in the title/description which language it's for. Then in the "Template Variable:" area be sure to change the template variable name to LANGUAGENAMEFIELDNAME -- so for a Spanish topic title, use SPANISHTITLE.

If you're translating the topic description field, you'll need to make a few changes to the custom input html. Start by copying the standard field code:

<textarea name="description" id="description" class="submitdescription">{LINKEDITORCONTENT[description]}</textarea>
<p class="charsleft"><span id="counter_description">{LINKDESCRIPCHARSLEFT}</span> {LANG_SUGGESTLINK_CHARSLEFT}</p>
<IF {SWITCH_WYSIDESCRIP}><p class="editormodeops"><select name="editormode">{EDITORMODEOPS}</select></p></IF>

Then bulk replace every instance of description with spanishdescription (or yourlanguagedescription), and finally change class="submityourlanguagedescription" back to class="submitdescription".

For Other Types of Fields, or Earlier Versions

Go to Admin Panel -> Customizations -> Add Fields and add new fields for each language/field you want to make multilingual. You're most likely to want to do title and description for links and then name and description for forums.

For an example, to have French versions of the forum names and descriptions go to Admin Panel -> Customizations -> Add Fields and add the forum fields french_name and french_description (assuming the language pack is named languages/French.lng).

If you're doing topic description fields for different languages, you'll want to have the WYSIWYG editor and character counter just like the regular description field. The basic textarea you get by adding your custom field doesn't get you that, so remove that textarea from your custom fields template. Then, copy the description code from the submit/edit templates:
<tr>
<td class="labelscolumn"><span class="labels">{LANG_GENERAL_DESCRIPTION}:</span>
<IF {LINKSMILIESALLOWED} or {LINKCODESALLOWED}>
<ul>
<IF {LINKCODESALLOWED}><li>{LANG_GENERAL_USECODES}</li></IF>
<IF {LINKSMILIESALLOWED}><li>{LANG_GENERAL_USESMILIES}</li></IF>
</ul>
</IF>
<IF {SWITCH_WYSIDESCRIP}><p class="center"><select name="editormode">{EDITORMODEOPS}</select></p></IF>
</td>
<td class="optionscolumn">
<textarea name="description" id="description" class="submitdescription">{LINKEDITORCONTENT[description]}</textarea>
<p class="charsleft"><span id="counter">{LINKDESCRIPCHARSLEFT}</span> {LANG_SUGGESTLINK_CHARSLEFT}</p>
</td>
</tr>


You'll need to make a few changes to this to adapt it to your new field to use it with the frenchdescription field:

Completed frenchdescription example:

<tr>
<td class="labelscolumn"><span class="labels">{LANG_CUSTOM_FRENCHDESCRIPTION}:</span>
<IF {LINKSMILIESALLOWED} or {LINKCODESALLOWED}>
<ul>
<IF {LINKCODESALLOWED}><li>{LANG_GENERAL_USECODES}</li></IF>
<IF {LINKSMILIESALLOWED}><li>{LANG_GENERAL_USESMILIES}</li></IF>
</ul>
</IF>
<IF {SWITCH_WYSIDESCRIP}><p class="center"><select name="editormode">{EDITORMODEOPS}</select></p></IF>
</td>
<td class="optionscolumn">\n<textarea name="frenchdescription" id="frenchdescription" class="submitdescription">{LINKEDITORCONTENT[frenchdescription]}</textarea>
<p class="charsleft_frenchdescription"><span id="counter_frenchdescription">{LINKDESCRIPCHARSLEFT[frenchdescription]}</span> {LANG_SUGGESTLINK_CHARSLEFT}</p>
</td>
</tr>


You'll likely want to place your alternate language descriptions right below the main language description in the submit topic and edit topic templates.

You can also make multilingual forum description fields use WYSIWYG by copying the standard description from the submit forum/edit forum templates and making the same changes.

Note that the multiple-language character counter only works since WSN 8.0.14, and the WYSIWYG character counter since 8.0.0.