0

我有一个网站,它已经支持两种语言,俄语和英语(两种语言都运行良好),现在我添加了亚美尼亚语。 问题--- 当我将网站切换为 armenain 语言时,我看到例如面包屑

text_home button_continue button_login ....

我检查了 \catalog\language\armen\armenian.php 文件并注意到该变量的值存在。

顺便说一句,当我从 armenian.php 添加到例如 language/armen/common/header .php 时,此代码

$_['text_home']             = 'arm_home';

它有效,但这意味着我应该在每一页中手动添加这个一般变量......我想要更优化的解决方案......

从管理面板我将 armenain 设置为默认语言

也许,我应该编辑 system\library\language.php ??? 这是结构

<?php
class Language {
    private $default = 'en-gb';
    private $directory;
    private $data = array();

    public function __construct($directory = '') {
        $this->directory = $directory;
    }

    public function get($key) {
        return (isset($this->data[$key]) ? $this->data[$key] : $key);
    }

    public function set($key, $value) {
        $this->data[$key] = $value;
    }

    // Please dont use the below function i'm thinking getting rid of it.
    public function all() {
        return $this->data;
    }

    // Please dont use the below function i'm thinking getting rid of it.
    public function merge(&$data) {
        array_merge($this->data, $data);
    }

    public function load($filename, &$data = array()) {
        $_ = array();

        $file = DIR_LANGUAGE . 'english/' . $filename . '.php';

        // Compatibility code for old extension folders
        $old_file = DIR_LANGUAGE . 'english/' . str_replace('extension/', '', $filename) . '.php';

        if (is_file($file)) {
            require($file);
        } elseif (is_file($old_file)) {
            require($old_file);
        }

        $file = DIR_LANGUAGE . $this->default . '/' . $filename . '.php';

        // Compatibility code for old extension folders
        $old_file = DIR_LANGUAGE . $this->default . '/' . str_replace('extension/', '', $filename) . '.php';

        if (is_file($file)) {
            require($file);
        } elseif (is_file($old_file)) {
            require($old_file);
        }

        $file = DIR_LANGUAGE . $this->directory . '/' . $filename . '.php';

        // Compatibility code for old extension folders
        $old_file = DIR_LANGUAGE . $this->directory . '/' . str_replace('extension/', '', $filename) . '.php';

        if (is_file($file)) {
            require($file);
        } elseif (is_file($old_file)) {
            require($old_file);
        }


        $this->data = array_merge($this->data, $_);

        return $this->data;
    }
}

先感谢您

4

1 回答 1

0

我使用了一个旧包的 armenain 语言,它与 oc 2.3 不兼容,解决方案https://crowdin.com/project/opencart-translation-v2/hy-AM#

于 2016-12-09T16:16:53.380 回答