t() in attributes when installing packages
Permalink
I have a doubt about the use of t() in attributes like "package description", "group names" and so on. As far as I know, we must always use t(), but I have realized that it does not work when you are installing package.
For example:
When you install the package (and you are using Japanese profile, for instance) Concrete5 always saves the non-translated name attribute in the database, even though you use t() in the "install()" function. When you browse the add-ons panel then you can see the text translated to Japanese.
I removed t() in the installation procedure and try again. Same result. Obviously, no translated text to the DB but when you display this data to the view and use t(), it works!
The point is: Why using t() is mandatory when you are installing the package? It does not work, and it should not, because if Concrete translates strings to the DB and then you change your language, Concrete won't be able to translate it again.
For example:
public function getPackageDescription() { return t('A brief description of my package'); //this string is translated to Japanese too in the messages.mo }
When you install the package (and you are using Japanese profile, for instance) Concrete5 always saves the non-translated name attribute in the database, even though you use t() in the "install()" function. When you browse the add-ons panel then you can see the text translated to Japanese.
I removed t() in the installation procedure and try again. Same result. Obviously, no translated text to the DB but when you display this data to the view and use t(), it works!
The point is: Why using t() is mandatory when you are installing the package? It does not work, and it should not, because if Concrete translates strings to the DB and then you change your language, Concrete won't be able to translate it again.