Author Topic: Disable english language (site)  (Read 181 times)

EvanGR

  • Jr. Member
  • **
  • Posts: 144
Disable english language (site)
« 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]

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1757
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: Disable english language (site)
« Reply #1 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
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

kishoreonwork

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 56
  • Free Virtuemart Consulting For Non Profits
    • virtuemart expert
  • Skype Name: kishore2607
  • VirtueMart Version: 3
Re: Disable english language (site)
« Reply #2 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



Code: [Select]
<?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
I am available for paid joomla and virtuemart consulting.
http://www.kishoreweblabs.com/
skype kishore2607

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3466
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: Disable english language (site)
« Reply #3 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
Code: [Select]
<?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.

EvanGR

  • Jr. Member
  • **
  • Posts: 144
Re: Disable english language (site)
« Reply #4 on: November 08, 2018, 11:13:01 am »
Thanks a lot everyone!