Problem with Spanish translation

HomeSupportPopular WidgetProblem with Spanish translation

Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #49750
    mctwinsen
    Participant

    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

    #49762
    Xpark Media
    Keymaster

    are 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');

    #49886
    mctwinsen
    Participant

    Thanks 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

    #49921
    Xpark Media
    Keymaster

    do 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

    #50042
    jrf
    Participant

    I 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…

    #50050
    Xpark Media
    Keymaster

    if 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]

    #50052
    jrf
    Participant

    Actually, 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.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.