File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,24 @@ Implementation of context functions for the PHP gettext extension
1212PHP still lacks full support for gettext, because it does not implement the context functions.
1313Until 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
1935It can be used on lower versions of PHP, but you won't be able to install it with composer (or run tests).
You can’t perform that action at this time.
0 commit comments