• Hi,

    I have installed this plugin, it is truly a very simple and easy implementation, however, the language flag is not displaying on top of the screen.

    I have added the codes into header.php as you shared. Please review below:

    <!DOCTYPE html>
    <html <?php language_attributes(); ?>>
    <head>
    <?php if ( function_exists( 'ps_012_m17n_bread_crumb' ) ) ps_012_m17n_bread_crumb(); ?>
    <?php if ( function_exists( 'pml_multilingual_list' ) ) pml_multilingual_list(); ?>
    	<title><?php if ( is_category() ) {
    		echo 'Category Archive for "'; single_cat_title(); echo '" | '; bloginfo( 'name' );
    	} elseif ( is_tag() ) {
    		echo 'Tag Archive for "'; single_tag_title(); echo '" | '; bloginfo( 'name' );
    	} elseif ( is_archive() ) {
    		wp_title(''); echo ' Archive | '; bloginfo( 'name' );
    	} elseif ( is_search() ) {
    		echo 'Search for "'.wp_specialchars($s).'" | '; bloginfo( 'name' );
    	} elseif ( is_home() || is_front_page() ) {
    		bloginfo( 'name' ); echo ' | '; bloginfo( 'description' );
    	}  elseif ( is_404() ) {
    		echo 'Error 404 Not Found | '; bloginfo( 'name' );
    	} elseif ( is_single() ) {
    		wp_title('');
    	} else {
    		echo wp_title( ' | ', false, right ); bloginfo( 'name' );
    	} ?></title>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use the pastebin]

    Would you mind provide us more clue on how to display the language flag properly?

    Thank you in advance.

    http://wordpress.org/extend/plugins/012-ps-multi-languages/

Viewing 12 replies - 16 through 27 (of 27 total)
  • Thanks for this great tool.

    One more thing.

    How i can move the flags to the lower right or left corner of the header?

    Thanks in advance.

    Thomas

    Plugin Author Wang Bin

    (@ouhinit)

    Hello,
    I think you’ll be referring to the following post.
    Thank you.

    languages flag_icon

    languages list

    I would like to thank the people of the answer because it’s not good at English.

    HI, sorry for another unintelligleble quaetion.
    But the flags don ´t show.

    I copied the code supplied by Amonti.
    I changed url_exist() to ps_url_exist() as suggested by xdios
    (I also needed to add the false parameter as per xdios)
    Flags don´t show up, so added the echo ($flag_icon) ; as per amonti.

    The value returned is actually the 3 urls of my languages in one string:
    http://colorartetejas.com/wp-content/themes/artificer/images/flags/nl.pnghttp://colorartetejas.com/wp-content/themes/artificer/images/flags/en.pnghttp://colorartetejas.com/wp-content/themes/artificer/images/flags/es.png

    each url apart shows up nicely, but all together of course not …
    Any idea what could cause this?
    Thanks everybody for contributing!

    How I wish I could edit my post above…unfortunately, a couple of days after I figured out the languages flag code (as per above), the author of the plug-in slightly changed one of the functions without changing the version number. This messed quite a few people up.

    Please consult this post for pastebin links to flag code that works with the current version.

    To ArjanT:

    If you speak Spanish (I think so) you can read a full explanation step by step made by me in this blog: Diseño y Desarrollo Web.

    I hope this finally help you.

    Thank you amonti and xdios (also for the link to yr site with other interesting blogs!), finally I have found the cause. I noticed the path to the icons in my error showed wp-content/themes/artificer/images/flags folder as the destiny … and they did not exist there, I had copied them to the wp-content/images/flags folder… copying the necessary .png to the right folder made the icons show properly. Simple as that… Sorry for the confusion. Rgds.

    Hello,

    Please, I need some help.

    The pluggin is ready but I found any problems to traslate the widgets, links and bread crumbs, ¿would you tell me whats the function to traslate this?.

    Thanks a lot!!

    Trilobites: not exactly sure what you are asking, but widgets should be translated as part of the theme. Did you follow these instructions to add multiple languages to your WordPress installation?

    If you edit the .POT files, you can simply use the “__” function to automatically translate strings into the users’ selected language.

    For links, you can use the get_load_language() function of this plugin to dynamically determine language and display links (or whatever) based on the language selection, like so:

    if ( function_exists( 'get_load_language' ) ) $curr_lang = get_load_language();
    switch ( $curr_lang ) :
    	case 'en' :?> (in all languages)<?php
    		break;
    	case 'de' :?> (in allen Sprachen)<?php
    		break;
    	case 'fr' :?> (dans toutes les langues)<?php
    		break;
    	default :?> (in all languages)<?php
    		break;
    endswitch;

    I don’t think there’s any need to translate breadcrumbs as that’s something not seen by the user; please clarify your question if you think some sort of breadcrumb translation is required.

    Hope this helps…

    @amonti : Thanks for the tips and your clear explanations
    @xdios : I faced exatly the same problems as you described. Your help was so precious. I confirm that replacing url_exists() by ps_url_exists() is necessary.

    –> You guys are my hero.

    Thank you for this great component and all the help i found here

    Hello amonti,

    I would try to explain my problem better, sorry for my english.

    I have a blog in my multilingual web(spanish default, french, portuguese and english) and I can´t use the multilingual options to translate the widgets sidebar and the footer. I only can choose one language, for example in english: “Recent Post”, “Latest Post”, but I don´t have the functionality to white the same text in other languages.

    The second problem: In my theme you can show to the user the navigation with breadcrumbs, they are located close to the title. For example: “Home – Sectors- Energy” but alwais show like this “Home – Sectores (in spanish)- Energy”. Is very extrange because if you are in the section “Sectors” the breadcrumb is ok: “Home-Sectors”.

    If you can give an email I will send you some sreenshoots.

    Thank you very much for your help!!!

    Best regards!!

    Hi Trilobites,

    No need to apologize – your English is great!

    I don’t think there are any multilingual options in this plug-in to display different widget titles or text based on language selection. That generally means that you will have to add code yourself. There’s a nice summary on how to dynamically hide widgets in code here. You essentially add a filter hook to the sidebar_widgets and footer_widgets to hide all widgets that are not in the selected language (determined by the get_load_language function as in the above post).

    There is also another option, but I’m not sure if it will work. You can use the “widget logic” plugin, which allows you to show or hide widgets based on certain conditions. The plug-in adds a field called “Widget logic” to a widget’s configuration that allows you to specify when the widget is displayed. You would add all widgets for all language to your sidebar and footer, then use the Widget logic field to display only the widgets in the selected language. You could add something like get_load_language() == 'fr' to the Widget logic field that would only display the widget if French was the currently selected language. I’m not sure if you can add a function call in the Widget logic field. If not, you will have to set a global variable in the page header to the selected language. If you added my flag code, you should have a variable called selang which is set to the currently selected language. You could try selang = 'fr_FR' in the Widget logic field.

    As far as the breadcrumb is concerned, I find it strange that only one link would display in another language, and yet be displayed correctly when you select that link. Have you taken a look at the bread_crumb code in 012-ps-multi-languages/ps-multi-languages.php to see what is happening? I don’t use the bread crumb function on my site, so I’m not really familiar with its inner workings.

    Sorry that I don’t have time to test any of this or provide more breadcrumb information – hope this helps!

    – Andrew

    goldmelodyvn

    (@goldmelodyvn)

    Summary work for me:
    Add the code follow in header.php of your theme:

    <?php
    // for multilanguage change flag
    if ( function_exists( 'ps_012_multilingual_list' ) )
    {
    	$gs = ps_012_multilingual_list(false);
    }
    foreach(array_reverse($gs, true) as $key=>$val){
    		$flags_dir = get_bloginfo('template_directory');
    		$flags_dir .= '/images/flags/';
    		$flag_icon = $flags_dir . $key . '.png';
    		if ( ps_url_exists( $flag_icon )):
    			if ($val['current']) {
    				$flag_icon = '<img src="'.$flag_icon.'" style="float:right;margin:2px;border:1px solid #021a40;background-color:#ff0>"';
    			}
    			else
    			{
    				$flag_icon = '<img src="'.$flag_icon.'" style="float:right;margin:2px">';
    			}
    		endif;
    		$html .= '<a href="'.$val['url'].'">'.$flag_icon.'</a>&nbsp';
    	}
    
    	echo $html;
    
    ?>

    Copy folder at: wordpress\wp-content\plugins12-ps-multi-languages\flags to wp-content\themes\yourtheme\images

Viewing 12 replies - 16 through 27 (of 27 total)
  • The topic ‘[Plugin: 012 Ps Multi Languages] Language Flag Not Displayed’ is closed to new replies.