承接 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
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

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