New Landing How can we help? Themeforest Theme Support Uplift WPML selector languages

Viewing 6 posts - 1 through 6 (of 6 total)
  • Posted in: Uplift
  • #282399
    Campbelladv
    Member
    Post count: 2

    Hi,
    I’m using WPML with the language selector native of the theme.
    Is it possible to have the name of language exactly translated into the native language?
    (view attachment)

    Thank you very much

    Attachments:
    You must be logged in to view attached files.
    #282531
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I see your language switcher different from screenshot image. Have you managed to resolve the issue? Just check the attachment.
    Thanks
    Mohammad

    Attachments:
    You must be logged in to view attached files.
    #282615
    Campbelladv
    Member
    Post count: 2

    Hi Mohammad,
    unfortunately I have not solved.

    Maybe you did not understand my problem… and maybe I have not explained (my english is bad ๐Ÿ˜‰

    Currently if the Web site is displayed in Italian, the languages selector displays:
    – Italiano
    – Spagnolo
    – Inglese

    Currently if the Web site is displayed in English, the languages selector displays:
    – Italian
    – Spanish
    – English

    Currently if the Web site is displayed in Spanish, the languages selector displays:
    – Italiano
    – Espanol
    – Ingles

    I would that the language selector always displays in native languages. As below:
    – Italiano
    – Espanol
    – English

    Thank you
    Marco

    #282734
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste this code at functions.php of child theme.

    
    function sf_language_flags() {
    
    	        $language_output = "";
    
    	        if ( function_exists( 'pll_the_languages' ) ) {
    	            $languages = pll_the_languages(array('raw' =>1 ));
    	            if ( !empty( $languages ) ) {
    	                foreach( $languages as $l ) {
    	                    $language_output .= '<li>';
    	                    if ( $l['flag'] ) {
    	                        if ( !$l['current_lang'] ) {
    	                        	$language_output .= '<a href="'.$l['url'].'"><img src="'.$l['flag'].'" height="12" alt="'.$l['slug'].'" width="18" /><span class="language name">'.$l['name'].'</span></a>'."\n";
    	                        } else {
    	                        	$language_output .= '<div class="current-language"><img src="'.$l['flag'].'" height="12" alt="'.$l['slug'].'" width="18" /><span class="language name">'.$l['name'].'</span></div>'."\n";
    	                        }
    	                    }
    	                    $language_output .= '</li>';
    	                 }
    	            }
    	        } else if ( function_exists( 'icl_get_languages' ) ) {
    	            $languages = icl_get_languages( 'skip_missing=0&orderby=code' );
    	            if ( ! empty( $languages ) ) {
    	                foreach ( $languages as $l ) {
    	                    $language_output .= '<li>';
    	                    if ( $l['country_flag_url'] ) {
    	                        if ( ! $l['active'] ) {
    	                            $language_output .= '<a href="' . $l['url'] . '"><img src="' . $l['country_flag_url'] . '" height="12" alt="' . $l['language_code'] . '" width="18" /><span class="language name">' . $l['native_name'] . '</span></a>' . "\n";
    	                        } else {
    	                            $language_output .= '<div class="current-language"><img src="' . $l['country_flag_url'] . '" height="12" alt="' . $l['language_code'] . '" width="18" /><span class="language name">' . $l['native_name'] . '</span></div>' . "\n";
    	                        }
    	                    }
    	                    $language_output .= '</li>';
    	                }
    	            }
    	        } else {
    	            //echo '<li><div>No languages set.</div></li>';
    	            $flags_url = get_template_directory_uri() . '/images/flags';
    	            $language_output .= '<li><a href="#">DEMO - EXAMPLE PURPOSES</a></li><li><a href="#"><span class="language name">German</span></a></li><li><div class="current-language"><span class="language name">English</span></div></li><li><a href="#"><span class="language name">Spanish</span></a></li><li><a href="#"><span class="language name">French</span></a></li>' . "\n";
    	        }
    
    	        return $language_output;
    	    }

    Thanks
    Mohammad

    #282920
    Campbelladv
    Member
    Post count: 2

    Hi Mohammad,
    it’s all OK!

    Thank you very much
    ๐Ÿ˜‰

    #282977
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Glad ๐Ÿ™‚ to help you.
    Thanks
    Mohammad

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register