Skip to content

Commit 6ba6155

Browse files
committed
docs: update readme, bump PHP version to 7.4
Updated the readme file to mirror the PHP version requirement from composer.json BREAKING CHANGE: Required/supported PHP version is now 7.4.
1 parent 8ef3dab commit 6ba6155

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,24 @@ Implementation of context functions for the PHP gettext extension
1212
PHP still lacks full support for gettext, because it does not implement the context functions.
1313
Until this is sorted out, you can use this package to add context support to your localization efforts.
1414

15+
For example, in English, both persons and products have a "name" attribute.
16+
So using a simple gettext:
17+
18+
```php
19+
echo _('Name');
20+
```
21+
22+
... would yield "Ime" in Slovenian, which is wrong.
23+
24+
To solve this, you can use a context function provided by this package:
25+
26+
```php
27+
echo pgettext('Person', 'Name'); // Echoes "Ime"
28+
echo pgettext('Product', 'Name'); // Echoes "Naziv"
29+
```
30+
1531
## Requirements
16-
- PHP >= 7.2
32+
- PHP >= 7.4
1733
- gettext PHP extension
1834

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

0 commit comments

Comments
 (0)