Open
Description
The classes have their textdomain for localization injected through the constructor.
This will not work in all instances, as gettext()
only works by checking for simple strings, it does not evaluate the PHP code to get runtime information.
Also, this does not really make sense, as multiple plugins using the messages would then provide multiple, partially conflicting translations, and each one needs to localize for all languages on their own.
I suggest providing default messages with a fixed textdomain that will be centrally localized by the community, with a mechanism to override them only when needed.
Out of the gate I can think of two possible ways of having the messages be localizable:
- Inject a type of config file into the class that contains identifier => strings combinations.
- Have the class be extended to provide localizations through either overrideable properties or methods.