No Code Attached Yet
avatar Kostelano
Kostelano
19 Jul 2021

Steps to reproduce the issue

  1. Install some other language (it is desirable that it is clearly different from English). For example, Russian.
  2. Enable the option for taxonomy of results in the smart search component.
  3. Install demo data.
  4. Go to the frontend and try to enter some obvious word / phrase in another language (not en-GB).

You will get results. And in the taxonometry column there will be terms that are not localized.

Screenshot_1

A piece of code that outputs the lines:

<ul class="result__taxonomy">
	<?php foreach ($taxonomies as $type => $taxonomy) : ?>
		<?php $branch = Taxonomy::getBranch($type); ?>
		<?php if ($branch->state == 1 && in_array($branch->access, $user->getAuthorisedViewLevels())) : ?>
			<?php $taxonomy_text = []; ?>
			<?php foreach ($taxonomy as $node) : ?>
				<?php if ($node->state == 1 && in_array($node->access, $user->getAuthorisedViewLevels())) : ?>
					<?php $taxonomy_text[] = $node->title; ?>
				<?php endif; ?>
			<?php endforeach; ?>
			<?php if (count($taxonomy_text)) : ?>
				<li class="result__taxonomy-item result__taxonomy--<?php echo $type; ?>">
					<span><?php echo $type; ?>:</span> <?php echo implode(',', $taxonomy_text); ?>
				</li>
			<?php endif; ?>
		<?php endif; ?>
	<?php endforeach; ?>
</ul>

Anticipating the question, are all strings translated ...? Yes, everything is translated. It's not about the constants.

avatar Kostelano Kostelano - open - 19 Jul 2021
avatar joomla-cms-bot joomla-cms-bot - change - 19 Jul 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 19 Jul 2021
avatar Kostelano
Kostelano - comment - 19 Jul 2021

The same story in the control panel - smart search - content index. Choosing a content map.

Screenshot_1

By the way, in Joomla 3 too.

avatar wilsonge
wilsonge - comment - 25 Jul 2021

// cc @Hackwar

avatar brianteeman
brianteeman - comment - 31 Jul 2021

Found the problem - looking for a solution

avatar brianteeman
brianteeman - comment - 31 Jul 2021

Only checked the admin but its almost certainly the same problem. The untranslated words are the taxonomy branches. Taxonomy branches are created in the finder plugins for example

// Add the country taxonomy data.
if (!empty($item->country) && $this->params->get('tax_add_country', true))
{
$item->addTaxonomy('Country', $item->country);
}

As can be seen this will create a taxonomy branch called Country

You can confirm this by first changing Country to Fruit. Clearing the finder index and then reindexing the content.

The dopdown filter will now have a section called Fruit

avatar brianteeman
brianteeman - comment - 31 Jul 2021

Changing the code above to
$item->addTaxonomy('PLG_FINDER_QUERY_FILTER_BRANCH_P_COUNTRY', $item->country);

and then updating

if ((int) $branch->level === 1)
{
$name = $branch->text;
}

to
$name = TEXT::_($branch->text);

Seems to be a good starting point but it becomes a bit of a rabbit hole after that so maybe this isnt the correct approach.

Anyone?

avatar Fedik
Fedik - comment - 31 Jul 2021

Changing the code above to $item->addTaxonomy('PLG_FINDER_QUERY_FILTER_BRANCH_P_COUNTRY', $item->country);

I do not think that it is a good idea doing it when indexing,
It should be translated while rendering. Somewhere in layout (and field).

$name = $branch->text;

hm, in j3 there it without JText, does it also issue on Joomla 3?

avatar brianteeman
brianteeman - comment - 31 Jul 2021

I do not think that it is a good idea doing it when indexing,

Its not translating it during indexing. Its just using a translatable key instead of hard-coded english

avatar brianteeman
brianteeman - comment - 31 Jul 2021

hm, in j3 there it without JText, does it also issue on Joomla 3?

Honestly no idea. I never work with joomla in any other language.

avatar Kostelano
Kostelano - comment - 1 Aug 2021

Yes, in Joomla 3 the situation is the same. Only in the control panel.

avatar Hackwar
Hackwar - comment - 26 Jan 2022

#36863 fixes this.

avatar Quy Quy - change - 27 Jan 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-01-27 00:59:51
Closed_By Quy
Labels Added: No Code Attached Yet
Removed: ?
avatar Quy Quy - close - 27 Jan 2022
avatar Quy
Quy - comment - 27 Jan 2022

Closing as having a pull request.

avatar Destroy666x
Destroy666x - comment - 5 May 2024

So, how exactly do you translate those now? I have latest translations + I see the merged code is in the search results template, but the labels are still in English. I guess I need some overrides, but not too sure how they should be called.

avatar Hackwar
Hackwar - comment - 6 May 2024

You have to add translation strings in the format PLG_FINDER_QUERY_FILTER_BRANCH_S_[taxonomy-title]. No need to create layout overrides or something.

avatar Destroy666x
Destroy666x - comment - 6 May 2024

Not layout overrides, language overrides.

Where to get the taxonomy title? I tried e.g. AUTHOR (PLG_FINDER_QUERY_FILTER_BRANCH_S_AUTHOR) for Author or TYPE (PLG_FINDER_QUERY_FILTER_BRANCH_S_TYPE) for Type but nope. I also looked in other popular language packages and no sign of PLG_FINDER_QUERY_FILTER_BRANCH_S_ in them. This could certainl be better documented IMO.

avatar Destroy666x
Destroy666x - comment - 10 May 2024

@Hackwar I think this is just untranslatable. According to the code, unless I'm missing something regarding $branchName, it should work. Unless it just doesn't work with language overrides for whatever reason. Please correct me if I'm wrong.

Add a Comment

Login with GitHub to post a comment