Download the PHP package atelierspierrot/internationalization without Composer
On this page you can find all versions of the php package atelierspierrot/internationalization. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download atelierspierrot/internationalization
More information about atelierspierrot/internationalization
Files in atelierspierrot/internationalization
Package internationalization
Short Description A PHP package to manage i18n: translations, pluralization and date formats according to a localization.
License Apache-2.0
Homepage http://github.com/atelierspierrot/internationalization
Informations about the package internationalization
Internationalization
A PHP package to manage i18n: translations, pluralization, date and number formatting according to a localization.
Usage
Object creation and PHP usage
To create a new I18n instance, you need to pass it a I18n\Loader
object:
For a full list of possible Loader options, please have a look in source code.
Any option value defining a directory path or a filename construction can contains a %s
tag that will be replaced by the current language.
As you can see, the I18n class is defined as a Singleton object: any future call of
\I18n\I18n::getInstance()
will refer to the first created object instance.
Then, to actually use the translated value of a string, use the translate
method:
You can use the pluralize
method to choose a translated string depending on a number of items:
Translation strings definition
By default (this can be over-write in the Loader), the I18n object will load the strings defined as a PHP array like:
This may be defined in a file called i18n.CODE.php
where CODE
is the two letter reference
of the language. These files will be searched and loaded from the language_directory
loader
option value.
Load multiple language files
The I18n object is designed to be able to load multiple language files easily with:
Each file loaded is stored in the internal cache system of the object (a simple PHP array).
Package aliases
A set of aliases functions, defined in the global namespace, are available and auto-loaded by Composer:
Extensions
The package embeds an extension to use the class in the Twig template engine. See the Twig Extension page for more infos.
Installation
For a complete information about how to install this package and load its namespace, please have a look at our USAGE documentation.
If you are a Composer user, just add the package to the
requirements of your project's composer.json
manifest file:
You can use a specific release or the latest release of a major version using the appropriate version constraint.
Please note that this package depends on the externals PHP Patterns and PHP Library.
Author & License
Internationalization
http://github.com/atelierspierrot/internationalization
Copyright (c) 2010-2016, Pierre Cassat and contributors
Licensed under the Apache 2.0 license.
http://www.apache.org/licenses/LICENSE-2.0
Les Ateliers Pierrot - Paris, France
All versions of internationalization with dependencies
atelierspierrot/patterns Version 1.*
atelierspierrot/library Version 1.*