VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: EvanGR on November 05, 2018, 09:21:12 AM

Title: Disable english language (site)
Post by: EvanGR on November 05, 2018, 09:21:12 AM
Hello,

Our VM site is in the Greek language (front-end). English is 'disabled' for the front-end.

However, if one types in the URL "?/language=en-GB"
then the English strings are loaded (or attempt to be be loaded) in the website.

Google has picked this up. And strings like "COM_VIRTUEMART_CHECKOUT" show up in the site and the search result.

Any idea how to fix this? Thanks

PS. The administrator backend is in English, and we want it that way.


[VM3.2.15/J3.8.10]
Title: Re: Disable english language (site)
Post by: Jörgen on November 05, 2018, 10:31:19 AM
You could copy all the greek language files to their GB versions. At least You would get greek text instead of english.
Maybe there is a more kosher way to stop finding english text, perhaps inactivate the english front end language ?

Jörgen @ Kreativ Fotografi
Title: Re: Disable english language (site)
Post by: kishoreonwork on November 06, 2018, 12:55:01 PM
A better approach will be 301 redirect to greek language url  when ever  current url contains  english lang.

It can be done through .htaccess  , a system plugin or sef plugin which allow redirection based on condition.

Or simple add below code to you template index.php at the top




<?php 
$jinput
=JFactory::getApplication()->input;

$lang $jinput->get('language');

if (
$jinput->getMethod() === 'POST'
|| count($jinput->post) > 0
|| count($jinput->files) > 0)
{
// If it is post request skip
 }else{

if($lang=='en-GB' ){
// we need to do redirection  when it is english

$current_urlJUri::getInstance()->toString(); 

$greek_uri=str_replace('en-GB','el-GR',$current_url); // change your language constant

header("HTTP/1.1 301 Moved Permanently"); 
header("Location: $greek_uri"); 
exit;

}

}

?>





Thanks
Kishore
Title: Re: Disable english language (site)
Post by: Studio 42 on November 07, 2018, 12:08:55 PM
Because you have only 1 language, it's better to redirect all to greek index when language is set

<?php $app JFactory::getApplication();
$lang $app->input->get('language');
if(!empty(
$lang) && $lang !=='el-GR') {
  
$app->redirect(JRoute::_('index.php&lang=el-GR'));
}
?>

This should prevent google indexing the pages and redirect to home for all users. You can set this code on the top of your template index.php file for eg.
Title: Re: Disable english language (site)
Post by: EvanGR on November 08, 2018, 11:13:01 AM
Thanks a lot everyone!