internationalization2Add my vote for this tag localization2Add my vote for this tag create new tag
, view all tags


ForUserLanguagesPlugin used to insert full or partial translations and keep them in the original topic.

Why to keep translation in the same topic?

There are two official ways of TWiki internationalisation: Support for translated topics and Support for translated strings in code. Nevertheless, there are valuable reasons to keep several translations in the same topic in sites where to keep information up-to-date is more important than to provide full translation:
  • It is much more easy to check and keep consistency when update:
    • Code fragment, image or some other language independent content will be rendered from the unique source fragment and it will be immediately automatically updated in all needed languages simultaneously.
    • Fragments deletion and moving will also be easily done in all translations together
    • User see the translations while editing and can replace or mark outdated some translations of editing paragraph.
  • Sometimes possibility to keep partial translations in original language (i.e. leave in original language some less actual notes, unnecessary explanations, examples, comments etc.) may save a lot of time for a really usefull work.

Syntax Rules

There are predefined translation switch to separate contents for different user language, and they are fully customisable.

Predefined translation switch

Plugin introduce the one new variable %FORUSERLANGUAGES{}%.

The variable must have an argument either

  • the comma separated list of user language codes
  • the same list prepended with negation exclamation mark '!'.
The text between two %FORUSERLANGUAGES{}% will disappear if and only if current user en is not in list or it is in list after the exclamation mark.



The part of the topic in Russian (for users who prefer Cyrillic text)


The same part of the topic in English (translation for other users)


Language independent or untranslated data comes here.


The next part of the topic in English again (only for non-Cyrillic users)

Using shortcut aliases example

Sample code

<Cyr> Russian version of the text fragment. <Lat> English version of the same 
fragment. <Any> Common part. <Cyr> Russian <Lat> English <Any> version of the next fragment ...

Result (simulated):

English version of the same fragment. Common part. English version of the next fragment. ...

Result (if installed):

Russian version of the text fragment. English version of the same fragment. Common part. Russian English version of the next fragment ...

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %POLYGLOTPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = used to insert full or partial translations and keep them in original topic.

  • Shortcut aliases for any translation switches may be defined via the variable FORUSERLANGUAGESALIASES, which contains the semicolon separated list of aliases. Example above use the following setting in Main.TwikiPreferences
      * Set FORUSERLANGUAGESALIASES = <Cyr> = ru,ua,bg; <Lat> = !ru,ua,bg; <Any> = !
  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

Plugin Installation Instructions

Тo install plugin:

* Unzip the archive to the top of your directory

Test Plugin Installation

You will see below correct information about user selected language if the plugin has been properly installed.

%FORUSERLANGUAGES{en}%Default language en (English) %FORUSERLANGUAGES{!en}%Custom language en%FORUSERLANGUAGES{!}% selected.

Plugin Info

Plugin Author: TWiki:Main.SergejZnamenskij
Copyright: © 2006, TWikiContributor
License: GPL (GNU General Public License)
Plugin Version: 26 Aug 2006
Change History:  
27 Aug 2006: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.1
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
TWiki:Plugins/Benchmark: GoodStyle 99%, FormattedSearch 99%, ForUserLanguagesPlugin 99%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/ForUserLanguagesPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/ForUserLanguagesPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/ForUserLanguagesPluginAppraisal

Related Topics: TWikiPlugins, DeveloperDocumentationCategory, AdminDocumentationCategory, TWikiPreferences

-- SergejZnamenskij - 27 Aug 2006

Topic attachments
I Attachment History Action Size Date Who Comment
Compressed Zip archivezip ForUserLanguagesPlugin.zip r1 manage 11.4 K 2006-08-27 - 12:27 SergejZnamenskij ForUserLanguagesPlugin installation zip archive
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2006-08-29 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.