jaeger-app / language
A simple language abstraction to simply keep copy out of your code. This is NOT a translation library.
Requires
- php: >=5.4.0
- jaeger-app/exceptions: ^0.1
- jaeger-app/log: ^0.1
Requires (Dev)
- phpunit/phpunit: 4.*
This package is auto-updated.
Last update: 2023-11-18 01:26:01 UTC
README
A simple language abstraction to simply keep copy out of your code. This is NOT a translation library.
Installation
Add jaeger-app/language
as a requirement to your composer.json
:
$ composer require jaeger-app/language
Simple Usage
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);
Language File Format
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.