2017 © Pedro Peláez
 

library lang

Lightweight library for easy translation based on simple formats (php arrays, json, yml, ini)

image

jbzoo/lang

Lightweight library for easy translation based on simple formats (php arrays, json, yml, ini)

  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

JBZoo Lang Build Status Coverage Status

Lightweight library for easy translation based on simple formats (php arrays, json, yml, ini), (*1)

License Latest Stable Version Scrutinizer Code Quality, (*2)

Install

composer require jbzoo/lang:"1.x-dev"  # Last version
composer require jbzoo/lang            # Stable version

Usage

require_once './vendor/autoload.php'; // composer autoload.php

// Get needed classes
use JBZoo\Lang\Lang;

// Create
$lang = new Lang('en');                             // Pass language code (only two chars!)

// Paths, modules, overload
$lang->load('./somepath/glob/');                    // ./somepath/glob/langs/en.php
$lang->load('./somepath/glob/', 'module_name');     // ./somepath/glob/langs/en.module_name.php
$lang->load('./somepath/module/', 'module_name');   // ./somepath/module/langs/en.module_name.php (overload previous)

// Other formats
$lang->load('./somepath/glob/', null, 'php');   // ./somepath/glob/langs/en.php
$lang->load('./somepath/glob/', null, 'json');  // ./somepath/glob/langs/en.json
$lang->load('./somepath/glob/', null, 'ini');   // ./somepath/glob/langs/en.ini
$lang->load('./somepath/glob/', null, 'yml');   // ./somepath/glob/langs/en.yml  (Symfony/Yaml)

// Traslate
$lang->translate('message_key');                // Only global
$lang->translate('module_name.message_key');    // Check module "module_name" and after that global path

Speed of one(!) call method translate()

PHP 5.6.x - Minimum time ~0.05ms, (*3)

PHP 7.0.x - Minimum time ~0.004ms, (*4)

Unit tests and check code style

make
make test-all

License

MIT, (*5)

The Versions

01/08 2016

dev-master

9999999-dev

Lightweight library for easy translation based on simple formats (php arrays, json, yml, ini)

  Sources   Download

MIT

The Requires

 

The Development Requires

language translation locale lang localisation jbzoo

01/08 2016

dev-develop

dev-develop

Lightweight library for easy translation based on simple formats (php arrays, json, yml, ini)

  Sources   Download

MIT

The Requires

 

The Development Requires

language translation locale lang localisation jbzoo

22/02 2016

1.0.1

1.0.1.0

Lightweight library for easy translation based on simple formats (php arrays, json, yml, ini)

  Sources   Download

MIT

The Requires

 

The Development Requires

language translation locale lang localisation jbzoo

22/02 2016

1.0.0

1.0.0.0

Lightweight library for easy translation based on simple formats (php arrays, json, yml, ini)

  Sources   Download

MIT

The Requires

 

The Development Requires

language translation locale lang localisation jbzoo