multilingual plugin weirdness

Creating and modifying plugins.
frineu
Regular
Posts: 28
Joined: Wed Feb 24, 2010 5:33 pm
Location: Berlin, Germany
Contact:

multilingual plugin weirdness

Post by frineu » Wed Feb 24, 2010 7:37 pm

Hello,
After updating the multilingual plugin to version 2.6 and serendipity to version 1.5.2 the output of category names, title and subtitle in the header is not recognized by the multilingual plugin when i view all posts from one category.
Please visit http://www.nico-beuermann.de/blogging/categories/4-!deFotos-!enPhotos to see what i mean.

First thought was that it's because of the customized style. But changing the style of the site results in the same behaviour.

Any clues?
Nico

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual plugin weirdness

Post by garvinhicking » Thu Feb 25, 2010 11:25 am

Hi!

Did you check the configuration of the plugin, if the option to apply a tagged_title is still activated?

Did you maybe install other event plugins, this could maybe be an issue of plugin orders; try to move the multilingual plugin down to the bottom?

Reading the code, inside the plugin the activation of replacing blogTitle and blogDescription is still there, but only if the option "tagged_title" is enabled...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

frineu
Regular
Posts: 28
Joined: Wed Feb 24, 2010 5:33 pm
Location: Berlin, Germany
Contact:

Re: multilingual plugin weirdness

Post by frineu » Thu Feb 25, 2010 11:31 pm

Hi,
thanks for your quick response.

The only deactivated option is "Tag translation of entries and entry titles".

It's now at the bottom, but that didn't change anything.
Here is an ordered list of used event plugins:
serendipity_event_emoticate v1.6
browser compatibility v1.1
serendipity_event_xhtmlcleanup v1.6
serendipity_event_nl2br v2.0
serendipity_event_weblogping v1.07
serendipity_event_statistics v1.49
serendipity_event_searchhighlight v1.6
serendipity_event_contactform v1.12
serendipity_event_spartacus v2.22
serendipity_event_spamblock v.1.77
serendipity_event_staticpage v3.8
serendipity_event_entryproperties v1.3
serendipity_event_multilingual v2.6

Nico

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual plugin weirdness

Post by garvinhicking » Fri Feb 26, 2010 12:06 pm

Hi!

Hm, okay. This will take us to some more debugging then, I'm afraid.

Can you edit your serendipity_event_multilingual.php plugin file. At around line 406 you should find:

Code: Select all

       if (serendipity_db_bool($this->get_config('tagged_title', 'true'))) {
             $serendipity['smarty']->assign('blogTitle',$this->strip_langs($serendipity['blogTitle']));
             $serendipity['smarty']->assign('blogDescription',$this->strip_langs($serendipity['blogDescription']));
         }


This is the check that changes blogTitle/description with the parsed representation.

In a first step, please change that to:

Code: Select all

       if (serendipity_db_bool($this->get_config('tagged_title', 'true'))) {
         die('Assigning tagged title');
       } else {
         die('Assigning turned off');
       }


Onc eyou save the file and hit your blog URL, you should see either "Assigning tagged title" or the other string. This will lead us further on why the code might not be executed.

As a second step, we'd be changing the code to:

Code: Select all

       if (serendipity_db_bool($this->get_config('tagged_title', 'true'))) {
             $serendipity['smarty']->assign('blogTitle','blogTitle!');
             $serendipity['smarty']->assign('blogDescription', 'blogDesc!');
       }


to see if the smarty code works. And if that does work, the last place to fix up things would be in the strip_langs() function...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

frineu
Regular
Posts: 28
Joined: Wed Feb 24, 2010 5:33 pm
Location: Berlin, Germany
Contact:

Re: multilingual plugin weirdness

Post by frineu » Fri Feb 26, 2010 1:52 pm

Hi,
your first debugging suggestion gives "Assigning tagged title" when hitting the blog URL.
This messages also appears when viewing category posts.

The second one gives:
"blogTitle!
blogDesc!"
on the starting (index) page.
Clicking on a category the header shows "{{!de}} ..." again.

Nico

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual plugin weirdness

Post by garvinhicking » Fri Feb 26, 2010 11:40 pm

Hi!

That's great, that means the strip_langs() function is actually called. I've never worked on my own with the syntax.

Currently you havE:

Code: Select all

{{!de}}Fotos{{--}}{{!en}}Photos{{--}}


I think in the past we already had an issue here where language setup might fail if one character of a language matches multiple times. I wasn't able to find a proper regular expression to fix this up, as the code is not mine and I don't have a full understanding of it.

Just for testing, could you instead use:

Code: Select all

{{!da}}Fotos{{!en}}Photos{{--}}


and then try to switch to Danish if that works? da and en share no characters, so let's see if that is the root of the issue.

R
egards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

frineu
Regular
Posts: 28
Joined: Wed Feb 24, 2010 5:33 pm
Location: Berlin, Germany
Contact:

Re: multilingual plugin weirdness

Post by frineu » Sat Feb 27, 2010 1:53 am

Hi,
I'd changed "{{!de}}Digitale Welt{{--}}{{!en}}Digital World{{--}}"
to "{{!da}}Digitale Welt{{--}}{{!en}}Digital World{{--}}"
After switching to Danish the header title looks like:
"{{!da}}Digitale Welt{{--}}{{!en}}Digital World{{--}}"

All other titles and headings left uninterpreted, too.

nico

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual plugin weirdness

Post by garvinhicking » Sun Feb 28, 2010 2:53 am

Hi!

Okay, this took me a long time. But now in my tests it does work.

When you view your blog, remember that if you are logged in, your personal language might always take precedence over other selections; so to see if this really works for visitors, you might want to try with a browser where you're not logged in.

My patch/current version can be found here:

http://php-blog.cvs.sourceforge.net/vie ... 33&r2=1.34

please tell me if that works out for you!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

frineu
Regular
Posts: 28
Joined: Wed Feb 24, 2010 5:33 pm
Location: Berlin, Germany
Contact:

Re: multilingual plugin weirdness

Post by frineu » Wed Mar 03, 2010 10:14 pm

Hi,
Now the category selection block in the sidebar is empty.
In category view the header still looks like being uninterpreted.

well, beside the version string i've changed
return '[^'.$lang[0].'][^'.$lang[1].']';
to
return '(?!' . $lang . ').*';
and
$pattern = '/\{\{\!'.$this->neglang($language).'\}\}.*?\{\{--\}\}|\{\{\!'.$language.'\}\}|\{\{--\}\}/s';
to
$pattern = '/\{\{\!'.$this->neglang($language).'\}\}.*?\{\{--\}\}|\{\{\!'.$language.'\}\}|\{\{--\}\}/imsU';
in serendipity_event_multilingual.php

Nico

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual plugin weirdness

Post by garvinhicking » Thu Mar 04, 2010 2:46 pm

Hi!

Ggr. I spent so much time on it, and it did work for me then. It seems that I committed a look-behind assertion only inside the regular expression. Now I also added a look-ahead assertion as well to replace with, and it seems to do the trick. Please check it out as well:

http://php-blog.cvs.sourceforge.net/vie ... 34&r2=1.35

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

frineu
Regular
Posts: 28
Joined: Wed Feb 24, 2010 5:33 pm
Location: Berlin, Germany
Contact:

Re: multilingual plugin weirdness

Post by frineu » Thu Mar 04, 2010 5:16 pm

Hi,
I'm too sorry. But your last change didn't change anything. I also tried it with a different browser.
Should I install serendipity locally to check if somethings wrong with the online version?

Nico

frineu
Regular
Posts: 28
Joined: Wed Feb 24, 2010 5:33 pm
Location: Berlin, Germany
Contact:

Re: multilingual plugin weirdness

Post by frineu » Sun Mar 07, 2010 9:41 pm

Hi,
I have to admit being a bit sketchy in my last reply.
There is a change in layout.
When I switch to English all titles in the sidebar disappear except for "Quicksearch" "Blog Administration" and "Powered By".
The page header also turns blank.
In category view the header text comes up with the uninterpreted title "{{!de...".

Regards
Nico

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual plugin weirdness

Post by garvinhicking » Mon Mar 08, 2010 1:42 pm

Hi!

In my testenvironment this worked. Maybe your PHP version does not have a recent RegExp-Engine. Would it be possible for me to get FTP access to your installation to debug things on your end? I believe this leads nowhere with the current approach... :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

frineu
Regular
Posts: 28
Joined: Wed Feb 24, 2010 5:33 pm
Location: Berlin, Germany
Contact:

Re: multilingual plugin weirdness

Post by frineu » Tue Mar 09, 2010 5:19 pm

Hi,
thank you very much for your awesome commitment!
Now most things are working, some don't:
The sidebar content is now working as expected.
Titles in detailed blog post view are translated as well
but
the title and subtitle in the header of my site are still uninterpreted in category view. That's true for both languages.

Nico

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual plugin weirdness

Post by garvinhicking » Wed Mar 10, 2010 4:18 pm

Hi!

In fact, that's an option that has not been implemented before, the plugin only replaced the blogtitles, not possible entry titles or category titles.

I've now added that to the plugin though, also on your site!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

Post Reply