A simple language abstraction to simply keep copy out of your code. This is NOT a translation library.
Add jaeger-app/language
as a requirement to your composer.json
:
$ composer require jaeger-app/language
To get started with JaegerApp\Language
you pass system paths to directories containing language files which are used for a simple replacement.
$lang = new Language;
$lang_path = '/path/to/language/files';
$lang->init($lang_path);
echo $lang->__('backup_success_message');
You can also pass an array of paths to the constructor to bulk load language files
$paths = array(
'/path/to/language1',
'/path/to/language2',
'/path/to/language3'
);
$lang = new Language($paths);
The language files are a simple key => value array called $lang
$lang = array(
'backup_success_message' => 'Backup Complete!',
'backup_fail_message' => 'Backup Failed...',
);
You can store multiple language files in the same directory as well as add multiple directories so keeping content organized shouldn't hurt too much.