Skip to Content Skip to Menu

[SOLVED] Language String in CB Fields

  • MAYASIMA
  • MAYASIMA
  • OFFLINE
  • Posts: 183
  • Thanks: 22
  • Karma: 5
9 years 5 months ago - 9 years 5 months ago #264287 by MAYASIMA
[SOLVED] Language String in CB Fields was created by MAYASIMA
Is it possible to use a language string in the description or Value Layouts of a CB field? If yes, how should it be added? If no, can this be a feature request?
Last edit: 9 years 5 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8281
  • Karma: 1443
9 years 5 months ago #264325 by krileon
Replied by krileon on topic Language String in CB Fields
Yes, both description and layout support language strings. It's typically best to use a language key in these scenarios. Example as follows.

Profile Value Layout: MY_FIELD_LAYOUT
Language String:
Code:
'MY_FIELD_LAYOUT' => '[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.

  • MAYASIMA
  • MAYASIMA
  • OFFLINE
  • Posts: 183
  • Thanks: 22
  • Karma: 5
9 years 5 months ago #264345 by MAYASIMA
Replied by MAYASIMA on topic Language String in CB Fields
How would I add it to the description or the value layout? Because when I use for example: MY_FIELD_LAYOUT (as you would enter it inside the field name) it renders exactly as MY_FIELD_LAYOUT instead of the value of the language string.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8281
  • Karma: 1443
9 years 5 months ago #264348 by krileon
Replied by krileon on topic Language String in CB Fields
You need to add the string translation to your CB language plugin. If your site is in English you should install the English language plugin then add your string to it. See the below for language usage resources in addition to the CB 2.0 Primer Book.

www.joomlapolis.com/cb-solutions/languages

You can also try using a CB Language Override plugin, but it can make things a bit wonky due to plugin load order.

www.joomlapolis.com/forum/6-news-and-publicity/227556-cb-language-override-video-tutorial-resources


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.

  • MAYASIMA
  • MAYASIMA
  • OFFLINE
  • Posts: 183
  • Thanks: 22
  • Karma: 5
9 years 5 months ago - 9 years 5 months ago #264354 by MAYASIMA
Replied by MAYASIMA on topic Language String in CB Fields
I am sorry, I think I might not explain it well. For example the first name field. The title is _UE_YOUR_FNAME. It will pickup the value of _UE_YOUR_FNAME in the language file and then outputs it as the title of the first name field. In this case the value is "First Name". Now, I created my own language strings for some custom fields (using language override method). One of them is called cb_gender. The language string for this field is _CB_CUSTOM_GENDER. When I enter _CB_CUSTOM_GENDER as the title of the field, it correctly picks up the value (Gender) from the language file and displays it as the title of cb_gender. Now when I want to use _CB_CUSTOM_GENDER in the description or profile value layout, it does not output the value from the language string and file, but instead just renders the plain text: _CB_CUSTOM_GENDER
I am entering the following in the description box or profile value layout: _CB_CUSTOM_GENDER
I am probably entering it wrong and my question is how to exactly enter it?
Last edit: 9 years 5 months ago by MAYASIMA. Reason: Not finished

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8281
  • Karma: 1443
9 years 5 months ago #264360 by krileon
Replied by krileon on topic Language String in CB Fields
Language strings do not work inline. The parameter must be exactly that language string and nothing else. Trailing space, extra characters, HTML surrounding the string (e.g. common problem for descriptions; use view source to double check) will cause the translation to not work.


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