Skip to Content Skip to Menu

🕒 Save Time and Effort with CB Editor Assistant: Effortlessly create and refine content in Joomla 3, 4, & 5.
🎁 Limited Offer: Enjoy a 5-day FREE trial and save up to 30% afterward!

[SOLVED] Translate Drop-down field content

7 years 6 months ago - 7 years 5 months ago #295484 by sylvain.ruda
[SOLVED] Translate Drop-down field content was created by sylvain.ruda
Hi,

I'm very new to Community Builder so excuse me if my question seems to be idiot.
I'm trying to translate the differents items of a CB Drop down list. I try to put Override keywords in my dorpdown but it does not work. Is there a way to do it ?
Last edit: 7 years 5 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48708
  • Thanks: 8319
  • Karma: 1447
7 years 6 months ago #295493 by krileon
Replied by krileon on topic Translate Drop-down field content
Use a language key for the label inputs like MYFIELD_OPTION_TEST and then add language overrides for that language key as follows.

Key: MYFIELD_OPTION_TEST
String: Test

You don't have to use a language key, but it does make it a lot easier. So for example if the label is set to Test you can translate it directly as follows without a language key.

Key: Test
String: Test 123


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.

7 years 6 months ago #295617 by sylvain.ruda
Replied by sylvain.ruda on topic Translate Drop-down field content
Ok, thanks. But i think i am doing something wrong because it does not work :
1 - I set up my languages in Joomla as usual (language filter module, language plugins, Homes for each language..;)
2 - i create a CB drop down single select field
3 - in "title" i write "CB_OU"
4 - i create language overrides for "CB_OU" in each language
5 - i create several value / label for my dropdown :
0 / MANGE_DE_TOUT
1 / NOURRITURE_SAINE
2 / DIET
6 - For each label i create language overrides in each language

But it does not work... The field title and the dorpdown labels are not translated... Could you help me ?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48708
  • Thanks: 8319
  • Karma: 1447
7 years 6 months ago #295627 by krileon
Replied by krileon on topic Translate Drop-down field content
CB is not translated by Joomla language plugins in any way. Nor do Joomla language overrides work in CB. You need a CB language plugin for the language you're using in Joomla. You can find several, community driven, language plugins below.

www.joomlapolis.com/localization

As for CB language overrides see the below.

www.joomlapolis.com/blog/kyle/18701-language-overrides-have-arrived


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.

7 years 5 months ago #296017 by sylvain.ruda
Replied by sylvain.ruda on topic Translate Drop-down field content
Hi,

Thank you very mutch, I understand now how translation work in CB.
I want now to find the API function to translate overrides Keys (i'm writting a component). I didn't find any documentation about the API, is there any ?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48708
  • Thanks: 8319
  • Karma: 1447
7 years 5 months ago - 7 years 5 months ago #296022 by krileon
Replied by krileon on topic Translate Drop-down field content
Run your string through CBTxt and it will translate. The API can be used as follows.

Key Only:
Code:
$string = CBTxt::T( 'KEY' );

String Only:
Code:
$string = CBTxt::T( 'STRING' );

Key and Sting:
Code:
$string = CBTxt::T( 'KEY', 'STRING' );

With Replacements:
Code:
$string = CBTxt::T( 'KEY', '[variable]', array( '[variable]' => $variable ) );

It's a namespaced PHP class. One CB API has been loaded as per documentation below you should be able to utilize it fine.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18357-including-cb-api-for-usage-outside-of-cb

If unsure what a namespaced PHP class is please research carefully and be used to use an IDE with auto complete to help path to the class.


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.
Last edit: 7 years 5 months ago by krileon.

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

Moderators: beatnantkrileon
Powered by Kunena Forum