jaeger-app/language

This package is abandoned and no longer maintained. No replacement package was suggested.

A simple language abstraction to simply keep copy out of your code. This is NOT a translation library.

0.1.2 2016-11-30 09:32 UTC

This package is auto-updated.

Last update: 2023-11-18 01:26:01 UTC


README

Build Status Scrutinizer Code Quality Author GitHub license

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.