I have started using gettext for translating text and messages i send to user. I am using poedit as an editor, but i am struggling with dynamic messages.
For example i have things like the login where i have a variable that tells the type of error.
$this->translate('page-error-' . $error);
When i auto update from poedit this gets read like "page-error-". What i do is have a file where i place dummy calls to the translate method with all the possible keys to have them added in my poedit when auto updating.
I don't particularly like this situation. How do you guys do it.
Thanks for your ideas
No -- this is not possible, because the editor (and the gettext
tools) are reading your sources, not executing your program. You'll have to keep the dummy calls or add the keys to the translation files yourself.
Are you trying something like
$this->translate(sprintf('page-error-%s', $error));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With