定制 willskates/translator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

willskates/translator

Composer 安装命令:

composer require willskates/translator

包简介

Translator is a very simple string translation library for PHP.

README 文档

README

Translator is a very simple string translation library for PHP.

Build

Build Status

How To Install.

The best way to install Translator is through composer.

{
    "require": {
        "willskates/translator": "1.1.0"
    }
}

Usage.

Creating the Translator Object

$translator = new Translator();

Setting a Translation.

$translator->useTranslation('Hello', 'Hallo');

Getting a Translation.

$hello = $translator->translate('Hello');
//The value of $hello is 'Hallo'.

Setting a list of translations.

$translator->useTranslations(
    [
        'Hello' => 'Hallo',
        'Goodbye' => 'auf Wiedersehen'
    ]
);

Getting a list of translations.

$german = $translator->translations();

//$german is an array, assuming they were set it will contain ['Hello' => 'Hallo', 'Goodbye' => 'auf Wiedersehen'].

Setting and using the default language.

$deTranslator = new Translator();

$deTranslator->useTranslations(
    [
        'Hello' => 'Hallo',
        'Goodbye' => 'auf Wiedersehen'
    ]
);

$hello = $deTranslator->translate('Hello'); //Hallo
$goodbye = $deTranslator->translate('Goodbye'); //auf Wiedersehen

$broTranslator = new Translator();

$broTranslator->useTranslations(
    [
        'Hello' => 'Yo',
        'Goodbye' => 'Piece!'
    ]
);

$hello = $broTranslator->translate('Hello'); //Yo
$goodbye = $broTranslator->translate('Goodbye'); //Piece!

统计信息

  • 总下载量: 18
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-06-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固