w2c / ispconfig3_roundcube

ISPConfig3 plugins for Roundcube
https://www.web-wack.at
GNU General Public License v3.0
180 stars 63 forks source link

WIP: Translate soap error #91

Closed helmo closed 5 years ago

helmo commented 5 years ago

It may be hard to include every possible error in the translation files.... but would be nice to add a few common ones.

Would you be interested in this? The same change would have to be added in more catch blocks.

Churro commented 5 years ago

I appreciate the idea and agree that a translation of error messages would be nice. However, there is one annoying thing about the gettext() implementation in Roundcube: In case it does not find a matching translation, it puts the text in square brackets: a

So as long as the most common error messages are not translated, wrapping messages by gettext() will probably not be helpful.

helmo commented 5 years ago

Are brackets so bad? I don't think it out weighs the possibility to translate. (a chicken/egg thing, the common errors will probably get translated after it's possible)

As with any new translation strings, we could add a copy of the English string in each language file.

Churro commented 5 years ago

I have now found a solution that tackles brackets for untranslated texts: Instead of directly calling gettext with SOAP error messages, we first check if a translation exists using text_exists. If this is the case, it is fetched using gettext, otherwise the original string is shown.