Once again I have a question concerning WordPress and PHP. In fact, it is not completly WordPress related, but thinking of it in this context makes it more understandable.
I develop a framework that is supposed to make theme development as easy as possible. Therefore, I want to make a theme translatable automatically. The developer using the framework should not have to use __(...) every time he or she passes a string to somewhere.
The problem is that the PHP gettext functions can't handle variables by design. That really makes sense, since dynamic content cannot be translated and also would require the translation generater to not only parse, but also execute the script file - but it is really limiting in scenarios where your content is somehow fixed (at least as fixed as a string in PHP would be).
Here is an example of what the developer currently has to do:
new EaseWidgetArea(
__('Notificationbar', 'themedomain'),
"notificationbar",
__("Top bar supposed to hold emergency information.", 'themedomain')
);
Here is what I aim for:
new EaseWidgetArea(
"Notificationbar",
"notificationbar",
"Top bar supposed to hold emergency information."
);
In the class-method where the widget-area is finally registered:
register_sidebar(
array(
'name' => __($this->name),
'id' => $this->id,
'description' = __($this->description),
'before_widget' => '<div class="widgetarea">',
'after_widget' => '</div>'
)
);
Do you know any clean and convenient way to accomplish this? Thanks in advance!