darkhoros VIP
Total posts: 152
11 Нояб 2017 13:46

Hi, To my shock I was surprised that cobalt dose not support language overrides for tags field and category field in the filters. Trying to enter a category name in filters I find that it returns the category name that is entered while creating the new category and not respecting the language override.

So instead of showing "Apartment" it shows "CAT_APARTMENT" in the autocomplete suggestions. "CAT_APARTMENT" is the category name as entered in categry page while createing new category. And "Apartment" is the value for the CAT_APARTMENT variabble in the language override for en-GB language.

I think this issue will not be resolved any time soon, so I am just reporting it.

Now, I need to ask a question, if I have a database query that I need it to pass through the language override files before the query return the select results, how can I do this, where do I start reading about how to acomplish such task, the query retuens the expected results, but I need this result to use the language override values rather than the actual variables from the initail select statment.

Thank you.

Последние изменения: 13 Дек 2017


Sergey
Total posts: 13,748
12 Нояб 2017 05:07

darkhoros Trying to enter a category name in filters I find that it returns the category name that is entered while creating the new category and not respecting the language override.

The way joomla handles language constant overrides works this way. You enter a key and then create translations. If you ever search in those texts you search language keys. You cannot search values of different language.

darkhoros I think this issue will not be resolved any time soon, so I am just reporting it.

Why? May be I can do something about it. Can you make screenshot where those values apper and I will see what I can do.

darkhoros Now, I need to ask a question, if I have a database query that I need it to pass through the language override files before the query return the select results, how can I do this, where do I start reading about how to acomplish such task, the query retuens the expected results, but I need this result to use the language override values rather than the actual variables from the initail select statment.

Joomla does not store translations in the DB. It store it in INI files. But problem here is that language file may have translation that are not related to search but will be found. For example you search for translations of categories and it will find title of section.

So main flow woul be:

  1. Create language constants with younique prefix like CATFS_**
  2. Use parse_ini_file('file/name.ini') to convert INI files that contain translations to array.
  3. Cycle through array and filter only those keys that start with CATFS_
  4. Cycle through array and search for values match.

Something like this.


darkhoros VIP
Total posts: 152
12 Нояб 2017 19:49

Joomla does not store translations in the DB. It store it in INI files. But problem here is that language file may have translation that are not related to search but will be found. For example you search for translations of categories and it will find title of section.

I understand that translation are stored in files rather than DB, I have added prefix for the translations I am targeting, so it will not be mistaken. What I dont understand, is how to make a select statment compare its results to these translations then print out the search results after using language files.

Lets say I have a: select * from table where column like '%searchterm%'; The result is MLU_CAT_blah-blah-blah

In the en-gb.ini I have MLU_CAT_blah-blah-blah = category one.

I like to have category one printed out as my search result.

Why? May be I can do something about it. Can you make screenshot where those values apper and I will see what I can do.

What screenshoot should I send to you? I have already explaind the issue of the autocomplete categories with language file values; This is the issue that I said I dont think it will be resolved.

Thank you.


Sergey
Total posts: 13,748
13 Дек 2017 14:24

In any case, if you want to make language dependent search of words translated with language keys, you have to first search in language files and then find language key and only then search in DB by this key.

The problem here language file does not separate what key is category title and what key is anything else.

Работает на Cobalt