Jump to content

Marketplace translation


wp4all

Recommended Posts

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.

 

Link to comment
Share on other sites

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}

 

Link to comment
Share on other sites

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. :D

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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&apos;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&apos;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?

Link to comment
Share on other sites

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}

image.png.9021a2bf7aeb660a1215a5514d8603cc.png

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.

Link to comment
Share on other sites

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 by wp4all
Link to comment
Share on other sites

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...

Link to comment
Share on other sites

Oh, thank you :).

What about this:

image.png.76b5c66bc67a01de1b5455af5870a7b6.png

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: image.png.5262e713d2251ec1cfbf5a25b28fa876.png

I attach hook file (market.php).

market.php.zip

Link to comment
Share on other sites

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!)...

PMW52EA.png

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. :idea:

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.

Link to comment
Share on other sites

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 by Tengri
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated