multilingual site
-
Hi Roland,
We have a problem to change language of your plugin. We use WPML plugin to switch language on our site, and we have set constant in our functions.php file as it says in your documentation.
define( 'PDB_MULTILINGUAL', true );
We expected all predefined texts in your plugin, such as buttons – clear, save, cancel and so on, service messages and etc., would change its language on that switch. But it’s not. So, since we should translate user-defined strings manually, we decided to use our own parser in pdb-translate_string filter. And here come difficulties.
We use your Combo Multi Search plugin.1) One of the fields on that form is Multiselect Checkbox. And the search value(s) for this field does not get translated. So, the function $PDb_Combo_Multi_Search->current_search_term(), will return all search values from the form fields, where values from Multiselect Checkbox field still in default language, and values from other fields are in selected language. After examining object $PDb_Combo_Multi_Search, I found out that search value for this field held in format “,value1,value2” or “,any,value1” or “,value1”. I’m not sure about purpose of this leading comma. My wild guess is the whole string passed to pdb-translate_string filter – “,value1,value2”, and not individual search values – “value1”, “value2” and so on.
2)In your multisearch template you have defined buttons in the following manner.
<input type="submit" class="button-secondary" name="multisearch-submit" data-submit="clear" value="<?php echo $PDb_Combo_Multi_Search->i18n['clear'] ?>" />
So, we replaced $PDb_Combo_Multi_Search->i18n[‘clear’] with the call of our parser to get translation for “Clear” button, and now, the button only works in English. My guess is you use value attribute of input field to determine which button is clicked, and since our translation for this button differs from the value you compare to, the button does not clear the search form.
Also, I found another interesting info while examining you $PDb_Combo_Multi_Search object. The array where you pull your translated string from $PDb_Combo_Multi_Search->i18n always has english values in it.[i18n] => Array ( [clear] => Clear [search] => Search [any] => Any )But, if you look at your another version of i18n array, it contains values depending on selected language, and actually this array has more elements than the one mentioned above.
$PDb_Combo_Multi_Search->search->Query->i18n [i18n] => Array ( [delete_checked] => Markierte löschen [change] => Aktualisieren [sort] => Sortieren [filter] => Filtern [clear] => Leeren [search] => Suchen )Any ideas what can cause this behavior?
Let me know if you need more info.Thanks!
The topic ‘multilingual site’ is closed to new replies.