Yea, I did lots of tests including checking that it loads the correct file, and loads the content into the variable, But i got to the point that the problem is with the regex that does not match anything inside the PO file. Which seems to be as a bug since the regex doesn’t work.
So the regex should be changed so that the context msgctxt is optional (enclosed in ( … )? in the regex) and the $matches index should be set appropriately…
PO file specification say that the msgctxt is optional… in Yii this is used for the context… so if you are using translations for different contexts than you should use the msgctxt on every record in this implementation as it is now…
A little bit off topc, but I’d change form gettext to simple arrays and use APC to keep those translation files in memory. This is a really heavy and time consuming regular expression you’d run many many times for each page request.