GetSimpleCMS-CE-plugins / plugin-i18n-Search-r

Added php8.x support
0 stars 1 forks source link

i18n-search-r doesn't work with russian words #1

Open VeNick-GS opened 1 year ago

VeNick-GS commented 1 year ago

Hi there

Plugin i18n-search-r v.9.99 (also i18n-search v.2.13.4) doesn't output russian and ukrainian words in to search result page, just a phrase "No results found". In the same time both plugins work correctly with all english words despite file /data/other/i18n_words_index.txt includs words and page slugs of all laguages.

Code of my search form (in component) is: <?php get_i18n_search_form(array('slug'=>'search', 'GO'=>'Поиск', 'PLACEHOLDER'=>'Введите ключевые слова')); ?>

and code for output search results on pages 'search', 'search_ru', 'search_ua' is: (% searchresults %)

Are there special parameters for RU or UA langs search in v.9.99? What is difference between v.9.99 and v.2.13.4?

Also you can find UK lang file for i18n-search plugin here: https://github.com/VeNickov/plugin-i18n-Search-UK-localization/blob/main/i18n_search/lang/uk.php

risingisland commented 1 year ago

The v9.99 (serach-r) is from a modification from this Russian site, where you can find more info: https://getsimplecms.ru/plaginy-dlya-getsimple-cms/plagin-i18n-search/ Maybe they explain fix for this too? I didnt look. I will soon include your UK lang in both plugins.

risingisland commented 1 year ago

@VeNickov Were you able to find an answer to this?

VeNick-GS commented 9 months ago

hi @risingisland Still no answer. I have installed plugin i18n-search from Martin Vlcek and get the same result. Plugin is working with english words (tags) and doesn't show results for russian words (tags). More over there are the following error is visible in debug more in the search form <?php get_i18n_search_form(array('slug'=>'search')); ?>of the template:

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/.../htdocs/admin/inc/basic.php on line 465

And 3 errors in the console panel of the browser:

Uncaught ReferenceError: $ is not defined
    at search?tags=&words=%D0%BF%D1%80%D0%BE%D1%81%D1%82%D0%BE&search=%D0%9F%D0%BE%D1%88%D1%83%D0%BA:212:5
jquery.autocomplete.min.js:15 Uncaught ReferenceError: jQuery is not defined
    at jquery.autocomplete.min.js:15:14455
Uncaught ReferenceError: $ is not defined
    at search?tags=&words=%D0%BF%D1%80%D0%BE%D1%81%D1%82%D0%BE&search=%D0%9F%D0%BE%D1%88%D1%83%D0%BA:246:9
risingisland commented 9 months ago

@VeNickov Could you try this to see if it fixes your "Deprecated" error?

Change this section: https://github.com/GetSimpleCMS-CE/GetSimpleCMS-3.3.19/blob/63b3f5c76dbd1f618e2dc6989f7b39b70d1e3a8a/admin/inc/basic.php#L464-L469

To the following:

      if (trim($PERMALINK) != '' && $slug != 'index'){
          $plink = str_replace('%parent%/', $parent ?? '', $PERMALINK);
          $plink = str_replace('%parent%', $parent ?? '', $plink);
          $plink = str_replace('%slug%', $slug ?? '', $plink);
          $url = $full . $plink;
      }

For the jQuery errors, can you view the output to see if jQuery is being loaded before dependencies?

risingisland commented 9 months ago

@VeNickov Does your template contain <meta charset="utf-8"> in the header?

VeNick-GS commented 9 months ago

@VeNickov Could you try this to see if it fixes your "Deprecated" error?

Change this section: https://github.com/GetSimpleCMS-CE/GetSimpleCMS-3.3.19/blob/63b3f5c76dbd1f618e2dc6989f7b39b70d1e3a8a/admin/inc/basic.php#L464-L469

To the following:

    if (trim($PERMALINK) != '' && $slug != 'index'){
        $plink = str_replace('%parent%/', $parent ?? '', $PERMALINK);
        $plink = str_replace('%parent%', $parent ?? '', $plink);
        $plink = str_replace('%slug%', $slug ?? '', $plink);
        $url = $full . $plink;
    }

For the jQuery errors, can you view the output to see if jQuery is being loaded before dependencies?

The following errors are still present:

search?tags=&words=%D0%BF%D1%80%D0%BE%D1%81%D1%82%D0%BE&search=%D0%9F%D0%BE%D1%88%D1%83%D0%BA:210 Uncaught ReferenceError: $ is not defined
    at search?tags=&words=%D0%BF%D1%80%D0%BE%D1%81%D1%82%D0%BE&search=%D0%9F%D0%BE%D1%88%D1%83%D0%BA:210:5
(анонімно) @ search?tags=&words=%D0%BF%D1%80%D0%BE%D1%81%D1%82%D0%BE&search=%D0%9F%D0%BE%D1%88%D1%83%D0%BA:210
jquery.autocomplete.min.js:15 Uncaught ReferenceError: jQuery is not defined
    at jquery.autocomplete.min.js:15:14455
(анонімно) @ jquery.autocomplete.min.js:15
search?tags=&words=%D0%BF%D1%80%D0%BE%D1%81%D1%82%D0%BE&search=%D0%9F%D0%BE%D1%88%D1%83%D0%BA:244 Uncaught ReferenceError: $ is not defined
    at search?tags=&words=%D0%BF%D1%80%D0%BE%D1%81%D1%82%D0%BE&search=%D0%9F%D0%BE%D1%88%D1%83%D0%BA:244:9
VeNick-GS commented 9 months ago

@VeNickov Does your template contain <meta charset="utf-8"> in the header?

Yes

VeNick-GS commented 9 months ago

And when I deleted search form from the template there are no errors

risingisland commented 9 months ago

The first snippet fixed the "Deprecated" error then, correct?

risingisland commented 9 months ago

In your search, if you enter a word in English, do the errors appear?

I am guessing it is not converting or reading the cyrillic characters and is converting them to Windows-1251 instead of UTF-8 with BOM.

Or do these errors appear even without entering a word to search?

VeNick-GS commented 9 months ago

The first snippet fixed the "Deprecated" error then, correct?

correct

VeNick-GS commented 9 months ago

In your search, if you enter a word in English, do the errors appear?

I am guessing it is not converting or reading the cyrillic characters and is converting them to Windows-1251 instead of UTF-8 with BOM.

Or do these errors appear even without entering a word to search?

There is not error in the bebug mode (not for en and not for ru). Just for 'ru' words is nothing found. For 'en' words is OK. More over there is forth error in the browser consol: search:1 Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received

risingisland commented 9 months ago

@VeNickov Looking at the forum, I see that several other Russian users have had problems similar to yours for many years, and it doesnt look like any answers were given to them either :/ You may want to send a PM to Oleg06 to see if they can help you with this one, as I dont have an answer at the moment. If there is a fix, post it here and I will add it.