Changes between Version 10 and Version 11 of TracWikiNegotiatorPlugin
- Timestamp:
- Jul 27, 2015, 12:11:38 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracWikiNegotiatorPlugin
v10 v11 1 1 [[PageOutline(2-5,Contents,pullout)]] 2 = Content negotiation plugin for Trac wiki =3 2 4 = = Description ==3 = Content negotiation plugin for Trac wiki 5 4 6 This plugin provides content negotiation mechanism for Trac wiki 7 pages. With this plugin, your Trac site can provides localized pages 8 for users. 5 == Description 9 6 10 == Bugs/Feature Requests == 7 This plugin provides content negotiation mechanism for Trac wiki pages. With this plugin, your Trac site can provide localized pages for users. 8 9 == Bugs/Feature Requests 11 10 12 11 Existing bugs and feature requests for TracWikiNegotiatorPlugin are … … 14 13 15 14 If you have any issues, create a 16 [ http://trac-hacks.org/newticket?component=TracWikiNegotiatorPlugin&owner=gotohnew ticket].15 [/newticket?component=TracWikiNegotiatorPlugin new ticket]. 17 16 18 == Download == 17 [[TicketQuery(component=TracWikiNegotiatorPlugin&group=type,format=progress)]] 18 19 == Download 19 20 20 21 Download the zipped source from [download:tracwikinegotiatorplugin here]. 21 22 22 == Source ==23 == Source 23 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 26 26 == Install ==27 == Installation 27 28 28 Build egg file and place it appropriate place29 Build the egg file and place it in the plugins directory of your Trac environment. 29 30 30 If you want to install as system wide plugin:31 {{{ 31 If you want to install as a system wide plugin: 32 {{{#!sh 32 33 $ python setup.py install 33 34 }}} 34 35 35 If you want to build plugin egg file and use it in some projects, 36 build egg file and copy it into `plugins` directory under the trac 37 environment directory: 38 {{{ 36 If you want to build the plugin's egg file and use it in your projects, build the egg file and copy it into the `plugins` directory under the Trac environment directory: 37 {{{#!sh 39 38 $ python setup.py bdist_egg 40 39 ... … … 42 41 }}} 43 42 44 == How to Setup ==43 == Configuration 45 44 46 On using this plugin, do not forget enabling plugin 47 `WikiNegotiator` in `trac.ini` or via `WebAdmin` page. 48 49 {{{ 45 On using this plugin, do not forget the enable the plugin `WikiNegotiator` in `trac.ini` or via `WebAdmin` page: 46 {{{#!ini 50 47 [components] 51 48 wikinegotiator.* = enabled 52 49 ... 53 50 [wiki] 54 51 default_lang = en 55 56 52 }}} 57 53 58 Note that `TitleIndex` macro and `TOC` macro (by tractoc plugin) is 59 overridden by enabling this plugin. To use original macro, you should 60 disable new macro explicitly. See [#BonusMacro Bonus Macro] for 61 more detail. 54 Note that `TitleIndex` macro and `TOC` macro (by tractoc plugin) is overridden by enabling this plugin. To use original macro, you should 55 disable the new macro explicitly, see [#BonusMacro Bonus Macro] for more detail. 62 56 57 == Usage 63 58 64 == How to Use == 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. 65 61 66 Using the negotiation feature is simply providing suffixed page like 67 'Foo.ja' for Japanese, 'Foo.fr' for French, so on. When Japanese user 68 (with Japanese setting in browser) access to the page 'Foo', he will 69 see the content of `Foo.ja` instead of `Foo`. Likewise, French use 70 will see the content of `Foo.fr`. So what you should to do is creating 71 localized page content as usual way. Note that suffix like '.ja' and 72 '.fr' is to be a standard language code. 62 Non-suffixed page `Foo` is also usable for default content when no suffixed page is matched to user's request. 73 63 74 Non-suffixed page `Foo` is also usable for default content 75 w hen no suffixed page is matched to user's request.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". 76 66 77 To see the page for your language, nothing to do to view localized page. 78 To see the page for other language, specify the appropreate suffix for 79 wiki page name in url explicitly, or add query parameter like "?lang=xx". 67 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. 80 69 81 To edit the page, you can edit the page now you are seeing by simply 82 press "Edit" button. 83 To edit the page for other language, first, visit the desired page 84 with a way described above, then press "Edit" button. 70 == Language Menu 85 71 72 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. 86 73 87 == Language Menu == 74 '''Note:''' Users who installed earlier version (before r4974) on Trac 0.11 may need enabling `WikiNegotiatorMenuBar` component to display language menu. 88 75 89 By using this plugin, you can see new language menu bar above the 90 wiki context navigation menu. It displays available languages 91 on this site automatically by finding language suffixes of wiki pages. 92 93 '''Notice:''' Users who installed earlier version (before r4974) on trac 0.11 94 may need enabling `WikiNegotiatorMenuBar` component to display language menu. 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. 95 77 96 You can select language via this menu. Because it is holded in the session 97 information, you can walk with the language without re-selection. 98 99 The selected language are displayed underlined and bolded on the 100 menu. If specific language content is not availabe, the language item 101 in the menu is grayed. 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. 102 79 103 80 There are 5 kind of display styles: … … 117 94 118 95 The style of language menu can be changed by `menu_style` option: 119 {{{ 96 {{{#!ini 120 97 [wiki-negotiator] 121 menu_style =ctxnav98 menu_style = ctxnav 122 99 }}} 123 100 101 == Bonus Macro 124 102 125 == Bonus Macro == 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-Hacs for more detail. 126 106 127 For bonus, this plugin contains two new macro: `MultiLangTitleIndex` 128 and `NTOC`. 129 The former is an alternative macro of `TitleIndex`. 130 The later is an alternative of `TOC` macro. 131 (see [th:wiki:tocmacro tocmacro] in Trac-Hacs for more detail) 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'''. 132 109 133 And this plugin has the definitions to override original 134 `TitleIndexMacro` and `TOCMacro` automatically. 135 '''So you do not need to edit wiki pages to use both two new macros'''. 136 If you want to disable new feature and use original, 137 disable new macros explicitly in `trac.ini` like this: 138 {{{ 110 If you want to disable new feature and use original, disable new macros explicitly in `trac.ini` like this: 111 {{{#!ini 139 112 [components] 140 113 wikinegotiator.macros.titleindexmacro = disabled … … 142 115 }}} 143 116 144 === `MultiLangTitleIndex` === 117 === `MultiLangTitleIndex` 118 145 119 The differences against `TitleIndex` are: 146 120 * Display in one line for variants like: "* !WikiStart (ja, en, other)". 147 * List pages in two columns: one is for user's pages, one is for 148 system provided pages. System pages are the pages made by trac. 149 `WikiStart` and `SandBox` are exception by default because it is 150 a page to be edited by user. 121 * 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. 122 `WikiStart` and `SandBox` are exception by default because it is a page to be edited by user. 151 123 152 124 It is useful for the site having many localized pages. 153 125 154 '''This feature is automatically enabled''' by overriding `TitleIndexMacro` 155 when this plugin is enabled. 126 '''This feature is automatically enabled''' by overriding `TitleIndexMacro` when this plugin is enabled. 156 127 157 === `NTOC` === 158 `NTOC` macro delives `TOC` macro, so all the features in `TOC` macro 159 are available except handling lang suffixed pages. 160 If you specify normal page name without explicit lang suffix 161 (i.e. `WikiStart`), `NTOC` look up localized page for language same to 162 parent page the macro is put on. If not exist, look up localized page 163 for preferred langs. If not found, use specified name as is. 164 So, it is easy to get localized TOC by simply specifyng base page names 165 in argument. 128 === `NTOC` 166 129 167 `NTOC` also handles wildcard page argument by expanding and removing 168 suffixed pages. 130 `NTOC` macro delives `TOC` macro, so all the features in `TOC` macro are available except handling lang suffixed pages. 131 If you specify normal page name without explicit lang suffix (i.e. `WikiStart`), `NTOC` look up localized page for language same to 132 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. 133 So, it is easy to get localized TOC by simply specifying base page names in argument. 169 134 170 '''This feature is automatically enabled''' by overriding `TOCMacro` if available 171 when this plugin is enabled. 135 `NTOC` also handles wildcard page argument by expanding and removing suffixed pages. 172 136 137 '''This feature is automatically enabled''' by overriding `TOCMacro` if available when this plugin is enabled. 173 138 174 == Recent Changes ==139 == Recent Changes 175 140 176 141 [[ChangeLog(tracwikinegotiatorplugin, 3)]] 177 142 178 == Author/Contributors ==143 == Author/Contributors 179 144 180 145 '''Author:''' [wiki:gotoh] [[BR]] 181 '''Maintainer:''' [ wiki:gotoh] [[BR]]146 '''Maintainer:''' [[Maintainer]] [[BR]] 182 147 '''Contributors:'''