webgonet Posted June 3, 2020 Share Posted June 3, 2020 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 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 4, 2020 Share Posted June 4, 2020 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. 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. 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.