Translating Vanilla
Want to help us improve our translations? We have a Transifex project for contributing to this. Create an account there and submit your improvements.
These docs are for developers working with Vanilla in Github -- typically Enterprise or Open source clients.
Need to customize the phrasing just on your site in particular? See “Overriding locales” below.
Translation tips
Want to help translate? Here are some tips for creating great translations.
- Please make sure that your changes use generic terminology and good grammar that can apply to all forums and avoids interest- or region-specific terms.
- Avoid HTML encoding of UTF-8 characters. For example, just use
ö
, not ö
. Vanilla’s entire stack is UTF-8 so the former always works, but our default emails are not HTML, so the latter will fail.
Installing locales
This only applies to those using Vanilla Open Source. Cloud customers can just enable the available locales from their dashboard.
- Download the locale you want from the Addon Directory.
- Upload the folder to your
locales
folder. - In the Dashboard, go to
Addons > Locales
. - Enable the locale.
- Change the Default Locale at the top of the page, and Save.
Make sure you have the Multilingual plugin installed which will allow each user to select their preference from all enabled locales.
Using multiple locales
This feature is only available on Vanilla Cloud. Learn More...
Subcommunities allow a single site to be split into multiple communities. Each community maps to a top level category and gets its own subfolder on the site. Everything inside this subfolder (categories, discussions, and anything else viewed from that subfolder) uses a locale specified in the dashboard. One site can have multiple subcommunities in different languages, and share the same user base, search system, and conversations.
The Multilingual addon allows each user select their preference from all enabled locales. You can enable it from your addons section.
Please note the Subcommunities plugin and the Mutli-lingual plugin can’t be activated at the same time.
Overriding locales
<?php if (!defined('APPLICATION')) exit();// Note about what you're translating$Definition['TranslationString1'] = "Override String 1";$Definition['TranslationString2'] = "Override String 2";// More stuff$Definition['TranslationString3'] = "Override String 3";$Definition['TranslationString4'] = "Override String 4";
Overriding all locales
You can override your default locale by adding a conf/locale.php
file to your installation with additional definitions. Any definitions in this file will override all locales.
To find out what the translation strings for core components are please check our open source Locales Repo. The core strings can be found in the tx-source/site_core.php
file.
If you are using Subcommunities or the Multilingual Plugin to enable multiple locales, please note his override will effect all locales.
Overriding locales with the Subcommunities plugin or the Multilingual plugin
If you have Subcommunities or the Multilingual plugin enabled you probably don’t want to use the same translation for every locale. In this case you will have multiple locale override files. One per locale. Places these in the locale/
folder of an addon and name them {locale-id}.php
. For example, the French language file would be located at /plugins/<someaddon>/locale/fr.php
or /themes/<sometheme>/locale/fr.php
.
locale/fr.php
<?php if (!defined('APPLICATION')) exit();// Note about what you're translating$Definition['TranslationString1'] = "Quelque chose en français";$Definition['TranslationString2'] = "Une autre chose en français";
locale/es.php
<?php if (!defined('APPLICATION')) exit();// Note about what you're translating$Definition['TranslationString1'] = "Algo en español";$Definition['TranslationString2'] = "Otra cosa en español";
Defining new translations strings
If you are creating a custom theme or plugin for a multilingual community you may want to offer translations strings for text defined in your theme/plugin. Vanilla offers ways to define these strings in Smarty Templates and in PHP.
https://success.vanillaforums.com/kb/articles/377-translating-vanilla