如何在Magento 2中安装3种或更多语言的语言包?

问题描述 投票:0回答:1

我的网站有3种语言英语,丹麦语和瑞典语。我在Magento_root / app路径中创建了i18n文件夹,我在语言文件夹里面的da_DK文件夹里面有language.xml,composer.json,da_DK.csv和registration.php文件。在i18n文件夹Magento_root/app/i18n/Locale/da_DK/。翻译对丹麦人来说非常有效。同样地,我为瑞典语创建了相同的结构,但不幸的是它对瑞典语不起作用。瑞典Magento_root/app/i18n/Locale/sv_SE/的路径

Magento_root /应用/国际化/区域设置/ sv_SE / composer.json

{
"name": "Locale/language-sv_se",
"description": "Swedish Language",
"version": "100.0.2",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"require": {
"magento/framework": "100.0.*"
},
"type": "magento2-language",
"autoload": {
"files": [
"registration.php"
]
}
}

Magento_root /应用/国际化/本地/ sv_SE / language.xml

<?xml version="1.0"?>
<!-- /** * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt 
for license details. */ -->
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
<code>sv_SE</code>
<vendor>locale</vendor>
<package>sv_se</package>
</language>

Magento_root /应用/国际化/区域设置/ sv_SE /和registration.php

<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
'locale_sv_SE',
__DIR__
);

Magento_root / app / i18n / locale / sv_SE / sv_SE.csv

"SIGN UP","BLI MEDLEM"
"LOG IN","logga in"
"LOG OUT","LOGGA UT"

我不知道为什么同样的方式是为丹麦人工作而不是为瑞典人工作。有人可以帮帮我吗?

编辑1

Here Danish is working but Swedish not working

我的文件夹结构在上面的截图中,我不知道我做错了什么,有人可以帮帮我吗?

magento translation magento2
1个回答
0
投票

经过大量搜索,我找到了解决方案。我刚刚重新安排了文件夹结构,它工作正常。我已将“Locale”文件夹重命名为danish Magento_root/app/i18n/danish/da_DK/,并创建了一个名为swedish Magento_root/app/i18n/swedish/sv_SE/的文件夹,并将文件放入其中。现在两种语言都运行良好。它可能在将来帮助某人。谢谢

© www.soinside.com 2019 - 2024. All rights reserved.