Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 4 months ago
JSON representation

Use gettext with CodeIgniter 4 more easily

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.

[![PHPUnit](https://github.com/michalsn/codeigniter-gettext/actions/workflows/phpunit.yml/badge.svg)](https://github.com/michalsn/codeigniter-gettext/actions/workflows/phpunit.yml)
[![PHPStan](https://github.com/michalsn/codeigniter-gettext/actions/workflows/phpstan.yml/badge.svg)](https://github.com/michalsn/codeigniter-gettext/actions/workflows/phpstan.yml)
[![Deptrac](https://github.com/michalsn/codeigniter-gettext/actions/workflows/deptrac.yml/badge.svg)](https://github.com/michalsn/codeigniter-gettext/actions/workflows/deptrac.yml)

![PHP](https://img.shields.io/badge/PHP-%5E8.0-blue)
![CodeIgniter](https://img.shields.io/badge/CodeIgniter-%5E4.3-blue)

### 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');

```