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
)
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
Related Topics: TWikiPlugins, DeveloperDocumentationCategory, AdminDocumentationCategory, TWikiPreferences
-- TWikiContributor 25 Aug 2006foruser
Topic revision: r5 - 2018-11-08 - 17:53:24 -
IlyaDanilovTWiki.ForUserLanguagesPlugin moved from TWiki.PolyglotPlugin on 2006-08-26 - 09:45 by SergejZnamenskij? -
put it back