helionogueir/languagepack

用于操作语言包的库

v1.1.0 2016-12-09 15:11 UTC

This package is not auto-updated.

Last update: 2024-09-23 13:09:57 UTC


README

用于操作语言包的库。

安装

Composer (https://getcomposer.org.cn/) 和 (https://packagist.org.cn/)

composer require helionogueir/languagepack

用法

helionogueir\languagepack\Lang

定义如何使语言包工作

use helionogueir\languagepack\Lang;
Lang::configuration("en-US");
Lang::addRoot("helionogueir/languagepack", "./languagepack/core");
echo Lang::get("languagepack:test:get", "helionogueir/languagepack", Array("method" => "Usage"));

smarty_modifier_languagepack_lang

Smarty 修饰符 (https://smarty.php.ac.cn/docs/en/plugins.modifiers.tpl) 和 (https://smarty.php.ac.cn/)

定义如何使 smarty_modifier_languagepack_lang 工作

/* Configuration Smarty */
use Smarty;
$smarty = new Smarty();
$smarty->addPluginsDir("./languagepack/core/modifier");
/* Template (.tpl) smarty_modifier_languagepack_lang Called  */
<p>{"languagepack:test:get"|languagepack_lang:"helionogueir/languagepack":["method" => "Usage"]}</p>

测试驱动开发 (TDD)

PHPUnit (https://phpunit.de/)

phpunit -c ./languagepack/tests/unit.xml