Skip to Content Skip to Menu

Autocomplete with search for language strings

  • ericmuc
  • ericmuc
  • OFFLINE
  • Posts: 390
  • Thanks: 30
  • Karma: 2
  • Add-ons
4 years 10 months ago #315804 by ericmuc
Hi,
I have a text field and created an autocomplete with a country list.
That works generally, but only with the names in the column of the mysql data base.
The search shall be with the translated names of the override file.
For example I have:
'cn_germany' in mysql, and 'Deutschland' in override with 'cn_germany'=>'Deutschland',
I want to have a search with 'deu' and 'Deutschland' should be shown. At the moment I can type in 'cn_g' and 'Deutschland' is shown.
How can I get this function?
Thanks, best regards
Eric

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48435
  • Thanks: 8275
  • Karma: 1443
4 years 10 months ago #315814 by krileon
Replied by krileon on topic Autocomplete with search for language strings
The auto complete just responds with whatever the results of your query are so if you want it to search the translated values then you need to add that to your query. I've no idea the SQL structure of your countries table so there isn't much I can suggest. The upcoming CB Quickstart package implements this autocomplete automatically if CBSubs is installed and it uses the below to search English, alternative name, and ISO codes for countries.

Code:
SELECT `country_name` FROM `#__comprofiler_countries` WHERE ( `country_iso_code2` = '[value]' OR `country_iso_code3` = '[value]' OR `country_fips_code` = '[value]' OR `country_name` LIKE '[value]%' OR `country_region` LIKE '[value]%' OR `country_sub_region` LIKE '[value]%' OR `country_fips_name` LIKE '[value]%' OR `country_alternate_names` LIKE '%[value]%' )


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • ericmuc
  • ericmuc
  • OFFLINE
  • Posts: 390
  • Thanks: 30
  • Karma: 2
  • Add-ons
4 years 10 months ago #315819 by ericmuc
Replied by ericmuc on topic Autocomplete with search for language strings
Thanks,
but I am looking for soemting like
Code:
SELECT `country_name` FROM `#__comprofiler_countries` WHERE ( `xxxxxx` = '[value]' )

XXX = the translated value of the language string, stored in the mysql data base.
Is that possible?
Thanks, best regards
Eric

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48435
  • Thanks: 8275
  • Karma: 1443
4 years 10 months ago #315830 by krileon
Replied by krileon on topic Autocomplete with search for language strings
If you've a database column for the translated title then yes set xxxxxx to whatever that column is. Typically you don't search for the translated value since that's unreasonable to be storing the country in multiple languages in the database. Probably only way to really do that efficiently is to use CB Code Field and its Auto Complete then use custom PHP to translate everything then filter the list down from there, but that's going to be a lot slower since you'll need to grab all the countries and translate them first.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum