sinergi/dictionary

PHP 字典库

0.4.0 2015-05-11 20:00 UTC

This package is not auto-updated.

Last update: 2024-09-14 14:40:05 UTC


README

Build Status Latest Stable Version Total Downloads License

PHP 的本地化和文本管理库。

要求

此库使用 PHP 5.4+。

安装

建议您通过 composer 安装 Dictionary 库 (点击此处访问 composer)。为此,请将以下行添加到您的 composer.json 文件中。

{
    "require": {
       "sinergi/dictionary": "dev-master"
    }
}

用法

使用您文本文件的路径设置 Dictionary 类

use Sinergi\Dictionary\Dictionary;

$language = 'en';
$directory = __DIR__ . "/examples";

$dictionary = new Dictionary(
    $language,
    $directory
);

然后您可以像这样使用字典

$dictionary['example']['title'];

示例

更多示例请参阅 示例文件夹

字典文件示例

return [
    'title' => "This is an example"
];