2017 © Pedro Peláez
 

library yaml-translation

Add YAML file support to Laravel TranslationServiceProvider

image

kaishiyoku/yaml-translation

Add YAML file support to Laravel TranslationServiceProvider

  • Thursday, May 10, 2018
  • by Kaishiyoku
  • Repository
  • 1 Watchers
  • 1 Stars
  • 611 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 16 Forks
  • 1 Open issues
  • 10 Versions
  • 31 % Grown

The README.md

Maintenance Packagist Packagist, (*1)

Add Yaml file support for Laravel >=5.4 TranslationServiceProvider

This package uses Symfony/Yaml parser. Note: This is a fork from the orignal version of Devitek: https://github.com/Devitek/laravel-yaml-translation, (*2)

Please note

Laravel =>5.4 only support for coming =>5.4.* releases. If you still want to use this package with an older Laravel version use an older release., (*3)

The last release with Laravel <= 5.3.* support is 5.0.1, (*4)

Please note: As with version 5.5.1 this package is using Symfony Yaml Parser v3.* and therefore the YAML format has been changed a bit - you now have to escape lines with quotes (either double or single ones) when there are special keys present like a colon, otherwise you'll get an error like this: A colon cannot be used in an unquoted mapping value at line [...]. I have slightly changed the example below to demonstrate the changes., (*5)

Installing

Add "kaishiyoku/yaml-translation": "5.*" to your composer.json by running php composer.phar require kaishiyoku/yaml-translation, (*6)

Add support in Laravel

Replace 'Illuminate\Translation\TranslationServiceProvider', with 'Kaishiyoku\Core\Translation\TranslationServiceProvider', in app/config/app.php., (*7)

How to use

Just use regular php files or use yml or yaml files instead. In order to use Yaml your localization files must end with *.yml.php, *.yaml.php, *.yml or *.yaml, (*8)

Example

PHP:, (*9)

<?php

return [
  'hello' => 'Hello :name',
  'author' => 'Kaishiyoku',
  'messages' => [
    'none' => 'No messages'
  ]
];

Will be equivalent to :, (*10)

YAML:, (*11)

hello: 'Hello :name' # must now be escaped with quotes
author: Kaishiyoku
messages:
  none: 'No messages'

Please note: The Symfony Yaml parser expects <space> indentation, using <tab> indentations will cause an exception., (*12)

If you have any issues feel free to open a ticket :), (*13)

Author

Twitter: @kaishiyoku
Website: www.andreas-wiedel.de, (*14)

The Versions

10/05 2018

dev-master

9999999-dev

Add YAML file support to Laravel TranslationServiceProvider

  Sources   Download

MIT

The Requires

 

by Avatar Kaishiyoku

10/05 2018

5.6.0

5.6.0.0

Add YAML file support to Laravel TranslationServiceProvider

  Sources   Download

MIT

The Requires

 

by Avatar Kaishiyoku

01/09 2017

5.5.1

5.5.1.0

Add YAML file support to Laravel TranslationServiceProvider

  Sources   Download

MIT

The Requires

 

by Avatar Kaishiyoku

01/09 2017

5.5.0

5.5.0.0

Add YAML file support to Laravel TranslationServiceProvider

  Sources   Download

MIT

The Requires

 

by Avatar Kaishiyoku

29/01 2017

5.4.1

5.4.1.0

Add YAML file support to Laravel TranslationServiceProvider

  Sources   Download

MIT

The Requires

 

by Avatar Kaishiyoku

29/01 2017

5.4.0

5.4.0.0

Add YAML file support to Laravel TranslationServiceProvider

  Sources   Download

MIT

The Requires

 

by Avatar Kaishiyoku

29/01 2017

5.0.1

5.0.1.0

Add YAML file support to Laravel TranslationServiceProvider

  Sources   Download

MIT

The Requires

 

by Avatar Kaishiyoku

13/08 2015

5.0.0

5.0.0.0

Add YAML file support to Laravel TranslationServiceProvider

  Sources   Download

MIT

The Requires

 

by Avatar Kaishiyoku

02/05 2014

0.2.0

0.2.0.0

Add YAML file support to Laravel TranslationServiceProvider

  Sources   Download

MIT

The Requires

 

by Avatar Kaishiyoku

01/05 2014

0.1

0.1.0.0

Add YAML file support to Laravel TranslationServiceProvider

  Sources   Download

The Requires

 

by Thomas SIEFFERT