Jump to content
wp4all

Marketplace translation

Recommended Posts

this is what I see in the v7.6.1 dev for English...

eORGzeb.png

and in German...

xyYnqBD.png

after a quick investigation, I now know that it's pulling that description from the Product Description...

ArLEndH.png

which in practical terms means it's being pulled from the database... it also works for descriptions using Dynamic Field Translations too.

LRen9UB.png

so I can only assume that for the Weebly Lite product you have "Description goes here..." in your product description?

Share this post


Link to post
Share on other sites
1 hour ago, Tengri said:

Where can I translate this section? (SiteLock)

you can't - "Manage Your Security" and "Choose Domain" are seemingly hardcoded in English! 🙄

for something like this, the better solution is probably just to treat them as homepagepanels and adjust them accordingly...

<?php

# SiteLock HomePagePanel Translate Hook
# Written by brian!

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaHomepagePanels', 1, function(MenuItem $homePagePanels)
{
	$sitelocklabel = Lang::trans('sitelocklabel');
	$sitelocklogin = $homePagePanels->getChild('SitelockLogin');
	if((Lang::trans($sitelocklabel) != 'sitelocklabel') && !is_null($sitelocklogin)){
		$sitelocklogin->setLabel(Lang::trans('sitelocklabel'));
		$sitelockbody = $sitelocklogin->getBodyHtml();
		$newbody = str_replace('Choose Domain', Lang::trans('cartproductdomainchoose'), $sitelockbody);
		$sitelocklogin->setBodyHtml($newbody);
	}
});
$_LANG['sitelocklabel'] = "Verwalten Sie Ihre Sicherheit";

C3LEfsC.png

I haven't done it in the above hook, but you could do the same for the Weebly panel too... also, I haven't translated/removed the "Powered by" line, but again you could easily do either by modifying the hook.

33 minutes ago, Tengri said:

And how can I edit "Learn more" link in client are: https://prnt.sc/kxpnmw

I think that's already been solved by other solutions in this thread - e.g hooks... even the silly hashtable nonsense.

  • Like 1

Share this post


Link to post
Share on other sites

You know I don't understand hooks at all. Moreover, I do not understand it as such. But I really need to change the link in the promo in the client panel. Because for SiteLock we use another page. And on the panel this link go to to /store/sitelock.php. I need change this link to "sitelock.php" only. Without store. Could you add the right lines for me on hooks? I would be very grateful.

Share this post


Link to post
Share on other sites
12 minutes ago, Tengri said:

You know I don't understand hooks at all.

they're not that bad - you just have to work out what type to use and where... the biggest handicap is that a lot of new features are totally undocumented - so next time WHMCS repeat the myth that there is terrific documentation provided, you have my permission to roll your eyes. fu-rolleyes.gif

17 minutes ago, Tengri said:

But I really need to change the link in the promo in the client panel. Because for SiteLock we use another page. And on the panel this link go to to /store/sitelock.php. I need change this link to "sitelock.php" only. Without store. Could you add the right lines for me on hooks?

this is one of those situations where it might be more hassle to use a hook than it would to edit a template... so in /templates/six (or custom)/store/promos/upsell.tpl you could change...

<small><a href="{routePath($promotion->getLearnMoreRoute())}">Learn more...</a></small>

to...

<small><a href="{if $promotion->getLearnMoreRoute()|strstr:'sitelock'}sitelock.php{else}{routePath($promotion->getLearnMoreRoute())}{/if}">{lang key="learnmore"}...</a></small>

which changes the link for the SiteLock promo, leaves the other links alone and uses the inbuilt translation string for Learn More... thanks.png

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
12 hours ago, brian! said:

they're not that bad - you just have to work out what type to use and where... the biggest handicap is that a lot of new features are totally undocumented - so next time WHMCS repeat the myth that there is terrific documentation provided, you have my permission to roll your eyes. fu-rolleyes.gif

Not only the documentation also the myth that it is now possible to translate easily the shop 

Quote

Hi all,

I thought it would be helpful to highlight the documentation which covers translation of MarketConnect upsells text in WHMCS v7.6:

https://marketplace.whmcs.com/help/connect/kb/overview/general/customisation_and_localisation_of_promotions

We hope this makes the process easier and helps increase conversions!

 

I'm already sick of so many rolling eyes 🤢

Share this post


Link to post
Share on other sites
15 hours ago, brian! said:

this is one of those situations where it might be more hassle to use a hook than it would to edit a template... so in /templates/six (or custom)/store/promos/upsell.tpl you could change...


<small><a href="{routePath($promotion->getLearnMoreRoute())}">Learn more...</a></small>

to...


<small><a href="{if $promotion->getLearnMoreRoute()|strstr:'sitelock'}sitelock.php{else}{routePath($promotion->getLearnMoreRoute())}{/if}">{lang key="learnmore"}...</a></small>

which changes the link for the SiteLock promo, leaves the other links alone and uses the inbuilt translation string for Learn More... thanks.png

I change it. But unfortunately it did not work. SiteLock link has not changed.

Share this post


Link to post
Share on other sites
Just now, Tengri said:

I change it. But unfortunately it did not work. SiteLock link has not changed.

and it's not cached in the browser? it worked yesterday when I tested it... we're talking about the animated slider, not the homepage panel correct ?

Share this post


Link to post
Share on other sites
Just now, brian! said:

and it's not cached in the browser? it worked yesterday when I tested it... we're talking about the animated slider, not the homepage panel correct ? 

Yes. Only in animated panel and only for SiteLock. I continue tests.

Share this post


Link to post
Share on other sites
It's kind of because of the code. I checked already on two machines. When I add the code the banner disappears. When I return the code, the banner reappears.

Share this post


Link to post
Share on other sites

Hi Tengri,

try this open upsell.tpl.

go to Line 11 and start replacing with this :

            <h3>
                {$promotion->getHeadline()}
                {if $promotion->getLearnMoreRoute()}
                    <small><a href="{if $promotion->getLearnMoreRoute()|strstr:'sitelock'}sitelock.php{else}{routePath($promotion->getLearnMoreRoute())}{/if}">{lang key="learnmore"}...</a></small>
                {/if}
            </h3>

Don't forget to create the Lang string in /whmcs/lang/overrides/your_language.php if not already there :

$_LANG['learnmore'] = "Mehr erfahren ...";

image.thumb.png.5edf2a4f0178d7e675643dcf7ea3f8a6.png

This is usually what Brian tried to describe.

It works for me fine :

image.thumb.png.3b829e809d29e9add27662a338af9c82.png

 

Greetings Christian

Edited by wp4all
  • Party/Celebrate 1

Share this post


Link to post
Share on other sites
4 minutes ago, wp4all said:

Hi Tengri,

try this open upsell.tpl.

go to Line 11 and start replacing with this :


            <h3>
                {$promotion->getHeadline()}
                {if $promotion->getLearnMoreRoute()}
                    <small><a href="{if $promotion->getLearnMoreRoute()|strstr:'sitelock'}sitelock.php{else}{routePath($promotion->getLearnMoreRoute())}{/if}">{lang key="learnmore"}...</a></small>
                {/if}
            </h3>

Don't forget to create the Lang string in /whmcs/lang/overrides/your_language.php if not already there :


$_LANG['learnmore'] = "Erfahren Sie mehr ...";

image.thumb.png.5edf2a4f0178d7e675643dcf7ea3f8a6.png

This is usually what Brian tried to describe.

 

Greetings Christian

This is very interesting. I do it. And variables added too of course. But I get this: https://prnt.sc/kxz1tm

Share this post


Link to post
Share on other sites

Yes. Got it. I don't know why but when I adding variables with "learnmore" I get PHP error in WHMCS. (I use only variables "learnmore" like this: [store][learnmore]='Daha ətraflı'). I change "learnmore" to variables to another and it's work. Best thanks!

Thank you for taking the time for me.

Share this post


Link to post
Share on other sites

One interesting moment. @brian!

Some month ago you help me to translate "year" and "years" in order.tpl of store. I change codes to this:

if $pricing->isRecurring()}
                                        {if $pricing->isYearly()}
                                            {$pricing->cycleInYears()|replace:'Year':{lang key="store.upsell.years"}} - {$pricing->yearlyPrice()|replace:'/yr':{lang key="store.upsell.yearly"}}
                                        {else}
                                            {$pricing->cycleInMonths()|replace:'Years':{lang key="store.upsell.monthly"}} - {$pricing->monthlyPrice()|replace:'/mo':{lang key="store.upsell.monthly"}}
                                        {/if}

In Azerbaijani "year" and "years" is "İl" and "İllər". When you add number of year, use only "İl". Example: 1 il, 2 il. 3 il and etc. After adding this code I get end of "İl" - > "İls".This is wrong. https://prnt.sc/kxzlz9

And how translate "Month"? https://prnt.sc/kxzpk4

Share this post


Link to post
Share on other sites

Hi Tengri,

could you post your $Lang_ string ?

$_LANG['store']['upsell']['years'] 

and

$_LANG['store']['upsell']['yearly'] 

Greetings Christian

Edited by wp4all

Share this post


Link to post
Share on other sites
15 minutes ago, Tengri said:

In Azerbaijani "year" and "years" is "İl" and "İllər". When you add number of year, use only "İl". Example: 1 il, 2 il. 3 il and etc. After adding this code I get end of "İl" - > "İls".This is wrong.

then you could do 2 replaces - one for years, and another for year.

{if $pricing->isYearly()}
	{$pricing->cycleInYears()|replace:'Years':{lang key="store.upsell.years"}|replace:'Year':{lang key="store.upsell.years"}} - {$pricing->yearlyPrice()|replace:'/yr':{lang key="store.upsell.yearly"}}
{else}
	{$pricing->cycleInMonths()|replace:'Month':{lang key="store.upsell.month"}} - {$pricing->monthlyPrice()|replace:'/mo':{lang key="store.upsell.monthly"}}
{/if}

and then you just need to create a language override for store.upsell.month containing the Azeribijani for "Month"... I don't think it uses 'Months', but if it does, then you can do the same as the year/s code and check for months first, and then month.

Share this post


Link to post
Share on other sites
49 minutes ago, brian! said:

then you could do 2 replaces - one for years, and another for year.


{if $pricing->isYearly()}
	{$pricing->cycleInYears()|replace:'Years':{lang key="store.upsell.years"}|replace:'Year':{lang key="store.upsell.years"}} - {$pricing->yearlyPrice()|replace:'/yr':{lang key="store.upsell.yearly"}}
{else}
	{$pricing->cycleInMonths()|replace:'Month':{lang key="store.upsell.month"}} - {$pricing->monthlyPrice()|replace:'/mo':{lang key="store.upsell.monthly"}}
{/if}

and then you just need to create a language override for store.upsell.month containing the Azeribijani for "Month"... I don't think it uses 'Months', but if it does, then you can do the same as the year/s code and check for months first, and then month. 

I change it and add

$_LANG['store']['upsell']['years'] = "İl"
$_LANG['store']['upsell']['yearly'] = "İl"
$_LANG['store']['upsell']['yearly'] = "Ay"

string and get this: https://prnt.sc/ky0o3h

I have onlu problem with "s" in ends of "İl". "Month" need translate too of course.

Share this post


Link to post
Share on other sites
26 minutes ago, Tengri said:

$_LANG['store']['upsell']['yearly'] = "İl"
$_LANG['store']['upsell']['yearly'] = "Ay"

you can't have two strings the same - how will WHMCS know which to use.

26 minutes ago, Tengri said:

I have onlu problem with "s" in ends of "İl". "Month" need translate too of course.

my code should fix the years issue - it would use 'il' for all years... hang on... are you using languages others than Azerbaijani? if so, I may need to think again as this might impact on other languages...

"Month" should just need a language string...

$_LANG['store']['upsell']['month'] = "Ay";

I should add that if you get an error page like that, you'll need to enable display errors from the general settings -> other tab and that will tell you where the error is.

Share this post


Link to post
Share on other sites
6 minutes ago, brian! said:

you can't have two strings the same - how will WHMCS know which to use.

my code should fox the years issue - it would use 'il' for all years...

"Month" should just need a language string...


$_LANG['store']['upsell']['month'] = "Ay"

 

When I add this I get error: "Oops"

$_LANG['store']['upsell']['month'] = "Ay"

Share this post


Link to post
Share on other sites

you've missed out the semi-colon at the end of the lines...

$_LANG['store']['upsell']['month'] = "Ay";

 

  • Like 1

Share this post


Link to post
Share on other sites

This code is correct?

<div class="payment-term">
                        <h4>Müddəti seçin</h4>
                        <select name="billingcycle" class="form-control">
                            {foreach $product->pricing()->allAvailableCycles() as $pricing}
                                <option value="{$pricing->cycle()}"{if $requestedCycle == $pricing->cycle()} selected{/if}>
                                    {if $pricing->isRecurring()}
                                        {if $pricing->isYearly()}
    {$pricing->cycleInYears()|replace:'Years':{lang key="store.upsell.years"}|replace:'Year':{lang key="store.upsell.years"}} - {$pricing->yearlyPrice()|replace:'/yr':{lang key="store.upsell.yearly"}}
{else}
    {$pricing->cycleInMonths()|replace:'Month':{lang key="store.upsell.month"}} - {$pricing->monthlyPrice()|replace:'/mo':{lang key="store.upsell.monthly"}}
{/if}
                                    {else}
                                        {$pricing->toFullString()}
                                    {/if}
                                </option>
                            {/foreach}
                        </select>
                    </div>

I add this and nothing changed.

Share this post


Link to post
Share on other sites

just a quick update on the Sitelock hompagepanel hook that I posted at the weekend, Christian asked for it to include the other MarketConnect panels, so I wrote the following hook.

<?php

# MarketConnect HomePagePanels Translate Hook
# Written by brian!

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaHomepagePanels', 1, function(MenuItem $homePagePanels)
{
	$mcpanels = array('SitelockLogin','SpamexpertsLogin','WeeblyLogin'); 
	foreach ($mcpanels as $panel) {
		$label = strtolower(str_replace('Login','',$panel).'label');
		$loginpanel = $homePagePanels->getChild($panel);
		if((Lang::trans($label) != $label) && !is_null($loginpanel)){
			$loginpanel->setLabel(Lang::trans($label));
			$oldbody = $loginpanel->getBodyHtml();
			$newbody = str_replace('Choose Domain',Lang::trans('cartproductdomainchoose'),$oldbody);
			$loginpanel->setBodyHtml($newbody);
		}
	}
});
$_LANG['sitelocklabel'] = "Verwalten Sie Ihre Sicherheit";
$_LANG['weeblylabel'] = "Erstellen Sie Ihre Website";
$_LANG['spamexpertslabel'] = "Verwalten Sie Ihren Mailfilter";

if the language string doesn't exist for the panel heading, then it will not attempt to translate the panel.

sA8Y8nY.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines