Modify

Opened 15 years ago

Last modified 15 years ago

#4225 new enhancement

Improve handling of "extension-less" pages

Reported by: izzy Owned by: Shun-ichi Goto
Priority: normal Component: TracWikiNegotiatorPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description

It would be nice to have the handling of "extension-less" pages (i.e. "Default-pages") improved. At the moment, a wiki page without language prefix is just listed as "default". My suggestions depend on the page type - and an additional entry for the trac.ini to either use the current way - or the improved way as described here:

user_pages: Instead of "default", wiki.default_lang should be used (if set - otherwise stay with the current behavior).

system_pages: Here we usually don't have language-specific versions, but all of these pages are using the same language. Since this language is not necessarily be identical with the default_lang, but still may differ (e.g. if a localized version of Trac is used), the "language" part could simply be omitted.

To be more safe (especially for the system_pages), the before mentioned trac.ini entry could be duplicated: one for the user_pages, one for the system_pages. Examples for the values could be: "default" (literally), "system" (use the default_lang defined in the wiki section), or a 2-char language code - where the latter makes not too much sense, since it would be identical to default_lang in 99% of all cases I can think of, so "default" and "system" should be sufficient.

[wiki-negotiator]
system_pages_default_lang = none # no language part to display; alternative: system|default
user_pages_default_lang   = system # use wiki.default_lang; alternative: default

If system_pages_default_lang is set to none, and a system page with language variant is encountered (who knows?), simply fall back to the current behaviour for that page only.

The value system is to be preferred over a explicitly given language code, since this avoids double declaration (and a probable cause for mistakes).

Attachments (1)

macros.py.default-lang.patch (2.2 KB) - added by izzy 15 years ago.
Implementing the RFE - except for the configuration stuff

Download all attachments as: .zip

Change History (2)

Changed 15 years ago by izzy

Implementing the RFE - except for the configuration stuff

comment:1 Changed 15 years ago by izzy

As usual, I was not willing to wait :) attachment:macros.py.default-lang.patch implements what I described above: For system pages, everything stays at it is (since noone can say they are always using the same default_language as set for the site). For user_pages, the configured default language shortcut (i.e. "en","de",...) is used when available - otherwise it also stays as it is now.

What this patch does not cover is the configuration part described.

You can apply it to the repository code if you like it - I must admit there may be better ways to achieve this, so you might decide to "rebuild" this yourself. But at least I have this available now as I wanted it to be - so I share it here in case someone else would like it as well ;)

Ah yeah: Patch is based on r4975 of macros.py (I just updated and got r4996 reported before I started coding, but there haven't been any files updated).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Shun-ichi Goto.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.