Jump to content

language selection url change


webgonet

Recommended Posts

hi guys,

 

I have the following language hook from Brian:

===============

<?php

/**
* Change Language Localised Names
* @author brian!
*/

function locales_hook($vars) {
    $mylocal = $vars['locales'];
    foreach ($mylocal as $key => $value) {

if ($value["language"] == "english") {
$mylocal[$key]["localisedName"] = "US | ENGLISH | USD";
}

elseif
($value["language"] == "au-english"){
$mylocal[$key]["localisedName"] = "AU | ENGLISH | AUD";
}


}
$activelocale = $vars['activeLocale'];

if ($activelocale["language"] == "en") {
$activelocale["localisedName"] = "United States";
}

elseif   
($activelocale["language"] == "en-AU"){
$activelocale["localisedName"] = "Australia";
}


return array("locales" => $mylocal, "activeLocale" => $activelocale);
}
add_hook("ClientAreaPage", 1, "locales_hook");
?>

===============

I would like to add and url for each language, so if the user selects Australia the user is sent to mydomain.com.au

 

 

regards,

 

webgonet

Link to comment
Share on other sites

14 hours ago, webgonet said:

I would like to add and url for each language, so if the user selects Australia the user is sent to mydomain.com.au

that's an old hook. 😲

I would be tempted to do this in the template...

<a href="{$currentpagelinkback}language={$locale.language}">{$locale.localisedName}</a>

changes to...

<a href="{if $locale.language eq 'english'}https://www.domain.co.uk{elseif $locale.language eq 'french'}https://www.domain.fr{/if}{$currentpagelinkback}language={$locale.language}">{$locale.localisedName}</a>

though that assumes that there is either one WHMCS install using multiple domains, or multiple WHMCS installs all with the same structure.

Ff3exdi.png

depending on how you're outputting those languages in the template, a hook might be an option - but thinking of the way it's done in Six, just conditionally adding the link in the template might be simpler... you could even pass the chosen currency in the same URL.

the same would apply to the "Select A Country" dropdown in the navbar.

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