Changes between Version 11 and Version 12 of TracWikiNegotiatorPlugin
- Timestamp:
- Nov 18, 2015, 11:17:44 AM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracWikiNegotiatorPlugin
v11 v12 5 5 == Description 6 6 7 This plugin provides content negotiation mechanism for Trac wiki pages. With this plugin, your Trac site can provide localized pages for users.7 This plugin provides a content negotiation mechanism for Trac wiki pages. With this plugin, your Trac site can provide localized pages for users. 8 8 9 9 == Bugs/Feature Requests … … 19 19 == Download 20 20 21 Download the zipped source from [ download:tracwikinegotiatorplugin here].21 Download the zipped source from [export:tracwikinegotiatorplugin here]. 22 22 23 23 == Source 24 24 25 You can check out TracWikiNegotiatorPlugin from [ http://trac-hacks.org/svn/tracwikinegotiatorplugin here] using Subversion, or [source:tracwikinegotiatorplugin browse the source] with Trac.25 You can check out TracWikiNegotiatorPlugin from [/svn/tracwikinegotiatorplugin here] using Subversion, or [source:tracwikinegotiatorplugin browse the source] with Trac. 26 26 27 27 == Installation … … 52 52 }}} 53 53 54 Note that `TitleIndex` macro and `TOC` macro (by tractoc plugin) is overridden by enabling this plugin. To use original macro, you should54 Note that `TitleIndex` macro and `TOC` macro (by tractoc plugin) is overridden by enabling this plugin. To use the original macro, you should 55 55 disable the new macro explicitly, see [#BonusMacro Bonus Macro] for more detail. 56 56 57 57 == Usage 58 58 59 Using the negotiation feature is simply providing suffixed page like 'Foo.ja' for Japanese, 'Foo.fr' for French, so on. When Japanese user 60 (with Japanese setting in browser) access to the page 'Foo', he will see the content of `Foo.ja` instead of `Foo`. Likewise, French user will see the content of `Foo.fr`. So what you should do is creating localized page content in the usual way. Note that suffix like '.ja' and '.fr' is to be a standard language code. 59 Using the negotiation feature is simply providing a suffixed page like 'Foo.ja' for Japanese, 'Foo.fr' for French, and so on. When a Japanese user with the Japanese setting in the browser accesses the page 'Foo', (s)he will see the content of `Foo.ja` instead of `Foo`. Likewise, a French user will see the content of `Foo.fr`. So what you should do is creating localized page content in the usual way. Note that a suffix like '.ja' and '.fr' needs to be a [https://en.wikipedia.org/wiki/Language_code standard language code]. 61 60 62 Non-suffixed page `Foo` is also usable for default content when no suffixed page is matched touser's request.61 The non-suffixed page `Foo` is also usable for default content when no suffixed page is matched to the user's request. 63 62 64 To see the page for your language, nothing to do to view localized page. To see the page for other language, specify the appropriate suffix for 65 wiki page name in the url explicitly, or add query parameter like "?lang=xx". 63 To see the page for your language, there is nothing to do to view the localized page. To see the page for other language, specify the appropriate suffix for wiki page name in the url explicitly, or add query parameter like "?lang=xx". 66 64 67 65 To edit the page, you can edit the page now you are seeing by simply press "Edit" button. 68 To edit the page for another language, first visit the desired page with a way described above, then press"Edit" button.66 To edit the page for another language, first visit the desired page in the way described above, then press the "Edit" button. 69 67 70 68 == Language Menu … … 72 70 By using this plugin, you can see new language menu bar above the wiki context navigation menu. It displays available languages on this site automatically by finding language suffixes of wiki pages. 73 71 74 '''Note:''' Users who installed earlier version (before r4974) on Trac 0.11 may need enabling `WikiNegotiatorMenuBar` component to display language menu.72 '''Note:''' Users who installed earlier version (before r4974) on Trac 0.11 may need enabling the `WikiNegotiatorMenuBar` component to display the language menu. You can select the language via this menu. Because it is held in the session information, you can run with the language without re-selection. 75 73 76 You can select language via this menu. Because it is held in the session information, you can run with the language without re-selection.74 The selected languages are displayed underlined and bolded on the menu. If the specific language content is not availabe, the language item in the menu is greyed out. 77 75 78 The selected language are displayed underlined and bolded on the menu. If the specific language content is not availabe, the language item in the menu is greyed out. 79 80 There are 5 kind of display styles: 76 There are 5 kinds of display styles: 81 77 82 78 `simple`:: … … 85 81 `ctxnav`:: 86 82 Like `simple` but displayed on the right of the wiki context menu. 87 It looks like a one of the context menu item.83 It looks like one of the context menu items. 88 84 `button`:: 89 85 Button faced selection menu. … … 93 89 Hide language menu. 94 90 95 The style of language menu can be changed by`menu_style` option:91 The style of the language menu can be changed through the `menu_style` option: 96 92 {{{#!ini 97 93 [wiki-negotiator] … … 99 95 }}} 100 96 101 == 97 == Bonus Macro 102 98 103 For bonus, this plugin contains two new macro : `MultiLangTitleIndex` and `NTOC`.104 The former is an alternative macro of `TitleIndex`.105 The later is an alternative of `TOC` macro, see [th:wiki:tocmacro tocmacro] in Trac-Hacsfor more detail.99 For bonus, this plugin contains two new macros: `MultiLangTitleIndex` and `NTOC`. 100 * The former is an alternative macro of `TitleIndex`. 101 * The latter is an alternative of the `TOC` macro, see [th:wiki:tocmacro tocmacro] for more detail. 106 102 107 And this plugin has the definitions to override original `TitleIndexMacro` and `TOCMacro` automatically. 108 '''So you do not need to edit wiki pages to use both two new macros'''. 103 And this plugin has the definitions to override the original `TitleIndexMacro` and `TOCMacro` automatically. '''So you do not need to edit the wiki pages to use both new macros'''. 109 104 110 If you want to disable new feature and use original, disable new macros explicitly in `trac.ini` like this:105 If you want to disable these new features and use the original instead, disable the new macros explicitly in `trac.ini` like this: 111 106 {{{#!ini 112 107 [components] … … 117 112 === `MultiLangTitleIndex` 118 113 119 The differences against`TitleIndex` are:114 The differences with `TitleIndex` are: 120 115 * Display in one line for variants like: "* !WikiStart (ja, en, other)". 121 * List pages in two columns: one is for user's pages, one is for system provided pages. System pages are the pages madeby Trac.122 `WikiStart` and `SandBox` are exception by default because it is a page to be edited byuser.116 * List pages in two columns: one is for user's pages, one is for system provided pages. System pages are the pages generated by Trac. 117 `WikiStart` and `SandBox` are exception by default, because it is a page to be edited by the user. 123 118 124 It is useful for the site havingmany localized pages.119 It is useful for a site that has many localized pages. 125 120 126 121 '''This feature is automatically enabled''' by overriding `TitleIndexMacro` when this plugin is enabled.