Modify

Opened 7 years ago

Closed 5 years ago

#1752 closed defect (fixed)

CtxtnavAddPlugin support for WikiNegotiator

Reported by: phpxcache Owned by: gotoh
Priority: normal Component: TracWikiNegotiatorPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description

it would be nice to add CtxtnavAddPlugin to WikiNegotiator

i know the lang switch will not persistent over pages, but it really make life easier

Attachments (3)

CtxtnavAdderSupport.txt (5.0 KB) - added by phpxcache 7 years ago.
negMenuBarCtx.png (8.4 KB) - added by izzy 5 years ago.
CSS missing? Language menu looks weird
setup.py.patch (427 bytes) - added by izzy 5 years ago.
Patch to setup.py to include the CSS and template files

Download all attachments as: .zip

Change History (18)

Changed 7 years ago by phpxcache

comment:1 Changed 5 years ago by izzy

Is my interpretation of your code correct, that it adds "language switcher" links to the ctxnav? In that case I second your request - that's something I also miss very hard!

comment:2 Changed 5 years ago by anonymous

yes

comment:3 Changed 5 years ago by gotoh

  • Status changed from new to assigned

I recognized the original request says "we want the button/link to switch language".
I've implemented it by another approach without using CtxtnavAddPlugin, but not yet
published because of lack of my time to test. There is a test site which uses the
implementation:

http://www.meadowy.org/~gotoh/projects/trac-wiki/

I should appreciate you visit there and check it which is what you want or not.
If OK, I'll publish for test.

In this imprementation, you can walk through the wiki pages with the language you selected.
The selected language is saved in session object.
You can switch to avaialble language via language selection bar (like CtxtnavAddPlugin, but own).
The selected language is appeared as bold, and current language is appeared as
yellow underline.
If selected language is not available, the language to display is automatically decided
by normal negotiation mechanism, but your selected language is remain.

How about it?

comment:4 Changed 5 years ago by izzy

As far as I am concerned, that is almost exactly what I want. The CtxNav would be better for saving some space (since now an extra line is added) - but the way you implemented it probably makes it more clear.

If you go to publish, I would appreciate if you already include the patch I attached to #3861 a while ago (macros.py.default_lang.patch) - by which you probably also can close #3861. I'll add another comment there, please check that one as well.

comment:5 Changed 5 years ago by gotoh

  • Resolution set to fixed
  • Status changed from assigned to closed

I didn't take your approach suggested to collaborate with CtxtnavAddPlugin.
Altenatively, I add the language menu with selectable styles.
By default, simple style is used and it is standalone menubar.
If you choose ctxnav style, the language menu is shown like a part of
wiki context menu. This is done by CSS.
Also you can choose hidden style not to display language menu al all.

comment:6 Changed 5 years ago by izzy

  • Resolution fixed deleted
  • Status changed from closed to reopened

Sorry for negative reply again: I checked with one page I've got two versions from (.de and default). Regardless what style I put, I never got any selector. To make sure it's not a problem with my eyes, I even grepped the source (I set "en=English,de=Deutsch", so I had something to grep for). This test has been made at r4977.

comment:7 Changed 5 years ago by gotoh

Do you have only '.de' as suffix and deafult_lang is 'de'?
If so, try to set default_in_menu as true in trac.ini.
Current implementatione does not show language menu
when only one lang items is available.

If set lang_names explicitly, it should be shown.

comment:8 Changed 5 years ago by izzy

No: I have only .de as suffix, and default_lang is not set (test environment). And I tried even with default_in_menu - makes no difference then. But I just found the problem: This is a new module (WikiNegotiatorMenuBar), and it was not enabled... So sorry for that. But still, it is not visible when there's no default_lang set in trac.ini.

But it seems to break the design here (see attached screenshot "negMenuBarCtx") - looks as this regardless what I chose for menu_style. Am I doing something wrong? To me it looks as if the special CSS is missing (just investigated with Dom Inspector). In the sources I can see there are several CSS files - but DOMi shows nothing connected with the elements here. Aehm - and they are not put into the egg (the entire htdocs/ subdirectory is missing there, and the templates/ directory as well). Could it be they are not installed along, and that's the reason?

Changed 5 years ago by izzy

CSS missing? Language menu looks weird

comment:9 Changed 5 years ago by gotoh

Please check trac.log. Is there some error by this plugin?
I'd got same displaying when there's error on loading module before.

comment:10 follow-up: Changed 5 years ago by gotoh

Ah, my fault!
I've forgot to update setup.py script.
I've not be awared that since i'm in develop mode installation.

Changed 5 years ago by izzy

Patch to setup.py to include the CSS and template files

comment:11 Changed 5 years ago by izzy

Aw - no I just verified, created a patch and sent it - and we are crossing :) Nevermind. I'm learning a lot of stuff by this...

Besides: Works fine once they are installed ;)

comment:12 in reply to: ↑ 10 Changed 5 years ago by gotoh

Replying to gotoh:

Ah, my fault!
I've forgot to update setup.py script.
I've not be awared that since i'm in develop mode installation.

Fixed in r4980.

comment:13 follow-up: Changed 5 years ago by izzy

Confirmed.

Just one issue left here: If there is only one language variant of a page available, the language selector menu makes not that much sense (except as to invite somebody to create that page, if that is the intention?). How about omitting it in those cases? Possibly again, this may be very subjective (one says: makes no sense, the other: sure, so people create the missing one). So feel free to add another option for trac.ini like always_display_menu (true: as it is now; false: no menu if there is only the current language available). Of course this option only has effect when the menu module is enabled ;)

comment:14 in reply to: ↑ 13 Changed 5 years ago by anonymous

Replying to izzy:

Just one issue left here: If there is only one language variant of a page available, the language selector menu makes not that much sense (except as to invite somebody to create that page, if that is the intention?). How about omitting it in those cases? Possibly again, this may be very subjective (one says: makes no sense, the other: sure, so people create the missing one). So feel free to add another option for trac.ini like always_display_menu (true: as it is now; false: no menu if there is only the current language available). Of course this option only has effect when the menu module is enabled ;)

This behaviour is intended. The language menu shows site-wide availble language
by chcking all the page suffixes.
This is because it indicates selected and displaying language, and it guides to create
variant page. Moreover, I think it makes users confused by displaying or hiding menu
while walking through the pages.

Of course I can add a switch to hide in such case as 'menu of selectable languages'.

# And this is also another issue.

comment:15 Changed 5 years ago by izzy

  • Resolution set to fixed
  • Status changed from reopened to closed

Okay, you are the boss - but I agree with you. I will not open another ticket for this - I get used to it, and certainly will even like it (as it shows me where I may have forgotten a translation). I leave that issue to someone who feels more urgent requirement for it :)

In other words: I guess this ticket can be closed! Thank you for your help and for the great plugin!

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from gotoh. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.