定制 folklore/locale 二次开发

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

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

folklore/locale

最新稳定版本:v8.0.6

Composer 安装命令:

composer create-project folklore/locale

包简介

Localization package for Laravel 5

README 文档

README

A simple localization package for Laravel 5. It provides URL detection, Route parameters, session storage, and view sharing.

Latest Stable Version Build Status Coverage Status Total Downloads

Installation

Dependencies:

Version prior to 3.0
Version 3.0 and up

Installation:

1- Require the package via Composer in your composer.json.

{
	"require": {
		"folklore/laravel-locale": "~3.0"
	}
}

2- Run Composer to install or update the new requirement.

$ composer install

or

$ composer update

3- Add the service provider to your app/config/app.php file

\Folklore\LaravelLocale\LocaleServiceProvider::class,

5- Publish the configuration file

$ php artisan vendor:publish --provider="Folklore\LaravelLocale\LocaleServiceProvider"

6- Review the configuration file

config/locale.php

Usage

Define route locale

You can specify the locale of a specific routes:

Route::get('/fr', [
  'as' => 'home.fr',
  'locale' => 'fr',
  function()
  {
    return view('home');
  }
]);

Auto-detection from URL

It is possible to let the package auto-detect the locale from the first part fo the URL.

Route::get('/fr/a-propos', [
  'as' => 'about.fr',
  function()
  {
    return view('home');
  }
]);

Be sure to add the supported locales in config/locale.php

View sharing

By default, this package shares two variables to every views $locale and $otherLocales. The $otherLocales variable is an array containing all the other locales than the current one.

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-11