Download the PHP package clusteramaryllis/gettext without Composer
On this page you can find all versions of the php package clusteramaryllis/gettext. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download clusteramaryllis/gettext
More information about clusteramaryllis/gettext
Files in clusteramaryllis/gettext
Package gettext
Short Description Adds localization support to laravel applications with PoEdit and Gettext
License GPL-2.0
Informations about the package gettext
laravel-gettext
Installation
Laravel 5.2 Installation
Add the composer repository to your composer.json file:
- For Laravel 5.1, checkout 1.2 branch
- For Laravel 4.2, checkout 0.3 branch
And run composer update
. Once finished, register via service provider in config/app.php
in the providers
array:
You can also provide static syntax via facade in the aliases
array:
Publish the configuration file (optional) (will create on config/gettext.php
) :
Command
Available commands
gettext:create
=> Generate new .po file
gettext:update
=> Update existing .po file
Available options
Check with php artisan gettext:create --help
or php artisan gettext:update --help
Example
This will generate .po files in resources/locale/en_US/LC_MESSAGES/messages.po
& will scan any string that utilize php-gettext function on app/Http/Controllers
& resources/views
Once done, you can easily translate your application using tools such as PoEdit.
How To
Simple usage
1) Prepare view
with strings wrapped with Gettext
method or helper
2) Add your language preferences via config/gettext.php
on languages array
3) Run php artisan gettext:create
. This will generate .po file in
& ready to scan translated string in app\Http\Controllers
& resources\views
(Default option).
4) Open the .po file with PoEdit or any similar editors. In PoEdit you need to click update to populate the table with the scanned strings. After that, you can start begin translating.
5) Simple routes test
Available methods
Methods | Helper shortcut |
---|---|
Gettext::setLocale | _setlocale |
Gettext::bindTextDomain | _bindtextdomain |
Gettext::bindTextDomainCodeset | _bind_text_domain_codeset |
Gettext::textDomain | _textdomain |
Gettext::getText | __ |
Gettext::nGetText | _n |
Gettext::dGetText | _d |
Gettext::dNGetText | _dn |
Gettext::dCGetText | _dc |
Gettext::dCNGetText | _dcn |
Gettext::pGetText | _p |
Gettext::dPGetText | _dp |
Gettext::dCPGetText | _dcp |
Gettext::nPGetText | _np |
Gettext::dNPGetText | _dnp |
Gettext::dCNPGetText | _dcnp |
More detailed method & their parameters can be seen here.
Acknowledgements
This package is inspired by laravel-gettext by Nicolás Daniel Palumbo for .po files creation & utilize php-gettext package by Danilo Segan.