Bring Your Business to Life › Support › Popular Widget › Problem with Spanish translation
Tagged: translation
- AuthorPosts
- September 10, 2012 at 7:29 am #49750mctwinsenParticipant
Hello,
First, thank you for your work.
We have a problem with the Spanish translation. We downloaded the translation patch and have copied in “langs”, but the tab names are still in English.
We also tried to modify the “popular-widget.php”, in the following lines:
$this->tabs = apply_filters( ‘pop_defaults_tabs’, array(
‘recent’ => __( ‘<span>Recent </span> Posts’, $this->domain ) ,
‘comments’ => __( ‘<span>Recent </span>Comments’, $this->domain ) ,
‘commented’ => __( ‘<span>Most </span>Commented’, $this->domain ),
‘viewed’ => __( ‘<span>Most </span>Viewed’, $this->domain ),
‘tags’ => __( ‘Tags’, $this->domain )
by
$this->tabs = apply_filters( ‘pop_defaults_tabs’, array(
‘recent’ => __( ‘<span>Entradas </span> Recientes’, $this->domain ) ,
‘comments’ => __( ‘<span>Comentarios </span>Recientes’, $this->domain ) ,
‘commented’ => __( ‘<span>Más </span>Comentados’, $this->domain ),
‘viewed’ => __( ‘<span>Más </span>Vistos’, $this->domain ),
‘tags’ => __( ‘Etiquetas’, $this->domain )
and no change.¿Can you hep us?
Thank you
September 10, 2012 at 11:46 pm #49762Xpark MediaKeymasterare you using the multisite wp feature? you need to change the language on the site settings alos be sure that you change the language on the wp-config.php file a
define('WPLANG', 'es_ES');
September 17, 2012 at 4:05 am #49886mctwinsenParticipantThanks for your quick response,
I’m not using (or so I think) any multisite wp feature and my settings are as follows:
define (‘WPLANG’, ‘es_ES’);
define(‘WP_MEMORY_LIMIT’, ‘128M’);any ideas?
Thanks again
September 18, 2012 at 1:51 am #49921Xpark MediaKeymasterdo you have some sort of language plugin installed, I teste it on wp 3.4.2 and it works fine. try disabling your plugin one by one and see if there is a conflict
September 24, 2012 at 3:49 pm #50042jrfParticipantI have the same problem with the Dutch text strings, they don’t get picked up either no matter what I do.
I don’t have a language plugin installed, and the language settings are as they should be…
September 24, 2012 at 9:08 pm #50050Xpark MediaKeymasterif you saved the option before applying the translation the tabs will remain in English, but all new widgets will be translated.
@mctwinsen, @jrf could anybody provide access to their development site to look at it? [email protected]September 24, 2012 at 9:39 pm #50052jrfParticipantActually, I’ve figured it out by now….
The main problem is that you don’t have an update() function in your widget class.
This basically means you don’t validate *any* of the input a user gives in the widget options and whatever is received is saved to the widget $instance regardless.
Quite apart from the fact that this is unsafe and bad practice, it also means that the (English) default text phrases will be saved with the instance instead of being filtered out.
There are three ways to get around this problem:
1) Have the translation files installed with the plugin so the default strings will be available in the preferred language from the start – at least for the languages for which a translation is currently available (eh.. I get the feeling I’m repeating myself from my earlier post….)
2) The user can edit (rename) the text strings which will then be saved to the widget $instance.
However, this functionality is not very obvious in the options panel (the ‘move’ cursor is more prominent and you only see that you can actually rename the phrases in the same bit if you hover over the actual text). It doesn’t help that there is no help text or hint in the section title either.3) [BEST SOLUTION BY FAR!] Add the update() function to the widget class and properly validate every input for expected values and acceptable values.
If the input is the same as the default value, do *not ever* save it with the $instance! For the display function: use what’s in the $instance and for any options not set, use the default values.As the text string defaults are translation ready, installing a translation file later on will then no longer be a problem either.
Hope this helps.
- AuthorPosts
- You must be logged in to reply to this topic.