nickdekruijk/translations 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

nickdekruijk/translations

最新稳定版本:3.0.4

Composer 安装命令:

composer require nickdekruijk/translations

包简介

A simple Translation trait to be used with Laravel Models

README 文档

README

Latest Stable Version Latest Unstable Version Monthly Downloads Total Downloads License

Translations

A simple Translation trait to be used with Laravel Models. When this trait is enabled on your model you can user $model->__('column') or $model->trans('column') to get the translated value for your current locale.

Installation

To install the package use

composer require nickdekruijk/translations

Configuration

If you don't like the default configuration options publish the config file and change the translations.php file in your Laravel app/config folder.

php artisan vendor:publish --tag=config --provider="NickDeKruijk\Translations\ServiceProvider"

Usage

First off all your database table must include all columns for the translations. For example if you have a table with a title and a description column you must add a title_nl and description_nl column if you want do support Dutch (nl) translations. Add this to the use section of your model: use NickDeKruijk\Translations\Translations; And add use Translations; after

class Story extends Model
{

Then you can use the trans or __ methods on your models. Like this: $story->trans('title') or $story->__('description')

License

Translations is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-04