8.4.2 page names installed during package installation not translated
Permalink
I install pages during a package installation, the install():
however the page name 'My Page' does not get translated. If I change its name in the Site Map, then it gets translated. What's the problem? Does the translator work during installation?
Thank you.
however the page name 'My Page' does not get translated. If I change its name in the Site Map, then it gets translated. What's the problem? Does the translator work during installation?
Thank you.
You shouldn't wrap the page name in the t-function during *install*. Once the page is installed, it's outputted via the t-string, then it's translated.
Does anything get translated during install?
Would it matter? Say I install an add-on when logged in as a Spanish user, a pages could be added in Spanish. 'Bienvenido' wouldn't be found as a source language string (as opposed to 'Welcome'), for example.
It matters to the number of using the t(). If I wrap a string in t() during install which is then used 100 times throughout - this is 1 t(). Otherwise I have to use t() 100 times.
Yes, that's true. That's probably also why you'd find so many t-calls in the core. But if you translate it during install, then your base / source string might not be in English.
Well, thinking more about it, why does it matter at all where the t() is if translations are taken from the language file, not from the php. I guess the questions then should be why doesn't the translator pick up the page name translation AFTER installation?