Translating Vanilla in Github - HL Vanilla Community
<main> <article class="userContent"> <div class="embedExternal embedImage display-large float-none"> <div class="embedExternal-content"> <a class="embedImage-link" href="https://us.v-cdn.net/6030677/uploads/QX7DDX1OEZDR/microsoftteams-image-288-29.png" rel="nofollow noreferrer noopener ugc" target="_blank"> <img class="embedImage-img" src="https://us.v-cdn.net/6030677/uploads/QX7DDX1OEZDR/microsoftteams-image-288-29.png" alt="MicrosoftTeams-image (8).png" height="108" width="1356" loading="lazy" data-display-size="large" data-float="none"></img></a> </div> </div> <h2 data-id="translating-vanilla">Translating Vanilla</h2><p>Want to help us improve our translations? We have a <a href="https://www.transifex.com/projects/p/vanilla/" rel="nofollow noreferrer ugc">Transifex project</a> for contributing to this. Create an account there and submit your improvements.</p><p><strong>These docs are for developers working with Vanilla in Github</strong> -- typically Enterprise or Open source clients. The general documentation on this topic is here: <a href="https://success.vanillaforums.com/kb/articles/377-translating-vanilla" rel="nofollow noreferrer ugc">https://success.vanillaforums.com/kb/articles/377-translating-vanilla</a></p><p>Need to customize the phrasing just on your site in particular? See “Overriding locales” below.</p><h2 data-id="translation-tips">Translation tips</h2><p>Want to help translate? Awesome! Here are some tips for creating great translations.</p><ol><li>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.</li><li>Avoid HTML encoding of UTF-8 characters. For example, just use <code class="code codeInline" spellcheck="false" tabindex="0">ö</code>, not <code class="code codeInline" spellcheck="false" tabindex="0">&ouml;</code>. Vanilla’s entire stack is UTF-8 so the former <em>always</em> works, but our default emails are not HTML, so the latter will fail.</li></ol><h2 data-id="installing-locales">Installing locales</h2><p>This only applies to those using Vanilla Open Source. Cloud customers can just enable the available locales from their dashboard.</p><ol><li>Download the locale you want from the <a href="https://open.vanillaforums.com/addon/browse/all/popular/recent/" rel="nofollow noreferrer ugc">Addon Directory</a>.</li><li>Upload the folder to your <code class="code codeInline" spellcheck="false" tabindex="0">locales</code> folder.</li><li>In the Dashboard, go to <code class="code codeInline" spellcheck="false" tabindex="0">Addons > Locales</code>.</li><li>Enable the locale.</li><li>Change the Default Locale at the top of the page, and Save.</li></ol><p>Make sure you have the <a href="https://open.vanillaforums.com/addon/multilingual-plugin" rel="nofollow noreferrer ugc">Multilingual plugin</a> installed which will allow each user to select their preference from all enabled locales.</p><h2 data-id="using-multiple-locales">Using multiple locales</h2><p><strong>This feature is only available on Vanilla Cloud. </strong><a href="https://vanillaforums.com/" rel="nofollow noreferrer ugc"><strong>Learn More...</strong></a></p><p><a href="https://docs.vanillaforums.com/help/multisite/#subcommunities" rel="nofollow noreferrer ugc">Subcommunities</a> 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.</p><p>The Multilingual addon allows each user select their preference from all enabled locales. You can enable it from your addons section.</p><p>Please note the Subcommunities plugin and the Mutli-lingual plugin can’t be activated at the same time.</p><h2 data-id="overriding-locales">Overriding locales</h2><pre class="code codeBlock" spellcheck="false" tabindex="0"><?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"; </pre><h3 data-id="overriding-all-locales">Overriding All Locales</h3><p>You can override your default locale by adding a <code class="code codeInline" spellcheck="false" tabindex="0">conf/locale.php</code> file to your installation with additional definitions. Any definitions in this file will override all locales.</p><p>To find out what the translation strings for core components are please check our open source <a href="https://github.com/vanilla/locales" rel="nofollow noreferrer ugc">Locales Repo</a>. The core strings can be found in the <a href="https://github.com/vanilla/locales/blob/master/tx-source/site_core.php" rel="nofollow noreferrer ugc"><code class="code codeInline" spellcheck="false" tabindex="0">tx-source/site_core.php</code></a> file.</p><p>If you are using Subcommunities or the Multilingual Plugin to enable multiple locales, please note his override will effect <strong>all</strong> locales.</p><h3 data-id="overriding-locales-with-the-subcommunities-plugin-or-the-multilingual-plugin">Overriding Locales with the Subcommunities plugin or the Multilingual plugin</h3><p>If you have <a href="https://docs.vanillaforums.com/help/multisite/#subcommunities" rel="nofollow noreferrer ugc">Subcommunities</a> or the <a href="https://open.vanillaforums.com/addon/multilingual-plugin" rel="nofollow noreferrer ugc">Multilingual plugin</a> 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 <code class="code codeInline" spellcheck="false" tabindex="0">locale/</code> folder of an <a href="https://docs.vanillaforums.com/developer/addons" rel="nofollow noreferrer ugc">addon</a> and name them <code class="code codeInline" spellcheck="false" tabindex="0">{locale-id}.php</code>. For example, the French language file would be located at <code class="code codeInline" spellcheck="false" tabindex="0">/plugins/<someaddon>/locale/fr.php</code> or <code class="code codeInline" spellcheck="false" tabindex="0">/themes/<sometheme>/locale/fr.php</code>.</p><p><strong><code class="code codeInline" spellcheck="false" tabindex="0">locale/fr.php</code></strong></p><pre class="code codeBlock" spellcheck="false" tabindex="0"><?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"; </pre><p><strong><code class="code codeInline" spellcheck="false" tabindex="0">locale/es.php</code></strong></p><pre class="code codeBlock" spellcheck="false" tabindex="0"><?php if (!defined('APPLICATION')) exit(); // Note about what you're translating $Definition['TranslationString1'] = "Algo en español"; $Definition['TranslationString2'] = "Otra cosa en español"; </pre><h2 data-id="defining-new-translations-strings">Defining new translations strings</h2><p>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 <a href="https://docs.vanillaforums.com/developer/smarty/functions/#function-t" rel="nofollow noreferrer ugc">Smarty Templates</a> and in <a href="http://docs.vanillaforums.com/developer/framework/i18n/" rel="nofollow noreferrer ugc">PHP</a>.</p> </article> </main>