php-gettext / Gettext

PHP library to collect and manipulate gettext (.po, .mo, .php, .json, etc)
MIT License
688 stars 134 forks source link

Make use of msgctxt #279

Open limogin opened 2 years ago

limogin commented 2 years ago

It is possible to make use of msgctxt context into the .po file definition? There is no clear method from native functions to get the translation of a context either. Or I haven't found.

The method Translattion::withContext ($s) { .. } / Translation:getContext ($s) { .. } would meet this?

Thanks,

oscarotero commented 2 years ago

Not sure to understand your question. If you mean PHP native gettext extension, the context is not supported, but you can see here how it's emulated in the translator functions of this library: https://github.com/php-gettext/Translator/blob/master/src/GettextTranslator.php#L80