Class LanguagePlugin

java.lang.Object
org.apache.wiki.plugin.LanguagePlugin
All Implemented Interfaces:
org.apache.wiki.api.plugin.Plugin

public class LanguagePlugin extends Object implements org.apache.wiki.api.plugin.Plugin
Shows the content that matches the language preference of the visitor, as the browser sends it in the Accept-Language header. The body holds one block per language, written as :xx:text:: with the language code between colons, and an optional :else:text:: block for visitors that none of the blocks suits:
 [{LanguagePlugin

 :de:Willkommen::  :en:Welcome::  :else:Welcome / Willkommen::}]
 

The languages of the visitor are tried in the order of their quality values, and a block matches when its code is the language of the tag, so de matches de-AT. Only the language is compared, not the region. If no block matches and there is no :else: block, nothing is shown. The text of the chosen block is rendered as wiki markup. A block ends at the first ::, so the text of a block cannot contain it.

Parameters: none.

Since:
3.0.1
  • Constructor Details

  • Method Details

    • getDisplayName

      public String getDisplayName(Locale locale)
      Specified by:
      getDisplayName in interface org.apache.wiki.api.plugin.Plugin
    • getSnipExample

      Specified by:
      getSnipExample in interface org.apache.wiki.api.plugin.Plugin
    • execute

      public String execute(org.apache.wiki.api.core.Context context, Map<String,String> params) throws org.apache.wiki.api.exceptions.PluginException
      Specified by:
      execute in interface org.apache.wiki.api.plugin.Plugin
      Throws:
      org.apache.wiki.api.exceptions.PluginException