定制 mecodeninja/module-dynamic-translation 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mecodeninja/module-dynamic-translation

最新稳定版本:1.0.0

Composer 安装命令:

composer require mecodeninja/module-dynamic-translation

包简介

N/A

README 文档

README

Magento 2 module that allows a developer to flag rows in translation dictionaries to be added regardless of whether a instance of the string is matched or not.

Install

composer require mecodeninja/module-dynamic-translation

Usage

Append ,dynamic to any translation which should be added to the dictionary (js-translation.json).

Example

en_US.csv

"value1","translated value1",dynamic
"value2","translated value2",dynamic
"value3","value3",dynamic

Results in the following js-translation.json response

{"value1":"translated value1","value2":"translated value2","value3":"value3"}

Scenario

This is helpful if a developer has a value which needs to be translated but the value is part of a dynamic output in a knockout template.

Willwright/Demo/view/frontend/web/template/demo.html

<ul data-bind="foreach: getValues()">
    <li>
        <span data-bind="i18n: $data"></span>
    </li>
</ul>

Willwright/Demo/view/frontend/web/js/demo.js

define(['jquery', 'uiComponent', 'ko'], function ($, Component, ko) {
        'use strict';
        return Component.extend({
            initialize: function () {
                this._super();
            },
            getValues: function(){
                return [
                    'value1',
                    'value2',
                    'value3'
                ];
            }
        });
    }
);

Normally the above values would not be translated. However, with this module and ,dynamic added to the appropriate rows the values will be translated.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-11-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固