承接 xelax90/zf-doctrine-orm-translation-loader 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

xelax90/zf-doctrine-orm-translation-loader

Composer 安装命令:

composer require xelax90/zf-doctrine-orm-translation-loader

包简介

Provides a translation loader that uses doctrine ORM

README 文档

README

This module adds an additional translation loader that uses Doctrine ORM to store translations.

Installation

Installation of LanguageRoute uses composer. For composer documentation, please refer to getcomposer.org.

composer require xelax90/zf-doctrine-orm-translation-loader

Then add DoctrineORMTranslationLoader to your config/application.config.php and run the doctrine schema update to create the database table:

php vendor/bin/doctrine-module orm:schema-tool:update --force 

Usage

This module uses the DoctrineORMTranslationLoader\Entity\Translation entity to store translations. To add new translations, simply add new entities using Doctrine or directly add them into the translation database table. The default translator will automatically use the provided loader and the translate() function/view helper will search the database for translations.

Translation Keys should not start with __META__ since this prefix is used for storing metadata. Using __META__plural_forms in particular will lead to unwanted side-effects.

Plural translations

You can store plural translations by using the translationPluralNumber property of the DoctrineORMTranslationLoader\Entity\Translation entity. Provide a translation for each plural form in your plural rule and use the translator's translatePlural function to choose the correct form.

Meta data

You can also store meta data (such as the plural forms) for each locale and domain. Each meta entry must have a translation key starting with __META__ followed by the meta identifier. Meta rules are not deleted from the translator which makes it possible to use them as translation keys, although it is not recommended. As of now, only the plural_forms identifier is interpreted.

The DoctrineORMTranslationLoader\I18n\Translator\Loader\DoctrineEntity class provides constants for the meta prefix and the plural_forms identifier which you might find useful when adding or reading metadata in a PHP script.

To store the plural rules for a local and domain, use __META__plural_forms as the translation key. For details about the plural rule syntax, please refer to the Zend_i18n documentation.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPLv2
  • 更新时间: 2016-11-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固