Loading...
 
Skip to main content

History: PluginLang

Source of version: 19 (current)

Copy to clipboard
            {syntax type="markdown"  editor="wysiwyg"} # Plugin Language

Use the ((wiki plugin)) to vary content based on the page language.

## Parameters

{pluginmanager plugin="lang"} 
{REMARKSBOX(title="Note" type="tip")}Cached pages don't render this plugin correctly. Do not cache the page that this plugin is used on.{REMARKSBOX}

## Examples

### Based on language

{CODE(colors="tiki")}
{LANG(lang="en")}Hello{LANG}
{LANG(lang="fr")}Bonjour{LANG}
{CODE} 
If the current language is en (English), "Hello" will be displayed. If it is fr (French), "Bonjour".

### Based on language and not language

*This code:*
{CODE(colors="tiki")}
{LANG(lang="fr")}Bonjour le monde!{LANG}{LANG(lang="es")}¡Hola, mundo!{LANG}{LANG(notlang="fr+es")}Hello world!{LANG}
{CODE}

*Would produce on this site:*
{LANG(lang="fr")}Bonjour le monde!{LANG}{LANG(lang="es")}¡Hola, mundo!{LANG}{LANG(notlang="fr+es")}Hello world!{LANG}

### With ((PluginTranslated))

The language can match the `lang` url parameter. So if you couple this plugin with the ((PluginTranslated)), you can have a kind of multilinguism: 
{CODE(colors="tiki")}
{LANG(lang="fr")}en Français{LANG}
{LANG(lang="en")}in English{LANG}
--- (page break)
{TRANSLATED(flag="France" lang="fr")}[./tiki-index.php?page=MyPage&lang=fr|>>]{TRANSLATED}
{TRANSLATED(flag="United_States" lang="en")}[./tiki-index.php?page=MyPage&lang=en|>>]{TRANSLATED} 
{CODE}

## Related pages

- ((tw:MultilingualModulesAndTemplates))