Guest Posted January 26, 2022 Share Posted January 26, 2022 (edited) Hi We use the following cancellation email template. It works fine in English. When the user terminates a product with immediate effect, if prints "The service will be terminated within the next 24 hours". If a user chooses to terminate at the end of the current billing period, it prints "The service will be cancelled at the end o.....". However, we have translated the email into Danish. No matter what, it always print the {else} clause in emails to our Danish customers. It always ignores the {=="Immediate"} clause when the user's language is set to Danish. This means that no matter what cancellation option the user chooses, the email always reads "Servicen stopper ved slutningen af din betalingsperiode ...". The product is correctly terminated - it is only the email wording that is incorrect. What could be wrong? Input greatly appreciated. EDIT: Ok update. Even if we copy-paste the English email into the Danish template, it still ignores the 'Immediate' and only prints {else} when user language is set to Danish. We cannot figure out why. Edited January 26, 2022 by Guest added more detailed info 0 Quote Link to comment Share on other sites More sharing options...
Guest Posted January 26, 2022 Share Posted January 26, 2022 Ok the solution is that apparently our install of WHMCS requires us to also translate the "Immediate" variable into Danish, German, etc. although this should not be the case. If we write {if $service_cancellation_type == "Øjeblikkeligt"} it works in Danish and {if $service_cancellation_type == "Sofort"} it works in German. I found a similar post on the internet with a Portuguese user with the exact same issue. As far as I understand, it should not be necessary to translate the variable "Immediate". I should always be the same disregarding the language? 0 Quote Link to comment Share on other sites More sharing options...
yggdrasil Posted January 26, 2022 Share Posted January 26, 2022 (edited) 3 hours ago, HenRex said: Ok the solution is that apparently our install of WHMCS requires us to also translate the "Immediate" variable into Danish, German, etc. although this should not be the case. If we write {if $service_cancellation_type == "Øjeblikkeligt"} it works in Danish and {if $service_cancellation_type == "Sofort"} it works in German. I found a similar post on the internet with a Portuguese user with the exact same issue. As far as I understand, it should not be necessary to translate the variable "Immediate". I should always be the same disregarding the language? Inmediate is not a variable here, it's text in the email. The variables that should never be touched are always in {$variable}, you should translate everything else in the email template. I don't think the email template is using the form value "Inmediate" but the actual translated text. Therefore, it works when translated. Make sure that translation in your template matches the same word as in your template for each language. Edited January 26, 2022 by yggdrasil 0 Quote Link to comment Share on other sites More sharing options...
Guest Posted January 26, 2022 Share Posted January 26, 2022 I simply do not believe that is how solid programming should work. {if $service_cancellation_type == "Immediate"} should read the option value, which remains constant with user language changes, and not the §LANG.clientarecancellationimmediate, which is variable depending on the set user language. <option value="Immediate">{$LANG.clientareacancellationimmediate}</option> 0 Quote Link to comment Share on other sites More sharing options...
yggdrasil Posted January 27, 2022 Share Posted January 27, 2022 3 hours ago, HenRex said: I simply do not believe that is how solid programming should work. {if $service_cancellation_type == "Immediate"} should read the option value, which remains constant with user language changes, and not the §LANG.clientarecancellationimmediate, which is variable depending on the set user language. <option value="Immediate">{$LANG.clientareacancellationimmediate}</option> I agree but WHMCS and solid programming is not something that goes into the same sentence. WHMCS has so much legacy code around and the email template system is one of them. If you want to be meticulous, there are even hard coded language phrases in every release that are missing in the language files as well. They don't pay a lot of attention or care to the minute details in my experience. 0 Quote Link to comment Share on other sites More sharing options...
Guest Posted January 27, 2022 Share Posted January 27, 2022 (edited) There must be some better way. I am not an expert in Smarty, so I don't know how to select the option value and not the label in this code: <option value="Immediate">{$LANG.clientareacancellationimmediate}</option> Do you think that this would work as a more general solution? {if $service_cancellation_type == $LANG.clientareacancellationimmediate} Or would something like this be allowed in Smarty? {if $service_cancellation_type['Immediate'] == True} Edited January 27, 2022 by Guest 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted January 27, 2022 Share Posted January 27, 2022 Unfortunately, it is how it's supposed to be done. I don't really think anyone likes it. 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.