ForUserLanguagesPlugin

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 =

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

Compare the 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 ...
and the rendering result:

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 %_%, 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 TwikiPreferences?
      * Set FORUSERLANGUAGESALIASES = <ru> = ru,ua,bg; <en> = !ru,ua,bg; <any> = !
  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

Plugin Installation Instructions

%u0444o 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.

Default language en (English) selected.

Plugin Info

Plugin Author: TWiki:Main.SergejZnamenskij
Copyright: 2006, TWikiContributor
License: GPL (GNU General Public License)
Plugin Version: 26 Aug 2006
Change History:
26 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

-- TWikiContributor 25 Aug 2006foruser

Topic revision: r5 - 2018-11-08 - 17:53:24 - IlyaDanilov
TWiki.ForUserLanguagesPlugin moved from TWiki.PolyglotPlugin on 2006-08-26 - 09:45 by SergejZnamenskij? - put it back
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.ForUserLanguagesPlugin