Hello,
I don't want to nag, but I don't know if you appreciate if a bug is discovered, even a small one.
In this case: If the quicksearch returns empty or too short, the multilingual plugin is not triggered, so the title is not translated and is displayed with the {{}} brackets. If entries are shown as result, these entries trigger the strip_languages() function on the title and description.
Unfortunately, I don't know enough to locate the problem, like which event is triggered for the empty search of is simply none is triggered … in the genpage, it is get - action = search, and the genpage hook with title translation is listed in the plugin, but it doesn't work.
Bug in multilingual plugin for empty searches
-
- Regular
- Posts: 23
- Joined: Sat Nov 25, 2017 12:08 am
Re: Bug in multilingual plugin for empty searches
We do! Let's see whether we can pinpoint the issue. Only thing better than bug reports are pull requests ;)I don't want to nag, but I don't know if you appreciate if a bug is discovered, even a small one.
Could you debug this a bit more? Is tag_title being called on that search result page when the error occurs?
-
- Regular
- Posts: 23
- Joined: Sat Nov 25, 2017 12:08 am
Re: Bug in multilingual plugin for empty searches
Stupid question - how do find out if tag_title is being called? Only thing I did was a look in the source code and with $serendipity['production'] = 'debug' I get the smarty vars, with the unprocessed $BlogDescription string.
PS: I got creative and changed the tag_title function to display nonsense in the title: But this nonsense doesn't appear in the empty search result, so the answer is no. I did the same within the genpage hook in the multilingual plugin, and this hook is called. But the line
there doesn't have an effect while this smarty->assign does. There are the $serendipity vars and the smarty vars and somewhere in between it doesn't work.
For archive pages, the genpage hook calls the smarty assign for the title explicitly - why?
Doing that for all pages or the search result too would work, but is that the right solution?
PS: I got creative and changed the tag_title function to display nonsense in the title:
Code: Select all
$serendipity['smarty']->assign('blogTitle', 'BBB');
Code: Select all
$serendipity['blogDescription'] = $this->strip_langs($serendipity['blogDescription']);
For archive pages, the genpage hook calls the smarty assign for the title explicitly - why?
Code: Select all
// assign lang stripped blogTitle to archive page, which overwrites them for case archive pages
if ($serendipity['plugindata']['smartyvars']['view'] == 'archive') {
$serendipity['smarty']->assign('blogTitle', $serendipity['blogTitle']);
$serendipity['smarty']->assign('blogDescription', $serendipity['blogDescription']);
}
Re: Bug in multilingual plugin for empty searches
I would have added ahow do find out if tag_title is being called?
Code: Select all
echo "tag_title";
I guess it depends on when this gets called. If serendipity later assigns the regular blogTitle and description the smarty variables could get overwritten.For archive pages, the genpage hook calls the smarty assign for the title explicitly - why?
Or it might be that the plugin grew a bit organically and these are different approaches mixed together, without a real reason.
I'm not familiar at all with how the plugin works. The strange thing is that the search result page look different depending on whether there are search results. That might come from something in the core, different behaviour with the smarty variables by ending earlier. But I would suggest to try it out: If assigning those variabels explicitely like for the archives pages fixes the bug, then that would work for me.Doing that for all pages or the search result too would work, but is that the right solution?
-
- Regular
- Posts: 23
- Joined: Sat Nov 25, 2017 12:08 am
Re: Bug in multilingual plugin for empty searches
Okay, i took the quick fix and removed the if-statement, so that the assign in the genpage hook is now done no matter what and that worked. Would you like to implement the fix yourself or should I make an pull request via Github?
Re: Bug in multilingual plugin for empty searches
I'd much prefer a pull request via github :) You can also directly raise the version number in there.