https://github.com/michalsn/codeigniter-gettext
Use gettext with CodeIgniter 4 more easily
https://github.com/michalsn/codeigniter-gettext
codeigniter codeigniter4 gettext php php8
Last synced: 17 days ago
JSON representation
Use gettext with CodeIgniter 4 more easily
- Host: GitHub
- URL: https://github.com/michalsn/codeigniter-gettext
- Owner: michalsn
- License: mit
- Created: 2023-06-28T06:37:09.000Z (almost 2 years ago)
- Default Branch: develop
- Last Pushed: 2024-02-06T08:58:49.000Z (about 1 year ago)
- Last Synced: 2025-04-10T02:16:03.408Z (19 days ago)
- Topics: codeigniter, codeigniter4, gettext, php, php8
- Language: PHP
- Homepage:
- Size: 46.9 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CodeIgniter Gettext
This library gives users the ability to use [gettext](https://www.php.net/manual/en/book.gettext.php) more friendly way.
[](https://github.com/michalsn/codeigniter-gettext/actions/workflows/phpunit.yml)
[](https://github.com/michalsn/codeigniter-gettext/actions/workflows/phpstan.yml)
[](https://github.com/michalsn/codeigniter-gettext/actions/workflows/deptrac.yml)
### 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
APPPATH, // For custom app namespace
'Config' => APPPATH . 'Config',
'Michalsn\CodeIgniterGettext' => APPPATH . 'ThirdParty/gettext/src',
];// ...
```### Example
```php
service('gettext')->setLocale('pl');
echo _('Hello');
```