Multi Language Issue

Home Forums Pro Support Multi Language Issue

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #69378
    Paul BackusPaul Backus
    Participant

    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
    Paul

    #69379
    Paul BackusPaul Backus
    Participant

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

    #69380
    Paul BackusPaul Backus
    Participant

    Hi 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 ThemeBuilders

    Attachments:
    You must be logged in to view attached files.
    #69383
    Kriti SharmaKriti Sharma
    Keymaster

    Hi Paul,

    Please give us some time so we can look into the issue and get back to you soon.

    Regards,
    Kriti

    #69435
    Kriti SharmaKriti Sharma
    Keymaster

    Hi 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,
    Kriti

    #69437
    Paul BackusPaul Backus
    Participant

    Hi 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,
    Paul

    #69438
    Kriti SharmaKriti Sharma
    Keymaster

    Hi Paul,

    We will keep this in mind while doing the same. Thanks for your valuable input.

    Regards,
    Kriti

    #69458
    Kriti SharmaKriti Sharma
    Keymaster

    Hi Paul,

    Can you please take out some time to record the above-mentioned feature request on the following URL:

    https://app.makerkit.co/posts

    We are trying to get the feature requests recorded directly from our valuable customers. It will take only a few minutes.

    Regards,
    Kriti

    #69460
    Paul BackusPaul Backus
    Participant

    Record what where. I dont have a project there. I dont understand what it is you want me todo there. Please advice

    #69461
    Kriti SharmaKriti Sharma
    Keymaster

    Hi 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

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Multi Language Issue’ is closed to new replies.