Remitur Posted July 26, 2019 Share Posted July 26, 2019 The variable $marketingEmailOptInMessage is used in clientregister.tpl (and, I guess, also in some other .tpl), is the one defining the mailing list "policy", and its value is: Quote We would like to send you occasional news, information and special offers by email. To join our mailing list, simply tick the box below. You can unsubscribe at any time. But in the .tpl it's used a simple variable, not a language one: {if $showMarketingEmailOptIn} <div class="marketing-email-optin"> <h4 class="bolder">{lang key='emailMarketing.joinOurMailingList'}</h4> <p>{$marketingEmailOptInMessage}</p> <input type="checkbox" name="marketingoptin" value="1"{if $marketingEmailOptIn} checked{/if} class="no-icheck toggle-switch-success" data-size="small" data-on-text="{lang key='yes'}" data-off-text="{lang key='no'}"> </div> {/if} And it may be changed (but only for main language!!!) in General Settings => Other So it's impossible to translate it in different languages... Question: Does exist any real reason for this? If I change the .tpl files using a custom language variable I guess that everything will work fine, but before doing it it's better to ask ... 😉 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 26, 2019 Share Posted July 26, 2019 (edited) 6 hours ago, Remitur said: The variable $marketingEmailOptInMessage is used in clientregister.tpl (and, I guess, also in some other .tpl) in terms of Six & SC, I think it's three templates - checkout, clientareadetails and clientregister. 6 hours ago, Remitur said: So it's impossible to translate it in different languages... impossible, sir ? impossible ?? 😉 6 hours ago, Remitur said: Question: Does exist any real reason for this? their logic must be so that it's simpler for a user to change the string from the admin area as opposed to using Language Overrides (as they do everywhere else) - it's a little inconsistent as the more logical way in my eyes would have been to just make it a language string and tell user to use overrides to change it... but multilingual is seemingly not the first thought of those writing WHMCS. 🙄 6 hours ago, Remitur said: If I change the .tpl files using a custom language variable I guess that everything will work fine, but before doing it it's better to ask ... 😉 I can't see why not, but wouldn't it be easier to use an action hook... 🙂 <?php # Translate Email Marketing Opt-In String Hook # Written by brian! function translate_marketing_optin_string_hook($vars) { $marketing_message = $vars['marketingEmailOptInMessage']; if (!in_array(Lang::trans('marketingEmailOptInMessage'),array($marketing_message,'marketingEmailOptInMessage'))) { $marketing_string = Lang::trans('marketingEmailOptInMessage'); return array("marketingEmailOptInMessage" => $marketing_string); } } add_hook("ClientAreaPageCart", 1, "translate_marketing_optin_string_hook"); add_hook("ClientAreaPageProfile", 1, "translate_marketing_optin_string_hook"); add_hook("ClientAreaPageRegister", 1, "translate_marketing_optin_string_hook"); and you'll also need to define the override string for each language that you want to modify... $_LANG['marketingEmailOptInMessage'] = "to be or not to be, that is the question."; so, if I modified the English language overrides file with the above string, English users would then see... if I did the same in the Italian overrides file (translation from Google - don't blame me!)... $_LANG['marketingEmailOptInMessage'] = "Vorremmo inviarti notizie, informazioni e offerte speciali occasionali via e-mail. Per iscriverti alla nostra mailing list, seleziona la casella qui sotto È possibile disdire in qualsiasi momento."; ... Italian users would see... if the user chooses an unmodified language, e.g one that you haven't translated this marketing string to their language, they will be shown the default string from general settings. 🙂 I did give the v7.8 beta a quick look, and I think this feature still works the same as with v7.7 - in that the string is modifiable only via general settings. Edited July 26, 2019 by brian! 1 Quote Link to comment Share on other sites More sharing options...
Remitur Posted July 26, 2019 Author Share Posted July 26, 2019 @brian!, you're a code artist. And this is not up for debate... 😮 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.