Websoft9 / docker-library

Docker Compose examples of selfhosted FOSS based on official image, just run it.
https://www.websoft9.com
Other
36 stars 25 forks source link

不能设置语言 [Magento] #360

Closed laozhou0731 closed 11 months ago

laozhou0731 commented 1 year ago

Describe the bug

设置前台

image

设置后台

image

laozhou0731 commented 1 year ago

对比2.4.3,语言目录 /var/lib/docker/volumes/magento_magento_data/_data/vendor/magento/language-zh_hans_cn 缺少文件 zh_Hans_CN.csv

上传该文件,执行如下命令,能解决后台设置中文的问题: image

## 下载语言包
cd /var/lib/docker/volumes/magento_magento_data/_data/vendor/magento/language-zh_hans_cn 
wget -N https://raw.githubusercontent.com/magento-l10n/language-zh_CN/master/zh_CN.csv
## 进入容器,安装语言
docker exec -it magento bash
cd /bitnami/magento/
bin/magento setup:static-content:deploy zh_Hans_CN
bin/magento indexer:reindex
bin/magento cache:clean
bin/magento cache:flush
laozhou0731 commented 1 year ago

zh_Hans_CN.csv

zh_Hans_CN2.csv

qiaofeng1227 commented 1 year ago

Docker image env: MAGENTO_MODE: Magento mode. Valid values: default, production, developer. Default: default

refer to:

develop can show language list, but can't tranlate the menu and other contents

chendelin1982 commented 1 year ago

Resource for reference:

zhaojing1987 commented 1 year ago

When installing Magento, the official default is to only install the US version and not install other language packs. The other language packs need to be installed by oneself。How to Install Chinese Language Pack:

  1. Get Language Pack:Magento officially released a translation of Chinese language writing on Crowdin Magento 2 Project, but the version and translation progress are incomplete 。For this reason,some third-party authors create some zh_CN language package based on translations provided at Crowdin Magento 2 Project。Such as:

    However,any third-party zh_CN language package may miss some translations. We can use third-party language packs or create our own language packs based on crowdin。 The third-party language pack as a complete CSV file can be directly downloaded and used. If you need to create your own language pack based on crowdin,。we need to merge the translations of all modules separately before using it.

  2. Import Language Pack: A complete language pack that includes the following content:

    • Required license files
    • composer.json
    • registration.php that registers the language package
    • language.xml meta-information file
    • A translated CSV file During the installation of magento, the Chinese language pack was automatically installed, but the translation files were missing。The directory is located at: /var/lib/docker/volumes/magento_magento_data/_data/vendor/magento/language-zh_hans_cn && wget -N https://raw.githubusercontent.com/magento-l10n/language-zh_CN/master/zh_CN.csv

      Like this: Image We need to upload the CSV translation file obtained in the previous step to this directory。We need to upload the CSV translation file obtained in the previous step to this directory and rename it to: zh_Hans_CN.csv。Because the official command for the Chinese language pack is: zh_Hans_CN Entering the interior of the magento main container:docker exec -it magento bash Execute the following command:

      magento setup:static-content:deploy zh_Hans_CN    (Deploy static content for specified language and region to Magento 2)
      magento indexer:reindex    (Force rebuild of all indexes)
      magento cache:clean    (Clear Cache)
      magento cache:flush    (Flush  Cache )
  3. switch language: From Magento 2 admin panel, navigate to admin(Your Account)> Account Setting (Your Account) >Interface Locale Enter Account Setting Image Choose Chinese: Image Save Account ,You will see the Chinese page:

Image