Skip to main content.

MultiLangPlugin

Some useful stuff for providing several distinct TWiki sites with the same content but in different languages.

Concepts and Design

This plug-in was developed to be able to maintain a web page in two different languages. It assumes to distinct TWiki installations which share both a common location in the host's file system and a common path as seen from the web server. These should only differ by their language name (e.g. file system /var/www/twiki/lang/{bin,data} and URL /lang/bin/). So all the plug-in needs to know is which language a certain TWiki has (set by WIKILANG below) and where to replace lang in a given path. You can define templates for this in the Plugin settings (see below), #LANG# is used as the string to substitute. In the most common configurations, the plug-in should be able to guess them by itself given WIKILANG is set correctly.

Concepts that aren't implemented yet/Limitations

Patches welcome smile

Interaction with other Plug-ins

If you want to use the FindElsewherePlugin? and the WikiWord expansion of MultiLangPlugin (%FINDINOTHERLANGS%) you should define a certain order for calling them both depending on your preferences (i.e. if you would like to get linked WikiWords to other webs or other languages if both is possible).

Syntax Rules

MultiLangPlugin introduces the following new variables that are intended to be used in templates:

The plug-in also provides some new auto-linking abilities:

Skinning support (CSS)

I've tried to hardcode almost nothing into the output the plug-in produces. All produces links have the class translationLink and a correctly set lang attribute. This should you to develop complex layouts by using CSS.

Just a quick example: to display a German flag before any link that links to a German translation use the following CSS

.translationLink:lang(de):before { content: url(%PUBURLPATH%/%TWIKIWEB%/germany.png)" " }
(Disclaimer: Using flags to indicate translations is of course strongly discouraged by most I18N people but it makes for a good example and some people like it)

Plugin Settings

Plug-in settings are stored as preferences variables. To reference a plug-in setting write %<plugin>_<setting>%, i.e. %INTERWIKIPLUGIN_SHORTDESCRIPTION%

Settings to change in TWikiPreferences/WebPreferences

This plug-in comes with a proposed TWikiForm: TranslationForm, you may want to add it to WEBFORMS.

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plug-in. The following instructions are for the administrator who installs the plug-in on the server where TWiki is running.

Plugin Info

Plugin Author: TWiki:Main/FrankLichtenheld
Plugin Version: 29 Apr 2005 (V0.92)
Change History:  
29 Apr 2005: Second RC (V0.92) Fix [[...][...]] style links and add new ONLYFINDFIRSTOTHER variable
18 Apr 2005: Second RC (V0.91) Introduces VIEWURLFORM and some documentation fixes
11 Apr 2005: First RC (V0.90)
TWiki Dependency: $TWiki::Plugins::VERSION 1.021
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
License: GPL (GNU General Public License)
TWiki:Plugins/Benchmark: GoodStyle 100%, FormattedSearch 100%, MultiLangPlugin 100%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/MultiLangPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/MultiLangPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/MultiLangPluginAppraisal

Related Topics: TWikiPreferences, TWikiPlugins

-- TWiki:Main/FrankLichtenheld - 11 Apr 2005