michalsn / codeigniter-gettext
Gettext support for the CodeIgniter 4 framework
v1.0.0
2023-07-23 10:32 UTC
Requires
- php: ^8.0
Requires (Dev)
- ext-gettext: *
- codeigniter4/devkit: ^1.0
- codeigniter4/framework: ^4.2
- rector/rector: 0.17.6
This package is auto-updated.
Last update: 2024-11-06 10:38:37 UTC
README
This library gives users the ability to use gettext more friendly way.
Installation
Composer
composer require michalsn/codeigniter-gettext
Manually
In the example below we will assume, that files from this project will be located in app/ThirdParty/gettext
directory.
Download this project and then enable it by editing the app/Config/Autoload.php
file and adding the Michalsn\CodeIgniterGettext
namespace to the $psr4
array, like in the below example:
<?php namespace Config; use CodeIgniter\Config\AutoloadConfig; class Autoload extends AutoloadConfig { // ... public $psr4 = [ APP_NAMESPACE => APPPATH, // For custom app namespace 'Config' => APPPATH . 'Config', 'Michalsn\CodeIgniterGettext' => APPPATH . 'ThirdParty/gettext/src', ]; // ...
Example
service('gettext')->setLocale('pl'); echo _('Hello');