zauberfisch/silverstripe-better-i18n

替代SilverStripe i18n

安装数: 1,370

依赖项: 0

建议者: 0

安全: 0

星级: 5

关注者: 2

分支: 5

开放问题: 3

类型:silverstripe-module

dev-master 2015-10-08 20:46 UTC

This package is auto-updated.

Last update: 2024-09-04 07:42:07 UTC


README

进行中

此模块仍在开发中,是对SilverStripe i18n(目前仅为I18nTextCollector)的一个hack式的替代品。该模块的存在是因为SilverStripe当前的限制,并且一旦i18n重构,其API可能会发生变化或完全过时。

当前功能

  • 改进的文本收集
    • 与现有lang文件合并
    • 还会收集db_、has_many:、...实体
    • 更好的任务输出(显示未翻译的内容、新内容以及已删除的内容)
    • 未翻译的字符串以__为前缀(当我想出如何做时可能会更改为yml注释)

安装

要求

  • php需要写入lang文件夹的权限

安装模块

  1. 使用composer安装模块或下载并将其放置在您的项目文件夹中
  2. 运行?flush=1

使用方法

BetterI18NTextCollectorTask

参数

  • targetlocale 应创建lang文件的目标区域设置
    例如:en或区域设置列表:en,de,fr
    默认:en
  • module 要翻译的模块(将写入module/lang/$targetlocale.yml)例如:mysiteframeworkmysite,frameworkthemes/mytheme默认:mysite

示例

  • http://mysite.com/dev/tasks/BetterI18nTextCollectorTask?flush=1
  • http://mysite.com/dev/tasks/BetterI18nTextCollectorTask?targetlocale=de,en&module=mysite&flush=1
  • 使用sake/cli:sake dev/tasks/BetterI18nTextCollectorTask flush=1
  • 使用sake/cli:sake dev/tasks/BetterI18nTextCollectorTask "targetlocale=de,en&module=mysite&flush=1"

警告:运行BetterI18nTextCollectorTask将覆盖您的现有lang文件。它将合并文件中的现有实体,但会删除未使用的实体。

许可证

Copyright (c) 2015, Zauberfisch
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
	* Redistributions of source code must retain the above copyright
	  notice, this list of conditions and the following disclaimer.
	* Redistributions in binary form must reproduce the above copyright
	  notice, this list of conditions and the following disclaimer in the
	  documentation and/or other materials provided with the distribution.
	* Neither the name Zauberfisch nor the names of other contributors may 
	  be used to endorse or promote products derived from this software 
	  without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.