Download the PHP package wufr/php-language-localizer without Composer
On this page you can find all versions of the php package wufr/php-language-localizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wufr/php-language-localizer
More information about wufr/php-language-localizer
Files in wufr/php-language-localizer
Package php-language-localizer
Short Description Translate keys into text values based on set language
License MIT
Informations about the package php-language-localizer
PHP Language Translator / Localizer
Outputs translated text based on current language settings.
Text strings are stored in PHP files and these can be stored in subfolders for better maintaining.
Features:
- Translate keys into text values based on set language.
- Support for string replacement with parameters.
- Handle different translations based on a counter value.
- Easy to structure localization texts in a clean folder hierarchy.
Table of Contents
- Installation
- Quick Start
- Files Structure Example
- Usage
- Contributing
- License
Installation
To install the library, use Composer:
Note: This library requires PHP version 8.0 or higher.
Quick Start
Here is a quick example to get you started:
Files Structure Example
Example folder structure:
You can specify custom location for the "locales" folder, if you need to.
Example localization file:
Path to this file and name of the file itself is used in the locale() method. This way you can structure your localization texts in a nice clean structure with folders for different parts of the website, like "eshop", "user-area", "admin-panel" etc.
en_us/someFolder/testValues.php:
Usage
Simple String
String Based on "Amount" of Something
String with Replaceable Values
Combined with Counter
Important: the _counter
parameter is used only to decide which string is returned, not as a variable inside string. You need to add (in this case) count
in the parameters.
Contributing
To contribute, please create a new branch from the release-candidate
branch and submit a pull request.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.