wp4all Posted June 4, 2018 Author Share Posted June 4, 2018 This means that the $_Lang string in your lang.php is missing usually if there is nothing in the lang.php it should show the original String so something is wrong in your code. Greetings Christian 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted June 4, 2018 Share Posted June 4, 2018 Oh, turns out we use the hook right there. Damn.. I didn't understand. Now everything is clear. I am very confused with these codes. For example, I suspect that this hook. I wanted to change this.: https://prnt.sc/jqnngj The result of course is deplorable. Complicated. I "fondly" remember one who used this all here. 0 Quote Link to comment Share on other sites More sharing options...
wp4all Posted June 4, 2018 Author Share Posted June 4, 2018 Hi Tengri, no the hook is a different story . It's a blessing that Brian is doing so a great job, I wanted to give up a few times with the override functions and the whole translation . Greetings Christian 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted June 4, 2018 Share Posted June 4, 2018 Yes, I see. Now everything turns out. What concerns @brian! it Yes. Sometimes I think he does more than the WHMCS employees themselves.Thank you both for your patience with me. That was tough. And lastly, help me with this: https://prnt.sc/jqnngj and this: https://prnt.sc/jqnuxd 0 Quote Link to comment Share on other sites More sharing options...
wp4all Posted June 4, 2018 Author Share Posted June 4, 2018 Hi Tengri, quick and dirty you will find all this on page one : Also the currency hack by switching the language you will find on page one. Greetings Christian 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted June 4, 2018 Share Posted June 4, 2018 You forget I'm not a programmer. I roughly all understand and try to change for example here is this: {if $pricing->isYearly()} {$pricing->cycleInYears()} - {$pricing->yearlyPrice()} {else} {$pricing->cycleInMonths()} - {$pricing->monthlyPrice()} {/if} to {$product->pricing()->best()->breakdownPrice()|replace:'/mo':{lang key="store.upsell.monthly"}|replace:'/yr':{lang key="store.upsell.yearly"}}{/if} And the page just doesn't appear. If not I will not say that on what to change that it's hard for me to change it myself. Or this. I try change this: {if is_null($upsellComparison->diff({$pricing->cycle()}))} {$promotion->getCta()} {$upsellProduct->name} from just {$upsellProduct->pricing()->best()->breakdownPrice()} {else} {$promotion->getCta()} {$upsellProduct->name} for just {$upsellComparison->diff({$pricing->cycle()})->breakdownPrice()} more {/if} to if $LANG.store.cart.promo.{$highlight|replace:' ':''|replace:',':''|replace:'.':''|strtolower}}{$LANG.store.cart.promo.{$highlight|replace:' ':''|replace:',':''|replace:'.':''|strtolower}}{else}$highlight{/if} And nope. 0 Quote Link to comment Share on other sites More sharing options...
wp4all Posted June 4, 2018 Author Share Posted June 4, 2018 (edited) Hi Tengri, which Template are you trying to translate ? This one --> order.tpl ? Greetings Christian Edited June 4, 2018 by wp4all 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted June 4, 2018 Share Posted June 4, 2018 (edited) Yes. order.tpl Edited June 4, 2018 by Tengri 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 4, 2018 Share Posted June 4, 2018 35 minutes ago, Tengri said: Oh, turns out we use the hook right there. Damn.. I didn't understand. Now everything is clear. I am very confused with these codes. Christian gave a pretty good explanation of using Language Overrides - that's pretty much what these template changes are... the Smarty code that I used is quite advanced because we're using "variable variables" to get around the bizarre way that WHMCS have done this. generally speaking the store pages are all templates, so you can use the language override method, anything in the cart could be either template or hook. there will be another way to do the Cart panels, which should be a ClientAreaPageCart hook and that should work brilliantly - it's how WHMCS should have done it by calling language overrides insteading of hardcoding the content in an encrypted file... it got me wondering whether the contracts between WHMCS and these suppliers (Weebly, SpamExperts etc), have a condition to the store pages only being in English (so they can guarantee the content)... because if that were the case, then how WHMCS have designed them would make some sense... though if there is no such clause, then their method is totally insane - and the worst of all worlds. 12 minutes ago, Tengri said: You forget I'm not a programmer. I roughly all understand and try to change for example here is this: {if $pricing->isYearly()} {$pricing->cycleInYears()} - {$pricing->yearlyPrice()} {else} {$pricing->cycleInMonths()} - {$pricing->monthlyPrice()} {/if} And the page just doesn't appear. If not I will not say that on what to change that it's hard for me to change it myself. the trick is knowing what you're replacing... so if this is from order.tpl, I think it should be... {if $pricing->isYearly()} {$pricing->cycleInYears()} - {$pricing->yearlyPrice()|replace:'/yr':{lang key="store.upsell.yearly"}} {else} {$pricing->cycleInMonths()} - {$pricing->monthlyPrice()|replace:'/mo':{lang key="store.upsell.monthly"}} {/if} 1 Quote Link to comment Share on other sites More sharing options...
wp4all Posted June 4, 2018 Author Share Posted June 4, 2018 Brian was faster 1 Quote Link to comment Share on other sites More sharing options...
Tengri Posted June 4, 2018 Share Posted June 4, 2018 35 minutes ago, brian! said: Christian gave a pretty good explanation of using Language Overrides - that's pretty much what these template changes are... the Smarty code that I used is quite advanced because we're using "variable variables" to get around the bizarre way that WHMCS have done this. generally speaking the store pages are all templates, so you can use the language override method, anything in the cart could be either template or hook. there will be another way to do the Cart panels, which should be a ClientAreaPageCart hook and that should work brilliantly - it's how WHMCS should have done it by calling language overrides insteading of hardcoding the content in an encrypted file... it got me wondering whether the contracts between WHMCS and these suppliers (Weebly, SpamExperts etc), have a condition to the store pages only being in English (so they can guarantee the content)... because if that were the case, then how WHMCS have designed them would make some sense... though if there is no such clause, then their method is totally insane - and the worst of all worlds. the trick is knowing what you're replacing... so if this is from order.tpl, I think it should be... {if $pricing->isYearly()} {$pricing->cycleInYears()} - {$pricing->yearlyPrice()|replace:'/yr':{lang key="store.upsell.yearly"}} {else} {$pricing->cycleInMonths()} - {$pricing->monthlyPrice()|replace:'/mo':{lang key="store.upsell.monthly"}} {/if} Yes you are right. The fact that whmcs went for it is simply unthinkable. For example using what you sent me I tried to do the Upgrade: https://prnt.sc/jqp25z And add this code: {$promotion->getCta()|replace:'Upgrade':{lang key="store.upsell.upgrade"}} - this is test. But no change You're crazy. I know you now collectively hate me as I in turn WHMCS. 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted June 4, 2018 Share Posted June 4, 2018 Oh... I found another problem. I'm tired.. https://prnt.sc/jqr9i8 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 4, 2018 Share Posted June 4, 2018 it looks the hook would be the solution for that... 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted June 5, 2018 Share Posted June 5, 2018 Ok, I add hooks look: <?php # MarketConnect Upsell (Slightly) Multilingual Hook # Written by brian! add_hook('ClientAreaFooterOutput', 1, function() { $spamheadline1 = Lang::trans('store.upsell.headline.upgrade'); $spamheadline2 = Lang::trans('store.upsell.headline.protectyoursitewithssl'); return <<<EOF <script> var hashtable = {}; hashtable['Upgrade'] = '$spamheadline1'; hashtable['Protect your site with SSL'] = '$spamheadline2'; $(document).ready(function() { $('.promo-banner').each(function( index ) { var banner = $(this); $.each(hashtable, function( index, value ) { banner.html(banner.html().replace(index, value)); }); }); }); </script> EOF; }); And variable to lang $_LANG['store']['upsell']['headline']['upgrade'] = "Yenilə"; $_LANG['store']['upsell']['headline']['protectyoursitewithssl'] = "SSL ilə saytınızı mühafizə edin"; And wuala: https://prnt.sc/jr061k Or another one: https://prnt.sc/jr06kr 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted June 5, 2018 Share Posted June 5, 2018 And then I changed it -> https://prnt.sc/jr1au8 . He worked well. But it does not work anymore. I have read this article: Besides, I did not know how I changed. It was accidentally taken as a result of tests. Can you say me in which side I must change code I suppose I did it with the replacement. Now I do not know how to do it. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 5, 2018 Share Posted June 5, 2018 2 hours ago, Tengri said: And then I changed it -> https://prnt.sc/jr1au8 . He worked well. But it does not work anymore. that "Protect your website and boost your search rankings with an SSL certificate" line was in your hook on page #2 of this thread... so you must have removed it... you really only need one big hook file for this, so don't try to use multiple small hooks to do the same job - you'll run into all sorts of issues. 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted June 5, 2018 Share Posted June 5, 2018 42 minutes ago, brian! said: that "Protect your website and boost your search rankings with an SSL certificate" line was in your hook on page #2 of this thread... so you must have removed it... you really only need one big hook file for this, so don't try to use multiple small hooks to do the same job - you'll run into all sorts of issues. This is my hook: <?php # MarketConnect Upsell (Slightly) Multilingual Hook # Written by brian! add_hook('ClientAreaFooterOutput', 1, function() { $spamheadline1 = Lang::trans('store.upsell.headline.addsecuritytoyouremailandsaygoodbyetospam'); $spamtagline1 = Lang::trans('store.upsell.tagline.withnear100%filteringaccuracyandincreasedemailcontinuity'); $spamfeature1 = Lang::trans('store.upsell.feature.near100%filteringaccuracy'); $spamfeature2 = Lang::trans('store.upsell.feature.easysetupandconfiguration'); $spamfeature3 = Lang::trans('store.upsell.feature.increasedemailcontinuityredundancy'); $spamfeature4 = Lang::trans('store.upsell.feature.supportsupto1000emailboxes'); $spamfeature5 = Lang::trans('store.upsell.feature.learnmore'); $spamfeature6 = Lang::trans('store.upsell.feature.add'); $spamfeature7 = Lang::trans('store.upsell.feature.fromjust'); $spamfeature8 = Lang::trans('store.upsell.feature.mo'); $spamfeature9 = Lang::trans('store.upsell.feature.yr'); $spamfeature10 = Lang::trans('store.upsell.feature.automaticallyscanyourwebsiteformalwareandprotectonlinereputation'); $spamfeature11 = Lang::trans('store.upsell.feature.trythesitelockserviceforfree'); $spamfeature12 = Lang::trans('store.upsell.feature.dailymalwarescanning'); $spamfeature13 = Lang::trans('store.upsell.feature.dailyblacklistmonitoring'); $spamfeature14 = Lang::trans('store.upsell.feature.siteLockriskscore'); $spamfeature15 = Lang::trans('store.upsell.feature.sitelocktrustseal'); $spamfeature16 = Lang::trans('store.upsell.feature.protectyourwebsiteandboostyoursearchrankingswithansslcertificate'); $spamfeature17 = Lang::trans('store.upsell.feature.includedwithyoursslcertificate'); $spamfeature18 = Lang::trans('store.upsell.feature.dataprotectionupto256-bitencryption'); $spamfeature19 = Lang::trans('store.upsell.feature.unlimitedfreereissues'); $spamfeature20 = Lang::trans('store.upsell.feature.compatiblewithallmajorbrowsers'); $spamfeature21 = Lang::trans('store.upsell.feature.displayasecuritysealonyoursite'); $spamfeature22 = Lang::trans('store.upsell.feature.buildyourwebsitewitheaseusingthepowerfulweeblysitebuilder'); $spamfeature23 = Lang::trans('store.upsell.feature.weebly'spowerfuldraganddropwebsitebuilderandguidedsetupgetyoutothefinishlinefasternocodingneeded');<-- Error $spamfeature24 = Lang::trans('store.upsell.feature.rangeofstunningthemestochoosefrom'); $spamfeature25 = Lang::trans('store.upsell.feature.draganddropeditor'); return <<<EOF <script> var hashtable = {}; hashtable['Add Security to your Email and say goodbye to spam'] = '$spamheadline1'; hashtable['With near 100% filtering accuracy and increased email continuity'] = '$spamtagline1'; hashtable['Near 100% filtering accuracy'] = '$spamfeature1'; hashtable['Easy setup and configuration'] = '$spamfeature2'; hashtable['Increased email continuity & redundancy'] = '$spamfeature3'; hashtable['Supports up to 1000 email boxes'] = '$spamfeature4'; hashtable['Learn more...'] = '$spamfeature5'; hashtable['Add'] = '$spamfeature6'; hashtable['from just'] = '$spamfeature7'; hashtable['/mo'] = '$spamfeature8'; hashtable['/yr'] = '$spamfeature9'; hashtable['Automatically scan your website for malware and protect online reputation'] = '$spamfeature10'; hashtable['Try the SiteLock service for free'] = '$spamfeature11'; hashtable['Daily Malware Scanning'] = '$spamfeature12'; hashtable['Daily Blacklist Monitoring'] = '$spamfeature13'; hashtable['SiteLock Risk Score'] = '$spamfeature14'; hashtable['Sitelock Trust Seal'] = '$spamfeature15'; hashtable['Protect your website and boost your search rankings with an SSL certificate'] = '$spamfeature16'; hashtable['Included with your SSL certificate'] = '$spamfeature17'; hashtable['Data protection up to 256-bit encryption'] = '$spamfeature18'; hashtable['Unlimited free reissues'] = '$spamfeature19'; hashtable['Compatible with all major browsers'] = '$spamfeature20'; hashtable['Display a security seal on your site'] = '$spamfeature21'; hashtable['Build your website with ease using the Powerful Weebly Site Builder'] = '$spamfeature22'; hashtable['Weebly's powerful drag and drop website builder and guided set up get you to the finish line faster, no coding needed.'] = '$spamfeature23'; <--Error hashtable['Range of stunning themes to choose from'] = '$spamfeature24'; hashtable['Drag and drop editor'] = '$spamfeature25'; $(document).ready(function() { $('.promo-banner').each(function( index ) { var banner = $(this); $.each(hashtable, function( index, value ) { banner.html(banner.html().replace(index, value)); }); }); }); </script> EOF; }); This is lang vairables: $_LANG['store']['upsell']['feature']['protectyourwebsiteandboostyoursearchrankingswithansslcertificate'] = "Yaşıl ünvan sətri"; Result: https://prnt.sc/jr49yl Where is my mistake? 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted June 5, 2018 Share Posted June 5, 2018 I found it. Solved. Thanks! 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted June 5, 2018 Share Posted June 5, 2018 Tell me how to change this code so that I can add variables here. I've tried everything. It's hard. -> https://prnt.sc/jr5sg8 Code is: {if is_null($upsellComparison->diff({$pricing->cycle()}))} {$promotion->getCta()} {$upsellProduct->name} from just {$upsellProduct->pricing()->best()->breakdownPrice()} {else} {$promotion->getCta()} {$upsellProduct->name} for just {$upsellComparison->diff({$pricing->cycle()})->breakdownPrice()} more {/if} And about protect. I add this in hooks: $spamfeature35 = Lang::trans('store.upsell.tagline.protect'); hashtable['Protect your site with SSL'] = '$spamfeature35'; And language variables too. But nothing. 0 Quote Link to comment Share on other sites More sharing options...
wp4all Posted June 5, 2018 Author Share Posted June 5, 2018 (edited) Hi Tengri, it is every time the same way how to translate: {if is_null($upsellComparison->diff({$pricing->cycle()}))} {if $LANG.store.cart.promo.{$promotion->getCta()|replace:' ':''|replace:',':''|replace:'.':''|strtolower}}{$LANG.store.cart.promo.{$promotion->getCta()|replace:' ':''|replace:',':''|replace:'.':''|strtolower}}{else}$promotion->getCta(){/if} {$upsellProduct->name} {lang key="store.cart.fromjust"} {$upsellProduct->pricing()->best()->breakdownPrice()} {else} {if $LANG.store.cart.promo.{$promotion->getCta()|replace:' ':''|replace:',':''|replace:'.':''|strtolower}}{$LANG.store.cart.promo.{$promotion->getCta()|replace:' ':''|replace:',':''|replace:'.':''|strtolower}}{else}$promotion->getCta(){/if} {$upsellProduct->name} {lang key="store.cart.forjust"} {$upsellComparison->diff({$pricing->cycle()})->breakdownPrice()} {lang key="store.cart.more"} {/if} and the $_Lang $_LANG['store']['cart']['fromjust'] = "from just"; $_LANG['store']['cart']['forjust'] = "for just"; Sorry this is not a puzzle that you look and then put together you should understand what all this Lines of code will do. Greetings Christian Edited June 5, 2018 by wp4all 1 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 5, 2018 Share Posted June 5, 2018 39 minutes ago, Tengri said: Tell me how to change this code so that I can add variables here. I've tried everything. It's hard. ok, this is an easy one... first part might need more work but the rest is simple... {if is_null($upsellComparison->diff({$pricing->cycle()}))} {$promotion->getCta()|replace:'Upgrade to':{$LANG.upgradeto}} {$upsellProduct->name} {$LANG.fromjust} {$upsellProduct->pricing()->best()->breakdownPrice()|replace:'/yr':{lang key="store.upsell.yearly"}} {else} {$promotion->getCta()|replace:'Upgrade to':{$LANG.upgradeto}} {$upsellProduct->name} {$LANG.forjust} {$upsellComparison->diff({$pricing->cycle()})->breakdownPrice()|replace:'/yr':{lang key="store.upsell.yearly"}} {$LANG.more} {/if} then you'll just to need to create language overrides for upgradeto, fromjust and forjust - a translation for "more" already exists in the Azerbaijani language file... $_LANG['upgradeto'] = "Yükseltin"; $_LANG['fromjust'] = "ədalətdən"; $_LANG['forjust'] = "yalnız üçün"; translations may be wrong, but hopefully you get the idea... 1 Quote Link to comment Share on other sites More sharing options...
Tengri Posted June 5, 2018 Share Posted June 5, 2018 Oh, thank you :). What about this: I add hooks: $spamfeature35 = Lang::trans('store.upsell.headline.protectyoursitewithssl'); $spamfeature36 = Lang::trans('store.upsell.tagline.addssltoyourwebhostingtogivevisitorsconfidencethatyourwebsiteissafeandsecureandhelpbuildtrust'); and hashtable['Protect your site with SSL'] = '$spamfeature35'; hashtable['Add SSL to your web hosting to give visitors confidence that your website is safe and secure and help build trust'] = '$spamfeature36'; Then add vairables: $_LANG['store']['upsell']['headline']['protectyoursitewithssl'] = "aaa"; $_LANG['store']['upsell']['tagline']['addssltoyourwebhostingtogivevisitorsconfidencethatyourwebsiteissafeandsecureandhelpbuildtrust'] = "Azero"; Result: I attach hook file (market.php). market.php.zip 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted June 5, 2018 Share Posted June 5, 2018 @brian! You are amazing! I found this articike: Thanks a lot. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 5, 2018 Share Posted June 5, 2018 21 minutes ago, Tengri said: I found this article: I was going to tell you about that, but it's a year old (who thought we'd still be here with this situation a year later?) and just uses another template edit to get around the issue. remember I said that there was a way to do it properly using a hook, well i'm now in the process of writing that hook and it works perfectly (so far!)... every translation you see there is done by my new hook - no template edits, no silly hashtable hook nonsense (the way WHMCS suggest to do it) - also, you can specify what languages it works for (e.g Azerbaijani) and that way you don't need to translate for every language in WHMCS... so if they are using Azerbaijani, they'll see the translations... any other language, they won't be translated and will show the original English text. i'll try and work on this tomorrow, but I won't be around here on Thursday - so you might not get an update on this until Friday at the earliest. 0 Quote Link to comment Share on other sites More sharing options...
Tengri Posted June 5, 2018 Share Posted June 5, 2018 (edited) Why didn't WHMCS contact you? Why do they implement such nonsense? I think you do a lot more for the end user than they do. This is generally some kind of alternative reality. It's like you know their product better than they do. You're cool. Thank you for your patience. Edited June 5, 2018 by Tengri 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.