jshmrtn / vue3-gettext

Translate Vue 3 applications with gettext.
https://jshmrtn.github.io/vue3-gettext/
MIT License
70 stars 24 forks source link

`context` not available in `$gettext` #27

Closed simensol closed 2 years ago

simensol commented 2 years ago

Why isn't context available in $gettext, while it's available as the first argument of $pgettext?

lzurbriggen commented 2 years ago

Hi @simensol, I'm not sure I understand. The $gettext function is for common/"global" translations and $pgettext is made specifically to work with a message context to be able to translate the same message differently depending on where in your application it is used. So if you need a context, you just use $pgettext instead of $gettext (the function names and signatures are inspired by the GNU gettext utilities).

simensol commented 2 years ago

I thought $gettext wasn't able to interpolate, and that I had to use $pgettext for interpolation. My wrong!