thomasgenster/laravel-translator

此包最新版本(dev-master)没有提供许可证信息。

为Laravel提供自定义翻译器,允许在翻译中嵌入翻译

dev-master 2016-12-01 15:05 UTC

This package is not auto-updated.

Last update: 2024-09-23 13:26:43 UTC


README

为Laravel提供的自定义翻译器,避免了在翻译中需要使用传统占位符来获取翻译键的需求

将以下内容添加到你的 Providers 数组中(app/config/app.php)

Genster\CustomLaravelTranslator\TranslatorProvider

删除/取消注释默认提供者

Illuminate\Translation\TranslationServiceProvider

用法

使用 [[ ]] 作为占位符,将被对应的翻译键替换。

示例

lang/en/default.php

array(
    'hello world' => 'Please contact us at [[contact.phone]]',
)

lang/en/contact.php

array(
    'phone' => '+49 12345678'
)