简体   繁体   中英

opencart 2.3 Default Language Other Than English

I have a website which already works on 2 languages ,russian and english(everything runs well in both languages), now i have added armenian language. The Problem --- when i switch on the website into armenain language , i see ,for example,in breadcrumbs

text_home button_continue button_login ....

i have checked \\catalog\\language\\armen\\armenian.php file and noticed that values of this varables exist.

By the way ,when i add from armenian.php into ,for example, language/armen/common/header .php this code

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

it works , but thit means that i should add by hand in every single page this general variable... i would like to have more optimal solution ...

from admin panel i set armenain as default language

Maybe ,i should edit system\\library\\language.php ??? Here is the structure

<?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;
    }
}

Thank you in advance

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM