It seems that the industry standard for PHP localization is passing string names to the global localization function:
echo $this->getTranslator()->translate( 'library:Bid confirmation' )
So if I want to add a new call like that I have to navigate to the translation file, search for the translation I need and copy paste it manually to the new code line.
Another issue here is, if I add a new string for translation, there is no static check that I add it to all language files. Same goes for modifying an existing string name due to context change or page redesign.
It would be great to instead have some kind of static structure that the existing PHP analysis tools could use, e.g.
echo $this->getTranslator()->Library->BidConfirmation;
So that I could ctrl-space on $this->getTranslator()->Library->
and get a prompt of all valid properties of that object. Additionally the analysis tool could check if all language objects correctly comply with the abstract parent that defines the list of required translations.
On the other hand I wouldn't want to bother with possibly performance-degrading techniques like reflection. Neither would I want to add a separate PHP file for every second level object like Library
in the example above - there could be dozens of them.
Can anyone share their experience from a success story that adds design-time support to the localization process?
Aucun commentaire:
Enregistrer un commentaire