Change SChinese to Chinese
[Note: remember to include site URL, ZC version, list of plugins, PHP version, etc ... read the Posting Tips shown above for information to include in your post here. And, remove this comment before actually posting!]
Hi all,
SChinese there
http://www.mammyloves.com/store/inde...ex&language=gb
While on this language, the top menu dropdown language bar show Schinese
Which PHP or language files that I need to change to make it from SChinese to Chinese?
English there
http://www.mammyloves.com/store/inde...ex&language=en
While on English language, the same language dropdown menu can show Chinese (Before it is Schinese)
I go to back end
Localization > Languages > edit
Name: chinese
Code: gb
Image: icon.gif
Directory: schinese
Sort Order: 3
Before the name on above setting are
Name: Schinese, I change it to chinese ....
So English language look like work, but .... why it look like not work on Chinese language?
Sorry of my poor English ..
Re: Change SChinese to Chinese
Based on that test, it appears that your language selector (which appears to be javascript code) is using the directory field from TABLE_LANGUAGES instead of the name field. The proper solution would be to modify how that code works such that it uses the name field.
The alternative, which will cause issues/trouble in the future is to create the language directories that are named Chinese instead of schinese and copy every file/folder over to that location.
There are a few ways to get down to the issue, but the admin tool called developers tool kit should help to find the code area in question. (admin->tools->developers tool kit)
You may want to try starting with the lower left corner, enter directory, in the dropdown choose catalog, in the next dropdown select javascript, then search.
Otherwise, again using the lower left corner could enter information that is found adjacent/around the source code shown for the dropdown such as: select-language and search everything. That should/would identify where either the javascript takes action or the dropdown is drawn and from there follow "backwards" where the list of items comes from.
Re: Change SChinese to Chinese
Hi mc12345678,
While using Developer Tool for search all file
Only locked "/includes/templates/##########_temp/sideboxes/tpl_languages_header.php"
PHP Code:
<?php
/**
* All Business Template
*
* @package templateSystem
* @copyright Copyright 2007 iChoze Internet Solutions http://ichoze.com
* @copyright Portions Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: tpl_languages.php 2982 2006-02-07 07:56:41Z birdbrain $
*/
$content = "";
$content .= '<div class="form-language"><label for="select-language"></label>';
$lng_cnt = 0;
$content .='<div class="select-language sbHolder" id="select-language">
<a class="sbSelector" href="javascript:void(0)">'.ucfirst($_SESSION['language']).'</a>
<a class="sbToggle" href="javascript:void(0)"></a>
';
$content .='<ul id="sbOption_language" class="sbOptions" style="display: none;" >';
while (list($key, $value) = each($lng->catalog_languages)) {
if($_SESSION['languages_code']=="$key"){
$content .= '<li class="lang"> <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'],'','','class="flag"').' '.$value['name']. '</a></li>';
}else{
$content .= '<li class="lang"> <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'],'','','class="flag"').' '.$value['name']. '</a></li>';
}
$lng_cnt ++;
}
$content.="</ul></div>";
$content .= '</div>';
?>
As using the CSS class to lock
I only find above as
PHP Code:
$content .='<div class="select-language sbHolder" id="select-language">
<a class="sbSelector" href="javascript:void(0)">'.ucfirst($_SESSION['language']).'</a>
<a class="sbToggle" href="javascript:void(0)"></a>
';
So ... Why English work, but change to Chinese not work? Look it the coding
PHP Code:
ucfirst($_SESSION['language'])
Re: Change SChinese to Chinese
Where using development tool on find all mode and search "javascript:void(0)"
Have some result, it look like this template default installed a module called "Dynamic Filter"
https://www.zen-cart.com/downloads.php?do=file&id=1361
And search some files that I am thinking relationship
/includes/templates/##########_temp/sideboxes/tpl_dynamic_filter.php
PHP Code:
Line #10846 : el.href = 'javascript:void(0)';
/includes/templates/##########_temp/sideboxes/tpl_languages_header.php
PHP Code:
Line #18 : <a class="sbSelector" href="javascript:void(0)">'.ucfirst($_SESSION['language']).'</a>
Line #19 : <a class="sbToggle" href="javascript:void(0)"></a>
Re: Change SChinese to Chinese
Quote:
Originally Posted by
explorer1979
Hi mc12345678,
While using Developer Tool for search all file
Only locked "/includes/templates/##########_temp/sideboxes/tpl_languages_header.php"
PHP Code:
<?php
/**
* All Business Template
*
* @package templateSystem
* @copyright Copyright 2007 iChoze Internet Solutions http://ichoze.com
* @copyright Portions Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: tpl_languages.php 2982 2006-02-07 07:56:41Z birdbrain $
*/
$content = "";
$content .= '<div class="form-language"><label for="select-language"></label>';
$lng_cnt = 0;
$content .='<div class="select-language sbHolder" id="select-language">
<a class="sbSelector" href="javascript:void(0)">'.ucfirst($_SESSION['language']).'</a>
<a class="sbToggle" href="javascript:void(0)"></a>
';
$content .='<ul id="sbOption_language" class="sbOptions" style="display: none;" >';
while (list($key, $value) = each($lng->catalog_languages)) {
if($_SESSION['languages_code']=="$key"){
$content .= '<li class="lang"> <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'],'','','class="flag"').' '.$value['name']. '</a></li>';
}else{
$content .= '<li class="lang"> <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'],'','','class="flag"').' '.$value['name']. '</a></li>';
}
$lng_cnt ++;
}
$content.="</ul></div>";
$content .= '</div>';
?>
As using the CSS class to lock
I only find above as
PHP Code:
$content .='<div class="select-language sbHolder" id="select-language">
<a class="sbSelector" href="javascript:void(0)">'.ucfirst($_SESSION['language']).'</a>
<a class="sbToggle" href="javascript:void(0)"></a>
';
So ... Why English work, but change to Chinese not work? Look it the coding
PHP Code:
ucfirst($_SESSION['language'])
I'm sure that your second search (second post on this portion of the topic) resulted in several files that might seem appropriate, but the above search shows the issue as originating here.
As defined in the loaded file: includes/init_includes/init_languages.php, $_SESSION['language'] is assigned the directory name and is the session variable that is routinely used to pull language files from the correct language directory; however, the desire is to pull the 'name' key of the language that is currently in use... As it appears that $lng is currently defined, it is possible to use it in this code instead of (or in addition to having) the $_SESSION['language'] value. So from the init file there are the following assignments upon load:
Code:
$_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');
In the file /includes/templates/##########_temp/sideboxes/tpl_languages_header.php (Guessing that the template's/folder name is one that has been considered by ZC to not be displayed), in this section:
Code:
$content .='<div class="select-language sbHolder" id="select-language">
<a class="sbSelector" href="javascript:void(0)">'.ucfirst($_SESSION['language']).'</a>
<a class="sbToggle" href="javascript:void(0)"></a>
';
One should replace ucfirst($_SESSION['language']) with:
Code:
$lng->catalog_languages[$_SESSION['languages_code']]['name']
And that will pull up the language as defined in your languages area of the admin, so as far as "capitalization" it should display exactly as entered which in your post from a few posts back this should have Chinese as entered. It's unfortunate that this hasn't been otherwise addressed, but considering most languages use a directory that has the full name of the language, it probably wasn't really noticed by many others. :)
Re: Change SChinese to Chinese
mc12345678,
Wow, you are great and powerful.
It work for me now
Thank you x 1000 :hug:
Re: Change SChinese to Chinese
Glad that worked. I'm going to make a post in the associated template thread (all business) for others, though it could be that it was addressed there already.