The cms is multi-language capable. Available languages can be defined for the front- and the backend individually.
Configuration can be adjusted directly for each site/domain within multi-site support. To include languages you should use the following steps:
cms.sites = [
{
name: site1.ch
key: site1
hosts: ["localhost:9000", "site1.ch:9000", www.site1.ch]
langs: {
# There should be only lang tags
# Language support separated for the both sides - frontend & backend
frontend: [de, en]
backend: [en]
}
logoPath: "uploads/site1.png"
}
...
]
To retrieve the list of front- and backend languages:
// Get the front- or backend languages
CMS.getConfig().frontendLanguages();
CMS.getConfig().backendLanguages();
// Get the currently selected language
Language.getCurrentLanguage();
?lang=<lang-code>
to the URLLanguage.forceCurrentLanguage(<language code>);
@for(lang <-CMS.getConfig.backendLanguages) {
<li>
@if(Language.getCurrentLanguage.equals(lang)){<strong>}
<a href="@CMS.getConfig.backendPath()?lang=@lang">@lang.toUpperCase</a>
@if(Language.getCurrentLanguage.equals(lang)){</strong>}
</li>
}
Hint: If you have dynamic urls that can have GET params, use @Template.addGetParm() to easily add the param to the url.