2017 © Pedro Peláez
 

library glottos

A PHP 5.3+ Online Translation/Localization System

image

pragmarx/glottos

A PHP 5.3+ Online Translation/Localization System

  • Tuesday, January 31, 2017
  • by AntonioCarlosRibeiro
  • Repository
  • 5 Watchers
  • 71 Stars
  • 237 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 1 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Glottos

Latest Stable Version Build Status, (*1)

An Online Translation/Localization System for Laravel Web Artisans

A quick overview of what you are able to do with it:, (*2)


// Use the Facade to set a locale Glottos::setLocale('pt_BR'); // And just use it Glottos::translate('Laravel is a PHP Framework'); // There's a helper g('Laravel is a PHP Framework'); // Choose a particular locale Glottos::translate('Laravel is a PHP Framework', 'pt_BR') // or Glottos::translate('Laravel is a PHP Framework', 'pt-br') // Glottos let you choose between keys and natural language: Glottos::translate('key::home.describe.laravel') Glottos::translate('natural::Laravel is a PHP Framework') // or you can just define your default as natural and use: Glottos::translate('Laravel is a PHP Framework') // It will break your paragraphs in sentences Glottos::translate('Laravel is a PHP Framework. Laravel was written by Taylor Otwell.') // To not repeat itself, it will store those two sentences in your database: 'Laravel is a PHP Framework' 'Laravel was written by Taylor Otwell' // Removing punctuation and special chars. // With a simple blade trick Blade::extend(function ($view) { return preg_replace( '/{{\'((.|\s)*?)\'}}/', '<?php echo Glottos::translate("$1"); ?>', $view ); }); // You can use it beautifully in your Views:

{{'Laravel is a PHP Framework'}}, (*3)

// You can still use the Lang Facade, Glottos has a compatible one Lang::trans('Photography') // And use choice Lang::choice('Photography|Photographies', 100, array(), 'pt_BR') Glottos::choice('Photography|Photographies', 100, array(), 'pt_BR') // And dozens of other features, like importing your current language files

The idea behind this package is very simple: you need your web app to become multi-language fast so you better translate it all online, with some help from co-workers or the community., (*4)

Schema

Basically Glottos will create and sometimes populate a bunch of tables for, (*5)

  • Countries - 127
  • Languages - 129
  • Locales - 323 - Each one with its proper regional language name
  • Messages - (is stores hashes of the primary message)
  • Translations - one row for each message x locale

Here's a view of how Laravel's messages are stored in the Admin site:, (*6)

Laravel site messages in Glottos, (*7)

Installation

Requirements

  • Any flavour of PHP 5.3.7+ should do
  • [optional] PHPUnit to execute the test suite

Frameworks

Since Glottos depends on data layer it is a Laravel 4.x ready package, but it was coded to be as much agnostic as possible, so you can create new drivers and use it on your own frameworks. You can even send me PRs to add them to the main code., (*8)

With Composer

composer require pragmarx/glottos dev-master, (*9)

Once this operation completes, add the service provider to your app/config/app.php:, (*10)

'PragmaRX\Glottos\Vendor\Laravel\ServiceProvider',

Migrate Glottos tables:, (*11)

php artisan migrate --package=pragmarx/glottos

Import your current language files:, (*12)

php artisan glottos:import

And you should be good to go. Enjoy!, (*13)

, (*14)

TODO

  • Add a real cache layer to it.
  • Add more frameworks and data access drivers.

Author

Antonio Carlos Ribeiro - acr@antoniocarlosribeiro.com - http://twitter.com/iantonioribeiro, (*15)

, (*16)

License

Glottos is licensed under the MIT License - see the LICENSE file for details, (*17)

Contributing

Pull requests and issues are more than welcome., (*18)

The Versions

31/01 2017

dev-master

9999999-dev

A PHP 5.3+ Online Translation/Localization System

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

laravel translation localization

31/01 2017

v1.5.3

1.5.3.0

A PHP 5.3+ Online Translation/Localization System

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

laravel translation localization

18/08 2016

v1.5.2

1.5.2.0

A PHP 5.3+ Online Translation/Localization System

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

laravel translation localization

14/09 2015

v1.5.1

1.5.1.0

A PHP 5.3+ Online Translation/Localization System

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

laravel translation localization

21/02 2015

dev-laravel5

dev-laravel5

A PHP 5.3+ Online Translation/Localization System

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

laravel translation localization

21/02 2015

v1.5.0

1.5.0.0

A PHP 5.3+ Online Translation/Localization System

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

laravel translation localization

05/12 2013

v1.0.0

1.0.0.0

An PHP 5.3+ Online Translation/Localization System

  Sources   Download

MIT

The Requires

 

The Development Requires

by eRobin

laravel translation localization