Multi Language Issue
Home › Forums › Pro Support › Multi Language Issue
- This topic has 9 replies, 2 voices, and was last updated 4 years, 6 months ago by Kriti Sharma.
-
AuthorPosts
-
October 2, 2019 at 9:30 am #69378Paul BackusParticipant
Hi
On a multi language website which has RTL and LTR the button and flyout should be reversed. Most websites have mirroring css on rtl /ltr.
So f.e.
I have a logo on the left and the menu button on the right. But on RTL my logo is on the left. And now the responsive menu button appears above it. I have no setting to have this in a ltr language on the right with the flyout left and a ltr language on the left and the flyout right. Or vice versa what ever default setting one has chozen for ltr and rtl.
The plugin only works for one language or multiple languages in the same ltr or rtl mode. But in a mixed mode it wont work.
How to fix this?
kind Regards
PaulOctober 2, 2019 at 9:35 am #69379Paul BackusParticipantif you could add wpml string translations settings for all the left and right settings fields the plugin has i think this might work for rtl and ltr together. But in that case the css can not be stored in a file. It has to be dynamic loaded per page.
October 2, 2019 at 11:52 am #69380Paul BackusParticipantHi Peter,
I tested this by adding the options related into the wpml string translation table and it works perfectly !
The only thing that needs to be done
1) Add the strings related to the database in the updateOptionTask.php
private $translatables = [ 'menu_to_use', 'button_title', 'menu_title', 'menu_title_link', 'menu_additional_content', 'menu_search_box_text', 'header_bar_title', 'header_bar_logo', 'header_bar_logo_link', 'header_bar_logo_alt', 'header_bar_html_content', 'menu_text_alignment', 'menu_depth_side', 'button_title_position', 'button_left_or_right', 'button_position_type', 'arrow_position', 'submenu_text_alignment', 'submenu_arrow_position', 'menu_title_alignment', 'menu_appear_from', 'fade_submenus', 'fade_submenus_side', 'desktop_menu_positioning', 'desktop_menu_side', ];
2) Change the database php and read them back on the fly.
<?php namespace ResponsiveMenuPro\Database; class Database { private $translatables = [ 'menu_to_use', 'button_title', 'menu_title', 'menu_title_link', 'menu_additional_content', 'menu_search_box_text', 'header_bar_title', 'header_bar_logo', 'header_bar_logo_link', 'header_bar_logo_alt', 'header_bar_html_content', 'menu_text_alignment', 'menu_depth_side', 'button_title_position', 'button_left_or_right', 'button_position_type', 'arrow_position', 'submenu_text_alignment', 'submenu_arrow_position', 'menu_title_alignment', 'menu_appear_from', 'fade_submenus', 'fade_submenus_side', 'desktop_menu_positioning', 'desktop_menu_side', ]; public function __construct($db_base) { $this->db = $db_base; } private function get_wpml_t($context, $name, $original_value){ if (in_array($name,$this->translatables)) { if(function_exists('icl_t')){ return icl_t($context, $name, $original_value); }else{ return $original_value; } } else return $original_value; } public function all($table) { $results = $this->db->get_results("SELECT * FROM {$this->db->prefix}{$table}", ARRAY_A); $flattened = []; foreach($results as $result) $flattened[$result['name']] = $this->get_wpml_t('Responsive Menu Pro', $result['name'], $result['value']); return $flattened; } public function update($table, array $to_update) { return $this->db->replace($this->db->prefix . $table, $to_update, ['%s', '%s']); } public function delete($table, $name) { return $this->db->delete($this->db->prefix . $table, $name); } public function insert($table, array $arguments) { return $this->db->insert($this->db->prefix . $table, $arguments); } }
3) do not set the setting to export the settings into a external file ! The latter needs a more and better solution from you guys.
Attached are the two modified files.
Peter please contact me on skype on this. Let me know if you will implement this and if you found another way so it can be used with saving options to the external css file.
Best regards,
Paul
The ThemeBuildersAttachments:
You must be logged in to view attached files.October 2, 2019 at 11:54 am #69383Kriti SharmaKeymasterHi Paul,
Please give us some time so we can look into the issue and get back to you soon.
Regards,
KritiOctober 8, 2019 at 12:31 pm #69435Kriti SharmaKeymasterHi Paul,
As you have mentioned that you are using responsive menu pro with WPML plugin. I can see that responsive menu is listed as compatible with WPML plugin https://wpml.org/plugin/responsive-menu/
By looking at the code in UpdateOptionsTask.php file in responsive menu pro plugin, I can see that there are only a few options that are translatable by WPML and you are asking for more options to be translatable by WPML.
We will try to accommodate this feature in future updates as soon as possible.
Regards,
KritiOctober 8, 2019 at 12:47 pm #69437Paul BackusParticipantHi Kriti,
Adding more translation options in the UpdateOptionsTask.php is only half of the solution to the problem. See the changes you need to make to the database.php
You also have to read them back in into the options so that they can be processed in the frontend.
Best regards,
PaulOctober 8, 2019 at 12:50 pm #69438Kriti SharmaKeymasterHi Paul,
We will keep this in mind while doing the same. Thanks for your valuable input.
Regards,
KritiOctober 9, 2019 at 1:13 pm #69458Kriti SharmaKeymasterHi Paul,
Can you please take out some time to record the above-mentioned feature request on the following URL:
We are trying to get the feature requests recorded directly from our valuable customers. It will take only a few minutes.
Regards,
KritiOctober 9, 2019 at 2:35 pm #69460Paul BackusParticipantRecord what where. I dont have a project there. I dont understand what it is you want me todo there. Please advice
October 9, 2019 at 3:08 pm #69461Kriti SharmaKeymasterHi Paul,
You just need to go to above link, make an account and add your feedback as feature request that you want mixed ltr and rtl mode for different languages on a multi- language website.
Regards,
Kriti -
AuthorPosts
- The topic ‘Multi Language Issue’ is closed to new replies.