Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] Translation of drop down list in user fields

10 years 11 months ago - 10 years 10 months ago #237351 by siwayjoomla
Hi All,
we have a "Title" user field that is a drop down.
We would like to have this drop down translated in every language of the site.

Is this possible ?
How ?

Thank you,
Nicolas
Last edit: 10 years 10 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
10 years 11 months ago #237353 by krileon
Replied by krileon on topic Translation of drop down list in user fields
Yes, use language strings to translate a fields value. See your CB documentation regarding language string and translation usage, which you can download from the Advanced downloads section. Please also see the below language place for additional resources.

www.joomlapolis.com/cb-solutions/languages


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.

10 years 11 months ago #237363 by siwayjoomla
Replied by siwayjoomla on topic Translation of drop down list in user fields
Hi,
Ok that is what we did.
But I had another problem afterwards.

I have an auto-action to send the registration email.
(Because I need HTML emails..).

So I try to get my field Title (cb_titre) in an email auto-action.

Whith tghis HTML :

"Bonjour [cb_titre] [name],"

And here I get (in the sent email) the field value as a language string, and not as the translated value.
And no "PHP way" to force the "translation" of the string.

So this was OK before using language strings, language strings are OK everywhere but there.
So i wanted to knopw if it was at the begining that I did a bad choice. It seems that it is just in the way I deal with my auto-action...

Is my problem clear ?
How do you think I coud deal with this ?

Thank you for your support,
Nicolas

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

10 years 11 months ago #237365 by siwayjoomla
Replied by siwayjoomla on topic Translation of drop down list in user fields
I add some infos because there is a hidden question in my previous question.


What is the good procedure to create an auto action with both field and translations (and also HTML Tags) ?

By example :

How to deal with translations for such an HTML in autoaction (you will recognised some of your code..) :

<a href="[cb:config param="live_site" /]/index.php?option=com_comprofiler&task=confirm&confirmcode=[cbactivation]&Itemid=101" title="Cliquez et découvrez" style="color:#fff; background:#ac84bb; width:643px; height:30px; text-align:center; display:block; text-decoration:none;padding-top:12px; text-transform:uppercase;">Cliquez et découvrez</a>

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
10 years 11 months ago #237397 by krileon
Replied by krileon on topic Translation of drop down list in user fields
Emails will always send in the language of the user triggering the email. It will not send in the language of the user receiving the email. I've no idea what trigger you're acting on so I've no idea who is triggering the email action. If the user is not logged in with the email action is trigger then it'll send as the default site language. Ensure all your language plugins have your strings translated.

How to deal with translations for such an HTML in autoaction (you will recognised some of your code..) :

You'd need to add a translation for that entire string. The below is a good way to do this.

Code:
'_MY_EMAIL_BODY' => 'All my HTML Here, but notice I am new language string usage and NOT a define. Be sure to escape quotes like this \'.'


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.

10 years 10 months ago #238825 by siwayjoomla
Replied by siwayjoomla on topic Translation of drop down list in user fields
Hi Kyle,

I did that but I still hav a problem with lists translations in the auto-action.

I have a Title cb field (cb_titre) that is a translated list
I have (in french) :
_TITLE_MR = 'Mr'
_TITLE_MME='Mme'

When people subscribe, no problem, fields are well translated on the select list.
Then I have an auto-action (email, onAfterUserRegistration) to send the registration email.
Is you said, I used translation to translate those emails.

So I have a part where I would like to add the title.
So I have an HTML part that is :
<p style="color:#ac84bb;">Bonjour [cb_titre] [name],</p>


In the email I reveive, I receive :
<p style="color:#ac84bb;">Bonjour _TITLE_MR de La Fortelle,</p>
<p style="color:#ac84bb;">Bonjour Mr de La Fortelle,</p>

How could I correct that ?
Thank you,
Nicolas

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

Moderators: beatnantkrileon
Powered by Kunena Forum