Zen Cart Logo
Forums / Addon Language Packs / Japanese working on 1.3.8a

Japanese working on 1.3.8a

Locked

Views: 2,959

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
15 Jan 2008, 3:55 PM
#1
rengoku avatar

rengoku

New Zenner

Join Date:
Jan 2008
Location:
US
Posts:
5
Plugin Contributions:
0

Japanese working on 1.3.8a

I have been working on getting Japanese to install with v. 1.3.8... What I have found... you simply need to remove a few lines of code that was giving blank pages or errors and now it works like a champ!

So I take no credit for this... attached are the edited files... just add them to your install in the same directory they are inthen FTP to server and install... Install is in English and you will still need to add Japanese in the Localization / Languages section as normal. I have it working on 3 sights now... all I did was FTP it up and install... that’s it... nothing to it!

This is using zen-cart-v1.3.8a-full-fileset-12112007 with zen-cart-v1.3.0.2-l10n-jp-2.

4 Mar 2008, 12:05 PM
#2
crystalkoi avatar

crystalkoi

Zen Follower

Join Date:
Apr 2007
Posts:
181
Plugin Contributions:
0

Re: Japanese working on 1.3.8a

@Rengoku

This is will cause problems, there is a new pack that I am working on that will be released soon.

You are using 1.3.02 code with 1.3.8, expect some problems that if you haven't seen, they will show up sometime.

10 Mar 2008, 4:32 AM
#3
pingping avatar

pingping

New Zenner

Join Date:
Mar 2008
Posts:
29
Plugin Contributions:
0

Re: Japanese working on 1.3.8a

Keep up the hard Work CK. Am brand new to Zen Cart and stores. Learning with intention of adding Japan language and pricing. Friend of mine is Japanese and I'm trying to build store. Have started with 1.3.8a last week so want the Nihongo for this latest version. Thanks.

11 Mar 2008, 4:14 AM
#4
crystalkoi avatar

crystalkoi

Zen Follower

Join Date:
Apr 2007
Posts:
181
Plugin Contributions:
0

Re: Japanese working on 1.3.8a

If you are just starting, I would really stress to use a UTF-8 zen cart and also make the database Unicode. I will have all this in a walk through soon. I have been working on the write up now.

Good luck.

Regards,
CKD

16 Mar 2008, 10:18 AM
#5
pingping avatar

pingping

New Zenner

Join Date:
Mar 2008
Posts:
29
Plugin Contributions:
0

Re: Japanese working on 1.3.8a

Yes, please educate me.

I am in America and speak English. Seems everything is easy for me (kidding, humor).

So I look at the database in PHPMyAdmin and it says Collation: latin1_swedish_ci

I think that is default so all the tables will have that collation automatically. Perhaps I should have created the table then logged in and changed this to one of the other settings (there's so many I don't know exactly which to choose). Then installed Zen Cart? I don't recall if there is some setting in Zen Cart installation that allows us to choose the UTF-8 Zen Cart as you mention below? If there is a simple setting to select during insatllation you should elaborate on that. For my situation I will need to figure out how to fix my already existing installation. I don't really understand what the difference is between the Zen Cart UTF-8 and the Database Unicode thing you mention.

I did a google search and discovered there is a command that I could run that converts a table collation.

ALTER TABLE table CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

This comes from: http://forum.mambo-foundation.org/showthread.php?t=9620

So guess I can write a PHP script that issues this command on each of the database tables, like in a loop?

Would you please elaborate on this stuff so I understand what it is, and what exactly I need to make it for best operation. I want to have English as "default language" in Zen Cart and also have Japanese as language and have the two flags (possibly more in future). I'm not sure about money issue yet. May be priced in dollars but the paypal will convert to Yen? I'm learning about how this will happen.

17 Mar 2008, 4:16 AM
#6
crystalkoi avatar

crystalkoi

Zen Follower

Join Date:
Apr 2007
Posts:
181
Plugin Contributions:
0

Re: Japanese working on 1.3.8a

@PingPing

I will cover all of this soon in a write up. But for now you can just set your database in phpMyAdmin before you install the cart to Collation utf8_general_ci

general will work better than unicode for Japanese.

I will have more to come on this in the next week or so (I hope!)

Regards,
CKD

17 Mar 2008, 4:58 AM
#7
onelove5683 avatar

onelove5683

New Zenner

Join Date:
Apr 2007
Posts:
77
Plugin Contributions:
0

Re: Japanese working on 1.3.8a

will this work for chinese too?

18 Mar 2008, 1:40 AM
#8
crystalkoi avatar

crystalkoi

Zen Follower

Join Date:
Apr 2007
Posts:
181
Plugin Contributions:
0

Re: Japanese working on 1.3.8a

@onelove5683

It will work for Chinese.

Also I forgot to post that you need to edit one file, but it can depend if you are running your whole cart in UTF-8 or running it in multiple encodings, one for each language. I will tell you that in the long run, running them all in UTf-8 is the best way to go. Again, there is a lot of info that goes into this, and I just don't have the time today to go through it, and I want to put it all in one place. I should have it up soon. Again, if you need this right away you can always contact me through my work. I am not trying to advertise here, just clients are my main priority right now.

Regards,

CKD

18 Mar 2008, 3:38 AM
#9
pingping avatar

pingping

New Zenner

Join Date:
Mar 2008
Posts:
29
Plugin Contributions:
0

Re: Japanese working on 1.3.8a

Am anxious to read your documentation. I really don't know much at all about encoding, not even the proper string at beginning of html documents. Have google search and read these somewhat unrelated conversion discussion:

http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html
http://uclue.com/?xq=1351
http://www.mysqlperformanceblog.com/2007/12/18/fixing-column-encoding-mess-in-mysql/

and found this software (not sure of relevence):

http://www.killetsoft.de/p_cona_e.htm

Best thing I found was a nice PHP script someone made to convert their wordpress to the UTF-8 encoding. It's a straightforward script and not long. I think it would make a terrific base for anyone wanting to create a similar script to convert a Zen Cart db to UTF-8. I think I need such a script since I've put a couple day of input all the products into the database already (using latin1_swedish_ci). Can imagine it would be a necessary script for other people who've put a couple years into their store, I'm only a few weeks into learning Zen Cart.

http://projects.tacker.org/svn/smallprojects/wordpress/convert-encoding.php

<?php

// +----------------------------------------------------------------------+
// | Convert wordpress content encoding                                   |
// +----------------------------------------------------------------------+
// | Copyright (C) 2005 Markus Tacker <[email protected]>                      |
// +----------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or        |
// | modify it under the terms of the GNU Lesser General Public           |
// | License as published by the Free Software Foundation; either         |
// | version 2.1 of the License, or (at your option) any later version.   |
// |                                                                      |
// | This library is distributed in the hope that it will be useful,      |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    |
// | Lesser General Public License for more details.                      |
// |                                                                      |
// | You should have received a copy of the GNU Lesser General Public     |
// | License along with this library; if not, write to the                |
// | Free Software Foundation, Inc.                                       |
// | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA               |
// +----------------------------------------------------------------------+

    /**
    * Converts wordpress encodings
    *
    * IMPORTANT!
    * Remember to dumpy your database first
    *
    * mysqldump --opt DB_NAME
    *
    * Or use phpMyAdmin:
    *  http://www.zerokspot.com/docs/howto.phpmyadmin.backup_and_restore/
    *  http://www.phpmyadmin.net/documentation/#faq6_3
    *
    * Do NOT run this script more then once
    *
    * Place this script inside the wp-content folder of your blog and
    * access it via the browser, e.g. http://yoursite.com/blog/wp-content/convert-encoding.php
    *
    * Remember to remove it afterwards.
    *
    * @author Markus Tacker <[email protected]>
    * @version $Id$
    * @link http://versions.tacker.org/svn/wp-convert-encoding/trunk/convert-encoding.php
    */

    // You have to remove the line below to make this script work
    // By removing the line you accept the license agreement stated above
    die('Please follow the instructions in ' . $_SERVER['PHP_SELF']);

    error_reporting(E_ALL);
    ini_set('display_errors', 1);

    /**
    * @var string Target encoding
    */
    $new_encoding = 'UTF-8';

    /**
    * @var string New collation for the table
    */
    $new_mysql_collation = 'utf8_general_ci';

    /**
    * @var string New character set for the table
    */
    $new_mysql_encoding = 'utf8';

    /**
    * You would set this switch to true if you have used this script before
    * and Your titles contain invalid non-ascii charactes like "für"
    * Your database entries are utf-8 encoded and need to be decoded, not converted.
    *
    * @var bool UTF-8 decode your content instead
    */
    $decode = false;

    require_once '../wp-config.php';

    // Connect
    $DBC = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
    mysql_select_db(DB_NAME, $DBC);

    $result = mysql_query('SHOW TABLES FROM ' . DB_NAME, $DBC);

    echo '<pre>';
    echo 'Mode is <strong>' . (($decode) ? 'decode' : 'convert') . "</strong>\n";
    echo 'New encoding is <strong>' . $new_encoding . "</strong>\n";
    echo 'New encoding for mysql is <strong>' . $new_mysql_encoding . "</strong>\n";
    echo 'New collation for mysql is <strong>' . $new_mysql_collation . "</strong>\n";
    while ($row = mysql_fetch_row($result)) {
        // Skip Non-WP tables
        if (!empty($table_prefix) && substr($row[0], 0, strlen($table_prefix)) != $table_prefix ) continue;
        // Convert the tables encoding
        $sql = 'ALTER TABLE ' . ek($row[0]) . ' DEFAULT CHARACTER SET ' .  $new_mysql_encoding . ' COLLATE ' . $new_mysql_collation;
        mysql_query($sql);
        // Convert the fields
        $sql = 'SHOW CREATE TABLE ' . ek($row[0]);
        $result2 = mysql_query($sql);
        $table_sql = mysql_fetch_assoc($result2);
        foreach (explode("\n", $table_sql['Create Table']) as $line) {
            $line = trim($line);
            if (!preg_match('/ character set ([^ ]+)/', $line, $match_cs)) continue;
            $line = preg_replace('/collate [0-9a-z_]+/i', '', $line); // Remove old collate
            preg_match('/^`[^`]+`/', $line, $match_field);
            $sql = 'ALTER TABLE ' . ek($row[0])
            . ' CHANGE ' . $match_field[0] . ' '
            . str_replace($match_cs[0], ' character set ' . $new_mysql_encoding . ' COLLATE ' .  $new_mysql_collation, substr($line, 0, -1));
            mysql_query($sql);
        }
        // Convert its data
        $result_data = mysql_query('SELECT * FROM ' . $row[0]);
        echo $row[0] . ' ';
        while ($data = mysql_fetch_assoc($result_data)) {
            $sql = 'UPDATE ' . $row[0];
            // Build set
            $set = array();
            foreach ($data as $key => $val) {
                if ($decode) {
                    $set[] = ek($key) . '=' . ev(utf8_decode($data[$key]));
                } else {
                    $set[] = ek($key) . '=' . ev(mb_convert_encoding($data[$key], $new_encoding));
                }
            }
            $sql .= ' SET ' . join(', ', $set);
            // Build where
            $where = array();
            foreach ($data as $key => $val) {
                if (!preg_match('/^[0-9]+$/', $val)) continue; // Use only numbers in where
                $where[] = ek($key) . '=' . ev($data[$key]);
            }
            if (empty($where)) continue 2; // Table has no numeric fields, skip it
            $sql .= ' WHERE ' . join(' AND ', $where);
            $query_result = mysql_query($sql, $DBC);
            if (!$query_result) {
                die( 'Query failed: ' . $sql . ' (' . mysql_error() . ')' );
            }
            echo '.';
            flush();
        }
        echo "\n";
    }
    echo "All done.\n";
    echo '<span style="color: #ff0000;">Remember to remove this script!</span>' . "\n";
    echo '</pre>';

    // Disconnect
    mysql_close($DBC);

    function ek($string)
    {
        global $DBC;
        return "`" . mysql_real_escape_string($string, $DBC) . "`";
    }

    function ev($string)
    {
        global $DBC;
        return "'" . mysql_real_escape_string($string, $DBC) . "'";
    }

?>
18 Mar 2008, 4:32 AM
#10
crystalkoi avatar

crystalkoi

Zen Follower

Join Date:
Apr 2007
Posts:
181
Plugin Contributions:
0

Re: Japanese working on 1.3.8a

Yes, there will be a lot of issues for someone who is using a database already and has already input Japanese. I will try to lay out as many options as I can, and other people can give their input as if they know other ways. I am afraid that I won't be able to give an answer for everything and everyones problems. I will try my best to keep things clean and best advised for future upgrades, but I will not really support the past Japanese pack, for the very reason that I think there is a better way to go about this.

Regards,

CKD