dev-master
9999999-dev https://github.com/dees040/locaLocalization class for easy translation management.
MIT
by Dees Oomens
locale localization loca
Wallogit.com
2017 © Pedro Peláez
Localization class for easy translation management.
README will be fully filled after development of the class., (*1)
Created a class for handling translations. I though maybe somebody finds this useful., (*2)
Install the latest version using composer:, (*3)
composer require dees040/loca
Make sure you require the autoload., (*4)
Use Loca::prepare() to configure the class., (*5)
prepare() takes one argument which is an array., (*6)
Options:, (*7)
Example:, (*8)
Loca::prepare([
'locale' => 'fr',
'fallbackLocale' => 'en',
'langDir' => '/var/www/Loca/resources/languages',
]);
Language strings are stored in files within the specified directory. Within this directory there should be a subdirectory for each language supported by the application:, (*9)
/languageDirectory
/en
app.php
/fr
app.php
All language files simply return an array of keyed strings. For example:, (*10)
<?php return [ 'welcome' => 'Welcome to our application.' ];
At this moment you can call a translation:, (*11)
Loca::translate('app.welcome');
Which outputs: Welcome to our application., (*12)
None, (*13)
Localization class for easy translation management.
MIT
locale localization loca