Issue with WPML and translated strings
-
There is an issue with the plugin and multilingual site using WPML and translated strings.
Actually there are 3 issues I found:
– placeholders on the forms are not translated
– dropdown option texts are not translated
– multiselect results are not translated
The fixes are easy and reflect 3 files – um-fields.php, um-members.php, members-grid.php
———
To fix the placeholders issue the partplaceholder="'.$placeholder.
should be replaced with
placeholder="'.__( $placeholder, UM_TEXTDOMAIN ).
in um-fields.php and um-members.php (some places are not with exactly this string but the idea is clear).
—————————————-
To fix the issue with select options the part<option value="<?php echo $opt; ?>" <?php um_select_if_in_query_params( $filter, $opt ); ?>><?php echo $v; ?></option>
should be changed to
<option value="<?php echo $opt; ?>" <?php um_select_if_in_query_params( $filter, $opt ); ?>><?php echo __( $v, UM_TEXTDOMAIN ); ?></option>
—————————————
To fix the issue with multiselect the code$resArray = explode(', ',$res); foreach ($resArray as &$r) { $r = __( $r ,UM_TEXTDOMAIN); }; unset($r); $res = implode (', ',$resArray);
before the output part of view_field function in um-fields.php
after the
$res = apply_filters("um_view_field_value_{$type}", $res, $data );
Similar code should be implemented in members-grid.php
Probably there are other parts like these to be fixed, but this was we needed for our purposes.
Sorry for the long explanation, It would be much easier if I can attach the changed files, but there is no attachment option in the forum.
- The topic ‘Issue with WPML and translated strings’ is closed to new replies.