定制 borges/localization 二次开发

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

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

borges/localization

Composer 安装命令:

composer require borges/localization

包简介

Easy i18n localization for Laravel 4.

README 文档

README

Easy i18n localization for Laravel 4.

Instalation

In app/config/app.php, replace the following entry from the providers key:

'Illuminate\Translation\TranslationServiceProvider',

with:

'Borges\Localization\LocalizationServiceProvider',

and add the next facade in the aliases key:

'Locale'          => 'Borges\Localization\Facades\Locale',

You may publish the package's configuration if you so choose, using artisan CLI:

php artisan config:publish borges/localization

Usage

Translation

This translations package is designed to adapt to your workflow. Translations are accessed just like in Laravel, with replacements and pluralization working as expected. The only difference is that languages ​​can be inherited.

Example

app/en/app.php

return array(
    'color'     => 'Colour',
    'hello'     => 'Hello',
    'welcome'   => 'Welcome',
    'another-string' => 'Another String'
);

app/en-US/app.php

return array(
    'color'     => 'Color'
);

app/pt/app.php

return array(
    'color'     => 'Cor',
    'hello'     => 'Olá',
    'welcome'   => 'Bem-vindo'
);
App::setLocale('en');
echo Lang::get('app.welcome');  # prints 'Welcome'
echo Lang::get('app.color');  # prints 'Colour'
echo Lang::get('app.hello');  # prints 'Hello'

App::setLocale('en-US');
echo Lang::get('app.welcome');  # prints 'Welcome'
echo Lang::get('app.color');  # prints 'Color'
echo Lang::get('app.hello');  # prints 'Hello'

App::setLocale('pt');
echo Lang::get('app.welcome');  # prints 'Bem-vindo'
echo Lang::get('app.color');  # prints 'Cor'
echo Lang::get('app.hello');  # prints 'Olá'

echo Lang::get('another-string');  # prints 'Another String' if 'useDefault' is true or else prints 'another-string'

Another resources (dates, numbers, ...)

This package provides a local resource formatter for dates and numbers.

Example

App::setLocale('en');
echo Locale::number(1234567.890); # prints '1, 234, 567.89'
echo Locale::int(1234567.890); # prints '1, 234, 568'
echo Locale::date(Carbon\Carbon::now()); # prints 'Tuesday, December 17, 2013'

App::setLocale('en-US');
echo Locale::number(1234567.890); # prints '1, 234, 567.89'
echo Locale::int(1234567.890); # prints '1, 234, 568'
echo Locale::date(Carbon\Carbon::now()); # prints 'Tuesday, December 17, 2013'

App::setLocale('pt');
echo Locale::number(1234567.890); # prints '1 234 567,89'
echo Locale::int(1234567.890); # prints '1 234 568'
echo Locale::date(Carbon\Carbon::now()); # prints '17 de Dezembro de 2013'

Helpers

This package provides a collection of helpers functions. See helpers.php.

Changelog

v0.1.0 (17-12-2013)

  • Initial release

Support or Contact

If you have any questions or found any bug, please contact me via twitter or github issues system.

Support via PayPal

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-12-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固