Force Language

Locked
Results 1 to 17 of 17
This thread is locked. New replies are disabled.
01 Sep 2006, 18:35
#1
triplettt avatar

triplettt

New Zenner

Join Date:
Sep 2006
Posts:
10
Plugin Contributions:
0

Force Language

Hi,
i would like have in shop one language for customers, but leaved english language support.

In the even of visitors English pages create redirecting on deafult language and hold all variables in address bar.

This exacly do language icons. I need teplate linecode for one default language,that i can add als meta code in page header. xxx

[PHP]<head>
...
<?php if (defined('FORCE_LANGUAGE')) { ?>
<meta http-equiv="refresh" content="1;url=<?php xxx ?>" />
<?php } //endif FORCE_LANGUAGE ?>
...
</head>[/PHP]

also

meta_tags.php appropriate for english languare
------------------
[PHP]// Define FORCE_LANGUAGE , if empty redirecting will be dissabled
define('FORCE_LANGUAGE', 'yes');[/PHP]



thanx for advices
01 Sep 2006, 21:24
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Posts:
31,500
Plugin Contributions:
4

Re: Force Language

Find directions for another language here Install language pack

ZenCart will then when configured, display the selected language.

I think that this is what you were asking
01 Sep 2006, 21:34
#3
triplettt avatar

triplettt

New Zenner

Join Date:
Sep 2006
Posts:
10
Plugin Contributions:
0

Re: Force Language

this is tpl_languages.php
tpl_languages.php show languages flags in frontpages (sidebox)

[PHP] $content = "";
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">';

$lng_cnt = 0;
while (list($key, $value) = each($lng->catalog_languages)) {
$content .= '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '">' . zen_image(DIR_WS_LANGUAGES . $value['directory'] . '/images/' . $value['image'], $value['name']) . '</a>  ';
$lng_cnt ++;
if ($lng_cnt >= MAX_LANGUAGE_FLAGS_COLUMNS) {
$lng_cnt = 0;
$content .= '<br />';
}
}
$content .= '</div>';[/PHP]

i need code, wich show only one deafault language (even 2 languages are instaled)
01 Sep 2006, 23:48
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Force Language

If you don't want to give customers the option of selecting another language, simply turn off the language sidebox in Admin->Tools->Layout Boxes Controller
01 Sep 2006, 23:51
#5
triplettt avatar

triplettt

New Zenner

Join Date:
Sep 2006
Posts:
10
Plugin Contributions:
0

Re: Force Language

even then customers can (inadvertently) open shop with another language.
02 Sep 2006, 00:08
#6
triplettt avatar

triplettt

New Zenner

Join Date:
Sep 2006
Posts:
10
Plugin Contributions:
0

Re: Force Language

i was trying this, but not working :-/

[PHP]<meta http-equiv="refresh" content="1;url=<?php zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '; ?>" />[/PHP]
02 Sep 2006, 00:09
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Force Language

If your default language is set to Spanish, and you provide the customer with no links to change the language, then the only way for the customer to change the language is if they know Zen Cart well enough to know how to override it by adding parameters to the URL.

You seem to be convinced that there is a problem. Perhaps you can explain what is the exact problem you are experiencing?
02 Sep 2006, 00:28
#8
triplettt avatar

triplettt

New Zenner

Join Date:
Sep 2006
Posts:
10
Plugin Contributions:
0

Re: Force Language

i would like have in shop rules.

2 languages EN CZ

and make EN for customers unavailable.

how?

set deafaul CZ, disable block and

add to EN meta_tags.php meta tag for automatic redirection

examp. from url:

[HTML]http://localhost/zen/index.php?main_page=product_info&products_id=85&language=en[/HTML]

to

[HTML]http://localhost/zen/index.php?main_page=product_info&products_id=85&language=cz[/HTML]
02 Sep 2006, 00:42
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Force Language

why ?
02 Sep 2006, 00:51
#10
triplettt avatar

triplettt

New Zenner

Join Date:
Sep 2006
Posts:
10
Plugin Contributions:
0

Re: Force Language

i still have problem with default languge. Even its set def. lang. CZ, sometimes (depend on browser, OS, links from others websites, etc. ) customer open shop in EN.

I will not fill all fields like description by products etc. in two languages. So they are EN empty.

And if customer (somehow) open shop in EN language, isnt shop, but chaoss. :lookaroun
02 Sep 2006, 01:05
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Force Language

You may need to do the flip for the language to avoid this ...

In theory if you have no direct link to language changes, then there should not be a way to switch ... as DrByte indicated ...

However to make life easier on upgrades etc. it is recommend not deleting english or you will be very very sad on upgrades ... :cry:
02 Sep 2006, 01:19
#12
triplettt avatar

triplettt

New Zenner

Join Date:
Sep 2006
Posts:
10
Plugin Contributions:
0

Re: Force Language

exist simple solution:

meta_tags.php in EN

[PHP]// Define REFRESH_ADDRESS
define('REFRESH_ADDRESS', 'http://localhost/zen/index.php?main_page=index&language=cz');[/PHP]
---------------------------

add in template
-------------------------------------------
[PHP]<?php if (defined('REFRESH_ADDRESS')) { ?>
<meta http-equiv="refresh" content="1;url=<?php REFRESH_ADDRESS; ?> " />
<?php } //endif REFRESH-ADDRESS ?>[/PHP]

----------------------------

this force customer in CZ shop, but only on mainpage.
I would like force on the same page.

(customer find product via ex. gooogle. Go on product page. But page is in En lang. without many texts. And metatag redirect to same page in default lang. (CZ lang.) or not only on mainpage in def. lang..)

Its the same function like laguage flags. But i am not able edit code for this case (mean edit for use in metatag ). (low php and mysql skill)
02 Sep 2006, 02:14
#13
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Force Language

tripleTTT:

customer find product via ex. gooogle. Go on product page. But page is in En lang.

The page should not be in english if the customer has not set a language. Doesn't matter if it comes from Google or not.

...unless you have changed the setting for "Admin->Configuration->My Store->Language Selector". It should be set to "Default".
02 Sep 2006, 10:08
#14
triplettt avatar

triplettt

New Zenner

Join Date:
Sep 2006
Posts:
10
Plugin Contributions:
0

Re: Force Language

this is alredy set and still is going to happen.

with metatag customer never get lost in translation.
03 Sep 2006, 21:58
#15
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Posts:
21,876
Plugin Contributions:
6

Re: Force Language

Have you tried it and it DOES happen? If so, you have a problem that needs to be addressed. If not, listen to DrByte.
11 Oct 2006, 10:17
#16
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
3

Re: Force Language

I got the same issue I think.

Some products are indexed by google with the "language=en" parameter. I think it started because I have had languages box displayed in the beginning (as far as I can see it only happens with "old" products, and all defaults are set to Dutch, and not to browser language).

I think I can come up with a solution myself, but I found this thread while looking if it already had been done by someone else ;-)

Maybe I will just add a:
if(isset ($_GET['language'])){
$_GET['language'] = 'nl';
}

or:
if(isset ($_GET['language'])){
$_GET['language'] = DEFAULT_LANGUAGE;
}

somewhere as a quick fix?
11 Oct 2006, 10:48
#17
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
3

Re: Force Language

For now I added this to my init overrides/ folder (1.3.5):
<?php
/**
* initialise language handling
* see {@link http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials#InitSystem wikitutorials} for more details.
*
* @package initSystem
* @copyright Copyright 2003-2005 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @todo ICW(SECURITY) is it worth having a sanitizer for $_GET['language'] ?
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: init_languages.php 2753 2005-12-31 19:17:17Z wilt $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
if (!isset($_SESSION['language']) || isset($_GET['language'])) {
$lng = new language();
if (isset($_GET['language']) && zen_not_null($_GET['language'])) {
$lng->set_language($_GET['language']);
} else {
if (LANGUAGE_DEFAULT_SELECTOR=='Browser') {
$lng->get_browser_language();
} else {
$lng->set_language(DEFAULT_LANGUAGE);
}
}
$lng->set_language(DEFAULT_LANGUAGE);
$_SESSION['language'] = (zen_not_null($lng->language['directory']) ? $lng->language['directory'] : 'english');
$_SESSION['languages_id'] = (zen_not_null($lng->language['id']) ? $lng->language['id'] : 1);
$_SESSION['languages_code'] = (zen_not_null($lng->language['code']) ? $lng->language['code'] : 'en');
}
?>

The red line is the difference with the default lang init file. Might add a switch later on, and change the red line to:

if(FORCE_DEFAULT_LANGUAGE == 'true'){
$lng->set_language(DEFAULT_LANGUAGE);
}
(or just remove it when I ever need more than one language again)