jackjoe / yaml-translation
Add YAML file support to Laravel TranslationServiceProvider, fork of devitek/yaml-translation
Installs: 24 244
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 17
Open Issues: 0
Requires
- php: ^7.1
- illuminate/translation: ^6.0
- symfony/yaml: ^4.0
README
Add Yaml file support for Laravel 5 TranslationServiceProvider
This package uses Symfony/Yaml parser, and is forked from Devitek/laravel-yaml-translation
Installation
Composer
Add Laravel Localization to your composer.json
file.
"jackjoe/yaml-translation": "*"
Run composer install
to get the latest version of the package.
Manually
It's recommended that you use Composer, however you can download and install from this repository.
Add support in Laravel
You have to replace
'Illuminate\Translation\TranslationServiceProvider',
with
'JackJoe\Core\Translation\TranslationServiceProvider',
in config/app.php
.
How to use
Instead of using the regular php files to input your translation, use yml or yaml files instead.
PHP:
<?php return [ 'hello' => 'Hello :name', 'author' => 'Devitek', ];
Will in YAML be equivalent to:
hello: Hello :name author: Jack + Joe
A more complex example:
title: My Website copyright: | 2015 © team: - name: Foo age: 18 - name: Bar age: 20
Important!
When you want to use the yaml
files, be sure to delete the php
files!
License
Copyright © 2019 Jack + Joe. This is free software, and may be redistributed under the terms specified in the LICENSE file.