herrera-io/silex-translation-files

此包已被 放弃 并不再维护。没有建议的替代包。

一个用于使用翻译文件的 Silex 服务提供者。

1.1.0 2013-08-15 20:25 UTC

This package is not auto-updated.

Last update: 2021-12-07 01:37:24 UTC


README

Build Status

这是一个 Silex 服务提供者,它扩展了现有的翻译服务,以便更容易地支持翻译文件的使用。您可以将加载器、文件和地区都指定为参数。

示例

use Herrera\Silex\Provider\TranslationServiceProvider;
use Silex\Application;

$app = new Application();

$app->register(
    new TranslationServiceProvider(),
    array(
        'translation.files' => array(
            'Symfony\\Component\\Translation\\Loader\\YamlFileLoader' => array(
                '/path/to/file.de.yml' => 'de',
                '/path/to/file.en.yml' => 'en',
                '/path/to/file.fr.yml' => 'fr'
            )
        )
    )
);

$translated = $app['translator']->trans($key);

安装

使用 Composer

$ composer.phar require "herrera-io/silex-translation-files=~1.0"