定制 dsi-agpt/zf2-assetic-i18n 二次开发

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

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

dsi-agpt/zf2-assetic-i18n

最新稳定版本:0.0.4

Composer 安装命令:

composer require dsi-agpt/zf2-assetic-i18n

包简介

A few classes to add javascript internationalization feature to assetic

README 文档

README

A few classes to add javascript internationalization feature to assetic in zf2 context (via widmogrod/zf2-assetic-module).

String management

Replace all your string by codes in js files and enclose it between curly brackets.

alert("{UC-03-TRS-MSG-01}");

Then, create a text entry anywhere in ZF2 configuration and convert your codes into primary strings whith gettext mark so that your string is loaded by your i18n tool (e.g. poedit).

'text' => array(
        'UC-03-TRS-MSG-01' => _("This an i18n test.")
    )

Configuration requirements

Add an available_language entry under the translator key of your configuration.

'translator' => array(
  'available_languages' => array(
      'fr_FR',
      'en_US',
      'de_DE'
  ),

What the module does

At build time

All the javascript collections of your assetic configuration will be expanded in th following way : asset_js gives en_US_asset_js, fr_FR_asset_js etc. Each of them receives a filter that performs replacement of codes by primary strings and translation of primary strings into the target language.

At runtime

HeadScript and InlineScript view helpers behaviour is modified in order to prefix the javascript's files path with the current locale. The interest of this approach is that no translation is performed at runtime. Internationalized javascript files are served as static resources.

Issue

ServiceLocatorFactory module had to be introduced to get the service locator in alternative ViewHelperStrategy. But it's a bad practice.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2015-08-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固