覆蓋 i18n 語言包的語法示例

/ app / i18n / <Vendor Namespace> / <語言包目錄> /composer.json

{
    "name": "<vendor namespance>/<language package directory>",
    "description": "<language package description>",
    "version": "100.0.1",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "require": {
        "magento/framework": "100.0.*"
    },
    "type": "magento2-language",
    "autoload": {
        "files": [
            "registration.php"
        ]
    }
}

/ app / i18n / <Vendor Namespace> / <language pack> /language.xml

<?xml version="1.0"?>
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
    <code><language package code></code>
    <vendor><vendor namespace></vendor>
    <package><language package directory></package>
</language>

/ app / i18n / <Vendor Namespace> / <language pack> /registration.php

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
    '<vendor namespance>_<language package directory>',
    __DIR__
);