create new tag
, view all tags

TopicTranslationsPluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on TopicTranslationsPlugin contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please report bugs below

TopicTranslationsPlugin Development discussion

I've just uploaded the first version.

First ideas of improvement:

  1. when viewing a topic, reditect to a suitable translation of it based on HTTP_ACCEPT_LANGUAGE or a user's LANGUAGES preference. Have no idea of how to do that yet (I do accept suggestions, links, or anything about it wink )
  2. Figure out how to deal with translation of topic names.

-- AntonioTerceiro - 19 Jun 2005

Thanks for contributing.

Presumably the admin is supposed to embed the %TRANSLATIONS% tag in the LayoutTemplate?

-- MartinCleaver - 19 Jun 2005

That's a possibility, indeed. Another one is to %INCLUDETRANSLATION{WebMenu}% in WebLeftBar, for example.

-- AntonioTerceiro - 20 Jun 2005

Thanks Antonio for contributing this Plugin to the TWikiCommunity smile

-- PeterThoeny - 25 Jun 2005

Just released a new version. Main new features:

  • handling of missing translations.
  • automatic redirection for the "best" language available.

-- AntonioTerceiro - 02 Jul 2005

New release fixing redirection: restrict redirection to just the more commons situations.

-- AntonioTerceiro - 03 Jul 2005

Great job man!

-- JarbasJunior - 15 Jul 2005

Hi Terceiro!

I'm alread using this plugin in the new Brito Cunha web site!

My plugin have a topic done for your plugin hire in TWiki.org with the pt-br option: FlowchartPluginPtbr wink

-- AurelioAHeckert - 17 Jul 2005

Terceiro, I try to make a list of translations, but separator="\n" don't work...

Can you put $n, $percnt and $dollar for a more complex formating ideias?

And... I found a Bug!

If you come from the preview script it redirects you for the topic language prefered. You make the save ok, but forgot the preview. stick out tongue

-- AurelioAHeckert - 17 Jul 2005

Just taking note of the current (todo|wish)list, to work when I got some time:

  • add %ATTACHURLLANG{lang}%, to make possible referencing attachments in other translation of the curruent topic.%ATTACHURLLANG% would catch the default translation.
  • add %DEFAULTTRANSLATION%, expanding to the name of the default version of the current topic.
  • prevent redirection on preview (maybe just add a ^ in the begin of the action checking regex) on checkRedirection.
  • think in a way of referencing languages "full names", and add a format variable (say, $languagename) for it. For example:
    pt-br Português
    es Español
    fr Français
    • how and where should those names be stored?

-- AntonioTerceiro - 04 Aug 2005

I added codes to the plugin that can redirect to best translation topic usring %LANGUAGE%. Of course, I can select one of two type methods %LANGUAGE% and HTTP_ACCEPT_LANGUAGE. If anyone need this, please tell me how I can help you.

-- BeomsuChang - 10 Aug 2006

Hi BeomsuChang,

Would you please post here a patch with your changes? It would be nice to include your improvements into the main plugin distribution.

-- AntonioTerceiro - 10 Aug 2006

I attached the patch. Keyword to change redirection method is "Set REDIRECTMETHOD = user || http".

-- BeomsuChang - 11 Aug 2006

just in case you didn't not: I released a new version of TopicTranslationsPlugin yesterday, including some fixes I've been working on and including a slightly modified version of BeomsuChang's patch for REDIRECT_METHOD.

-- AntonioTerceiro - 05 Sep 2006

Antonio, I made a few changes to the plugin topic, please feel free to take this into the next release:

  • Escaped links to oneself (recommended by Jakob Nielsen)
  • Small change in SHORTDESCRIPTION

-- PeterThoeny - 06 Sep 2006

Peter, thaks for your updates. I'll certainly consider them in the next release.

-- AntonioTerceiro - 06 Sep 2006

new version just released.

-- AntonioTerceiro - 23 Sep 2006

Hi Antonio, when I use TopicTranslationsPlugin (only enabled through LocalSite.cfg) I got following error/warning when using "mailnotify"

mailnotify: Use of uninitialized value in pattern match (m//) at 
/var/web/wiki.server.nrc.de/htdocs/lib/TWiki/Plugins/TopicTranslationsPlugin.pm line 266.

Do you have any idea what this does mean?

-- ThomasFreudenberg - 13 Nov 2006

Hi Thomas,

The problem is that TTP is trying to check environment variables that are only available when it is in the context of a web request, which definitely isn't the case of mailnotify.

The following patch should remove the warning, while I don't manage to release a new version (which will include this fix):

--- TopicTranslationsPlugin.pm.orig     2006-11-14 10:28:08.000000000 -0300
+++ TopicTranslationsPlugin.pm  2006-11-14 10:29:30.000000000 -0300
@@ -263,7 +263,7 @@
 sub checkRedirection {
     # we only want to be redirected in view or viewauth, and when there is no
     # extra parameters to the request:
-    if (($ENV{SCRIPT_NAME} =~ m#/view(auth)?$#) and (! $ENV{QUERY_STRING})) {
+    if ($ENV{SCRIPT_NAME} and ($ENV{SCRIPT_NAME} =~ m#/view(auth)?$#) and (! $ENV{QUERY_STRING})) {
         my $query = TWiki::Func::getCgiQuery();

         # several checks

Thanks for reporting.

-- AntonioTerceiro - 14 Nov 2006

small TODO for next release:

-- AntonioTerceiro - 14 Nov 2006

It is clear now, that the redirect method was not a good idea. There are a lot of possible reasons for user to switch langage temporaly. It is so naturaly to use the top bar language selector to switch topic language. Why not? Do any of user really need different interface and topic languages on the same screen? Definitely not! We should establish a general language selection structure, common to topics and interface so that if user change language, then all the information appears in the selected language.

-- SergejZnamenskij - 26 Jan 2007

I'm of the same opinion as SergejZnamenskij. The language selection in the top bar would be a great place for folks to define what language to see a site in. This way it's easy to switch back and forth between languages (for those bilingual folks). It would also help folks trying to learn a new language to be able to swap back and forth between languages quickly.

Is keying off the language selector in the top menu an easy tweak?

-- DustinGooding - 24 Mar 2007

Just tried to install this plugin on TWiki 4.2.0, but had no success, neither on Windows nor on Linux platform. Anyone tried it recently?

-- SebastianKlus - 23 Jun 2008

Hey, the Documentation talks about REDIRECT_METHOD... Plugin makes use of REDIRECTMETHOD:

$redirectMethod = TWiki::Func::getPreferencesValue("REDIRECTMETHOD") || TWiki::Func::getPluginPreferencesValue("REDIRECTMETHOD") || "http";

-- AlexanderBreuer - 15 Jul 2008

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatpatch TopicTranslationsPlugin.pm.patch r1 manage 2.0 K 2006-08-11 - 09:32 BeomsuChang redirection patch by BeomsuChang. Don't use this.!! This is not official!!
Edit | Attach | Watch | Print version | History: r24 < r23 < r22 < r21 < r20 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r24 - 2008-07-15 - AlexanderBreuer
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.