= Content negotiation plugin for Trac wiki = == Description == This plugin provides content negotiation mechanism for Trac wiki pages. With this plugin, your trac site can provides multiple localized pages for users. == Bugs/Feature Requests == Existing bugs and feature requests for TracWikiNegotiatorPlugin are [report:9?COMPONENT=TracWikiNegotiatorPlugin here]. If you have any issues, create a [http://trac-hacks.org/newticket?component=TracWikiNegotiatorPlugin&owner=gotoh new ticket]. == Download == Download the zipped source from [download:tracwikinegotiatorplugin here]. == Source == You can check out TracWikiNegotiatorPlugin from [http://trac-hacks.org/svn/tracwikinegotiatorplugin here] using Subversion, or [source:tracwikinegotiatorplugin browse the source] with Trac. == How to Install == Build egg file and place it appropriate place If you want to install as system wide plugin: {{{ $ python setup.py install }}} If you want to build plugin egg file and use it in some projects, build egg file and copy it into `plugins` directory under the trac environment directory: {{{ $ python setup.py bdist_egg ... $ cp dist/*.egg /your/trac/project/plugins }}} == How to Setup == On using this plugin, do not forget enabling plugin `WikiNegotiator` in `trac.ini` or via `WebAdmin` page. {{{ [components] wikinegotiator.* = enabled [wiki] default_lang = en }}} == How to Use == Using the negotiation feature is simply providing suffixed page like 'Foo.ja' for Japanese, 'Foo.fr' for French, so on. When Japanese user (with Japanese setting in browser) access to the page 'Foo', he will see the content of `Foo.ja` instead of `Foo`. Likewise, French use will see the content of `Foo.fr`. So what you should to do is creating localized page content as usual way. Note that suffix like '.ja' and '.fr' is to be a standard language code. Non-suffixed page `Foo` is also usable for default content when no suffixed page is matched to user's request. To see the page for your language, nothing to do to view localized page. To see the page for other language, specify the appropreate suffix for wiki page name in url explicitly, or add query parameter like "?lang=xx". To edit the page, you can edit the page now you are seeing by simply press "Edit" button. To edit the page for other language, first, visit the desired page with a way described above, then press "Edit" button. == Bonus Macro == For bonus, this plugin contains two new macro: `MultiLangTitleIndex` and `NTOC`. The former is an alternative macro of `TitleIndex`. The later is an alternative of `TOC` macro. (see [th:wiki:tocmacro] in Trac-Hacs for more detail) === `MultiLangTitleIndex` === The differences against `TitleIndex` are: * Display in one line for variants like: "* WikiStart (ja, en, other)". * List pages in two columns: one is for user's pages, one is for system provided pages. System pages are the pages made by trac. `WikiStart` and `SandBox` are exception by default because it is a page to be edited by user. It is useful for the site having many localized pages. You can use it by editing `TitleIndex` page. === `NTOC` === If you installed and enabled `TOC` macro on Trac 0.11 (or later), `NTOC` macro is also enabled. It is delived macro from `TOC` so all the features in `TOC` macro are available and plus handling lang suffixed pages better. If you specify normal page name without explicit lang suffix (i.e. `!WikiStart`), `NTOC` look up localized page for language same to parent page the macro is put on. If not exist, look up localized page for preferred langs. If not found, use specified name as is. So, it is easy to get localized TOC by simply specifyng base page names in argument. `NTOC` also handles wildcard page argument by expanding and removing suffixed pages. So, `TOC` can be simply replaced to `NTOC`. == Recent Changes == [[ChangeLog(tracwikinegotiatorplugin, 3)]] == Author/Contributors == '''Author:''' [wiki:gotoh] [[BR]] '''Contributors:'''