2017 © Pedro Peláez
 

class easy-lang

A simple PHP class for creating pages with multiple languages

image

puresoft/easy-lang

A simple PHP class for creating pages with multiple languages

  • Thursday, March 17, 2016
  • by jtag
  • Repository
  • 1 Watchers
  • 0 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

EasyLang

A simple PHP class for creating pages with multiple languages, (*1)

By using this class you can use multiple languages in PHP pages. Languages are saved in a UTF-8 .ini file and will load by their language short names. This class provided with Getters and Setters, so you can easily customize it., (*2)

Installation

You can simply download or clone this project or if you want, you can install EasyLang through composer: composer require puresoft/easy-lang, (*3)

Usage:

First include EasyLang file:, (*4)

require_once 'easylang.php';, (*5)

Then you should make a .ini file which can be found in languages folder of demo and name it as its language short name. For example we create a file with name of en.ini for English language., (*6)

Now we can make an object from EasyLang like this:, (*7)

$languages_path = 'languages/'; // Don't forget '/' at the end of path

$language_short_name = 'en';

$is_rtl = false; // Some languages are in right to left direction. This will be useful if we store this property in EasyLang for later use_

$translate = new EasyLang( $languages_path, $language_short_name, $is_rtl_ );

So, EasyLang will find a file with name of en.ini in languages folder., (*8)

Inside that .ini file we have a constant and a translate like this:, (*9)

MY_TITLE = "Here is my page Title", (*10)

Now we can use this constant like this:, (*11)

echo $translate->getTranslate( 'MY_TITLE' );, (*12)

Demo Script

There is an index.php in project that contains an example to show how to use EasyLang in your code., (*13)

The Versions

17/03 2016

dev-master

9999999-dev https://github.com/J-TAG/easy-lang

A simple PHP class for creating pages with multiple languages

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

language php easy i18n localization translate multi-language

17/03 2016

v2.1.1

2.1.1.0 https://github.com/J-TAG/easy-lang

A simple PHP class for creating pages with multiple languages

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

language php easy i18n localization translate multi-language

17/03 2016

v2.1

2.1.0.0 https://github.com/J-TAG/easy-lang

A simple PHP class for creating pages with multiple languages

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

language php easy i18n localization translate multi-language

13/03 2016

v2.0

2.0.0.0 https://github.com/J-TAG/easy-lang

A simple PHP class for creating pages with multiple languages

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

language php easy localization translate multi-language