multilingual plugin weirdness

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

multilingual plugin weirdness

Post by frineu »

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/c ... -!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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual plugin weirdness

Post by garvinhicking »

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: 32
Joined: Wed Feb 24, 2010 4:33 pm
Location: Berlin, Germany
Contact:

Re: multilingual plugin weirdness

Post by frineu »

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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual plugin weirdness

Post by garvinhicking »

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: 32
Joined: Wed Feb 24, 2010 4:33 pm
Location: Berlin, Germany
Contact:

Re: multilingual plugin weirdness

Post by frineu »

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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual plugin weirdness

Post by garvinhicking »

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: 32
Joined: Wed Feb 24, 2010 4:33 pm
Location: Berlin, Germany
Contact:

Re: multilingual plugin weirdness

Post by frineu »

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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual plugin weirdness

Post by garvinhicking »

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: 32
Joined: Wed Feb 24, 2010 4:33 pm
Location: Berlin, Germany
Contact:

Re: multilingual plugin weirdness

Post by frineu »

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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual plugin weirdness

Post by garvinhicking »

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: 32
Joined: Wed Feb 24, 2010 4:33 pm
Location: Berlin, Germany
Contact:

Re: multilingual plugin weirdness

Post by frineu »

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: 32
Joined: Wed Feb 24, 2010 4:33 pm
Location: Berlin, Germany
Contact:

Re: multilingual plugin weirdness

Post by frineu »

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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual plugin weirdness

Post by garvinhicking »

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: 32
Joined: Wed Feb 24, 2010 4:33 pm
Location: Berlin, Germany
Contact:

Re: multilingual plugin weirdness

Post by frineu »

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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: multilingual plugin weirdness

Post by garvinhicking »

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