Skip to content

Commit

Permalink
docs: update readme, bump PHP version to 7.4
Browse files Browse the repository at this point in the history
Updated the readme file to mirror the PHP version requirement from composer.json

BREAKING CHANGE: Required/supported PHP version is now 7.4.
  • Loading branch information
SlimDeluxe committed Jan 28, 2023
1 parent 8ef3dab commit 6ba6155
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,24 @@ Implementation of context functions for the PHP gettext extension
PHP still lacks full support for gettext, because it does not implement the context functions.
Until this is sorted out, you can use this package to add context support to your localization efforts.

For example, in English, both persons and products have a "name" attribute.
So using a simple gettext:

```php
echo _('Name');
```

... would yield "Ime" in Slovenian, which is wrong.

To solve this, you can use a context function provided by this package:

```php
echo pgettext('Person', 'Name'); // Echoes "Ime"
echo pgettext('Product', 'Name'); // Echoes "Naziv"
```

## Requirements
- PHP >= 7.2
- PHP >= 7.4
- gettext PHP extension

It can be used on lower versions of PHP, but you won't be able to install it with composer (or run tests).
Expand Down

0 comments on commit 6ba6155

Please sign in to comment.