wiki:TranslatedPagesMacro

Show translated versions of wiki page

Description

This is a macro to output a list of translated versions of a current page. The base language page should use the wiki name without language code, and the translated wiki pages use a configurable version including language code. The [[TranslatedPages]] macro generates a list of languages as follows:

english example

Each translated page has the same macro, but containing the revision of the base page. When the revision of the base page is newer than the translated revision (someone updated English page), then below the language links in menu a new menu point appears showing the translated revisions and newest !one. When clicking on that link, the differences between that revision are displayed. These can then be used to update the translation. During updating the revision in the translated page needs to be increased to the newest !one and the additional links disappears.

Bugs/Feature Requests

Existing bugs and feature requests for TranslatedPagesMacro are here.

If you have any issues, create a new ticket.

defect

1 / 1

enhancement

3 / 4

Download

Download the zipped source from here.

Source

You can check out TranslatedPagesMacro from from here using Subversion, or browse the source in Trac.

Installation

General instructions on installing Trac plugins can be found on the TracPlugins page.

See the Trac plugin requirements for instructions on installing setuptools. Setuptools includes the easy_install application which you can use to install the TranslatedPagesMacro:

easy_install TranslatedPagesMacro

There is also this link for setuptools to find the SVN download.

Upgrading from plugin version 0.3

The macro has been enhanced since version 0.3. A major change is the layout of the pages. Version 0.3 hardcoded the format page/<lang>. The new version has <lang>:page as default which is more often used for wikis.

For existing installations that use the old schema, the following settings must be used in trac.ini:

[translatedpages]
template = {page}/{lang}
regexp = ([a-z]{2})

Also the layout of the language specification page changed (more entries required tables style design).

Example

An example of the required language specification page can be found at TranslatedPagesMacro/TracLanguages.

For example, the page WikiStart was translated to Chinese version Zh_CN:WikiStart, Russian version Ru:WikiStart and Spanish version Es:WikiStart. Insert [[TranslatedPages]] to WikiStart will generate the following list:

english example

And in Zh_CN:WikiStart will generate:

chinese example

When translated page is outdated, Es:WikiStart will generate:

espanol example with update

An example of an actively used installation can be found at http://josm.openstreetmap.de/wiki/Translations.

Macro help text

Following chapter contains the help text found at [WikiMacros#TranslatedPages-macro] on systems with the macro installed.

Macro to show the translated pages list.

Simply calling that macro in a page adds a menu linking to all available translations of a page.

A language page (usually TracLanguages) (location is wiki/TracLanguages in installed system) must provide the language codes as a table with the following entries:

||<language code>||<language name>||<english name>||<description>|| 

The description contains the text displayed above language links in that language, usually a variant of 'Other languages'. A table title line starting with ||= is not parsed.

The Macro accepts arguments as well:

  • revision=<num> to specify the version of the base page when last translated, a negative revision indicates that a page needs updating in the status overview table
  • outdated=<text> mark the page as outdated with given comment
  • silent don't output empty chapter for show options when nothing is shown
  • showoutdated to show all pages, where revision does not match base revision
  • showmissing to show all pages, where translation is missing
  • showproblems to show all pages which have problems
  • showuntranslated to show all untranslated pages
  • showstatus to show !one big status table
  • lang=<code> to restrict output of show outdated, status or missing to a specific language

Additional descriptions and comments

  • The status table uses following colors (note status table may require a lot of calculation time depending on number of pages and languages).
    • Red: There is an error with this page (shown in error list)
    • Yellow: Page needs update
    • Green: Everything up-to-date
    • Grey: Page is missing
  • The outdated parameter is useful when a page is known to be outdated, but there is no time to fix it immediately. The page is marked yellow in the status table and the text argument is displayed on the page itself.
  • The macro also works without the revision parameter on the translated pages, but it is a very helpful tool to keep original and translations in sync.
  • When using the show... parameters, no translation message link box is created. You need to add another instance of the macro if you want to have these texts and the page links.

Troubleshooting

When you setup the macro and it does not work:

  • Check if the macro text is in the WikiMacros page as explained above. If it is not, then the installation is broken.
  • Check if TracLanguages pages is available and in the correct format.
  • If you created pages with language code and macro inserted, adding [[TranslatedPages(showproblems)]] to any page and then previewing (no need to save) should tell you existing problems.

Recent Changes

14535 by stoecker on 2015-04-18 21:59:35
add dialects
13545 by stoecker on 2014-01-04 22:51:24
minor fix in illegal argument detection
11919 by stoecker on 2012-08-10 22:11:21
TranslatedPagesMacro: add label argument
(more)

Author/Contributors

Author: ftofficer
Maintainer: Dirk Stöcker
Contributors: dottedmag

Last modified 7 months ago Last modified on Nov 17, 2015, 9:52:19 AM

Attachments (5)

Download all attachments as: .zip