FIX #38846 - type values not translated in com_finder search result#39353
FIX #38846 - type values not translated in com_finder search result#39353cyrez wants to merge 5 commits intojoomla:4.2-devfrom
Conversation
|
I don't really want to have a special case just for the type, but translate everything. |
What do you mean by translating everything? other values are from item data linked to their associated language. |
|
I confirm that it works and fixes the error. @cyrezdev Before I submit a successful test, perhaps you can quickly fix an identical problem in the admin panel on the Smart Search: Index page. If it can't enter this PR - let me know and I'll post a successful test. |
I will see to fix it in another PR (and others things i've seen to be improved or fixed in com_finder...). So better to test this PR alone ;-) |
|
Please keep pull requests to single tasks. |
|
I have tested this item ✅ successfully on f2c1581 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39353. |
1 similar comment
|
I have tested this item ✅ successfully on f2c1581 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39353. |
@Hackwar Could you check and report back more detailed if something is wrong or missing? Thanks in advance. |
|
@Kostelano @viocassel Could you test again with the latest changes? Thanks in advance. |
|
Thanks @richard67 for review! 👍 @Kostelano @viocassel Sorry, it needs test again, as i've changed the code with error fix, and removal of language hasKey control (as already processed in branchSingular). Could you test new version? Thank you! |
|
I have tested this item ✅ successfully on f98078b This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39353. |
|
I have tested this item ✅ successfully on f98078b This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39353. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39353. |
|
I have tested this item 🔴 unsuccessfully on f98078b @Kostelano @viocassel Are you sure you have tested according to the description in issue #38846 with the latest changes in this PR? @cyrezdev I think you need to do it in the way like you had it at the beginning, i.e. replace the by in the I will suggest a code change on GitHub. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39353. |
|
Back to pending due to unsuccessful test. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39353. |
|
@richard67 Yes, you're right, it's broken now. I tested late at night and somehow the latest changes to the assembly did not transfer. Sorry. I can also confirm that your suggested change works. |
|
Oh i'm sorry... Maybe too much tired due to covid... :-D So, @richard67 not needed to control hasKey as already processed in LanguageHelper::branchSingular I've updated this PR, accordingly to my local code... |
Correct, I just saw that. |
|
@Kostelano @viocassel the change was maybe not applied on your last test, so could you test again, and control code change is the same as the PR ? Sorry for inconvenience, and thanks for your time testing! ;-) |
|
I have tested this item ✅ successfully on 24b930a This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39353. |
|
I have tested this item ✅ successfully on 24b930a This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39353. |
@Hackwar Is your comment clarified with that response? If not, could you make any suggestions on what to change? |
|
@SharkyKZ Still not ok with this PR after it has received some changes? |
|
Did you not see #39353 (comment)? This fixes the issue for a specific hardcoded taxonomy but does not work for other taxonomies that may be translatable in the same manner. |
What you linked to is in another PR (for admin side): #39359 Not related to this PR (frontend search results) |
It's probably a third party content type. For example, in this case, with such PR logic, smart search will work for the Contacts type (it really works - I checked it), but it may NOT work with a third-party component. The type may not be translated. Not sure. |
I did this PR, as i'm working on a smart search plugin for one of my extension. ;-) |
|
@cyrezdev What Sharky and Hackwar mean is that they don't like this |
Something like this: To explain why i did apply it only on
In don't have problems to apply it for all, but should we allow data translation ? For example, if you have a category with title stored in database "Contact", this title will be translated. Another example, you have an article with title "March". So, should we translate $item data? |
|
Maybe another way without checking that branch name is "Type" is to check for branch parent_id. What needs to be translated is all branches with parent_id = 1 (with ROOT as parent). This could work: What's your advice? @richard67 @Hackwar @SharkyKZ |
That could work. 1 is the root item in the taxonomy table, so that should not change. Or you could check the „level“ column, that should be 2 when parent_id is 1 because that’s the first child level of the root item, and there should not be any other items with level 1, so all level 2 are children of the root item. Maybe that’s better, I don’t really know how safely we can rely on the root item always having id = 1. if someone deletes that with SQL and rebuilds the table, it might have another id than 1. |
You mean level 1 ? For me, ROOT has level 0 (zero). |
Sorry, you are right. Root item has level 0, so its direkt children have level 1. |
In fact, it won't work... I've tested. All taxonomy types have level 1. (Article, Category, Contact...) I have 2 proposals: 1. Using a different way to add taxonomy when we expect its value to be translated. For example, instead of this currently in plg_finder_content: We can set it like this: And then, in search/default_results.php, code like this: It requires too an update for filter (select type) to trim And for content map filter in admin: This way, it is backward compatible (same behavior as before with no translation, if 2. No change with WARNING !
So code in search/default_results.php: SUM-UP:
Of course, if @richard67 @Hackwar @SharkyKZ and others agree to solution 1, i will update this PR accordingly. ;-) |
|
@richard67 No news from other, but after some reflexions, i think the PR as it is, and was successfully tested, is valid. As checking for So, this PR to fix this issue with translation, works. And for else (better handling of translatable or not value), it would need a refactory of com_finder, which could be set for J5.0 What's your opinion? |
Ok, thank you! But i don't think he has seen the possible issue of unwanted translation, if translating everything (not only Type value). @Hackwar this PR fixes issue for com_finder in frontend as com_finder works currently, but it would need some refactory to extend its possibilities. Possible issue in applying translation for all: |
|
@richard67 @Kostelano @viocassel As the previous PR got no news, and some requested translation for all values (#39353 (comment)), with no type check, i've redo a PR to simplify it, as i would expect this simple issue to be fixed asap! ;-) So there the new PR: #39636 Thank you in advance for your testing! 👍 |


Pull Request for Issue #38846.
Summary of Changes
Check if taxonomy is "Type" and translate its data.
Testing Instructions
Actual result BEFORE applying this Pull Request
Before PR, Type: Category for all languages (Category not translated):
en-GB

fr-FR

de-DE

Expected result AFTER applying this Pull Request
After PR, Category is translated:
en-GB

fr-FR

de-DE

Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed