Polyglot Plugin for WAI

[ Plugin / Polyglot Plugin for WAI / Leave Comment ]

On this page… (hide)

  1. 1. Download and Example
  2. 2. What kind of WAI?
  3. 3. Modify
  4. 4. Related Links

1. Download and Example

2. What kind of WAI?

Please check Web Content Accessibility Guidelines 1.0 Priority 2 - 13.1.2
All Anchor elements are required not to use the same link text to refer to different resources.

3. Modify

  1. Edit file : polyglot.php
  2. Add <span class=\"none\"> for \"".$post→post_title."\"</span> into link
    • find this function function polyglot_other_langs
      then you can find this lines
       foreach ($match as $lang){
                  if ($polyglot_settings['lang_pref'] != $lang) {
      
      				$foo = ($polyglot_settings['use_flags'] ) ?  "<img src=\"".$polyglot_settings['path_to_flags'].$polyglot_settings['flags'][$lang] ."\" alt=\"".get_trans($lang)."\" title=\"".get_trans($lang)."\" />" : get_trans($lang);
      
      
      				$other_langs .= "$pre<a href='".get_permalink();
      
                      if ($polyglot_settings['lang_rewrite']) {
      					if($polyglot_settings['i_have_manually_edited_my_htaccess_file'] || strpos(get_permalink(),'?') === false){
      						$other_langs .= "{$uri_helper}{$lang}/";
      						}
      					else {
      						$other_langs .= "&amp;lang_view=$lang'";
      					}
                      } else {
      					if(strpos(get_permalink(),'?') === false){
      							$other_langs .= "?lang_view=$lang'";
      					}
      					else {
      							$other_langs .= "&amp;lang_view=$lang'";
      					}
      
                      }
      
      				$other_langs .= "'>{$foo}</a>$afters";
                  }
              }
      
      And change like this
              foreach ($match as $lang){
                  if ($polyglot_settings['lang_pref'] != $lang) {
      
      				$foo = ($polyglot_settings['use_flags'] ) ?  "<img src=\"".$polyglot_settings['path_to_flags'].$polyglot_settings['flags'][$lang] ."\" alt=\"".get_trans($lang)."\" title=\"".get_trans($lang)."\" />" : get_trans($lang)."<span class=\"none\"> for \"".$post->post_title."\"</span>" ;
      
      
      				$other_langs .= "<li class='$lang'><a href='".get_permalink();
      
                      if ($polyglot_settings['lang_rewrite']) {
      					if($polyglot_settings['i_have_manually_edited_my_htaccess_file'] || strpos(get_permalink(),'?') === false){
      						$other_langs .= "{$uri_helper}{$lang}/";
      						}
      					else {
      						$other_langs .= "&amp;lang_view=$lang'";
      					}
                      } else {
      					if(strpos(get_permalink(),'?') === false){
      							$other_langs .= "?lang_view=$lang'";
      					}
      					else {
      							$other_langs .= "&amp;lang_view=$lang'";
      					}
      
                      }
      
      				$other_langs .= "' title=\"".get_trans($lang)." for '".$post->post_title."'\">{$foo}</a>$afters";
                  }
              }
      
      And add style in CSS file like this .none {display:none;}
  3. Result
    If you wrote post with multi languages (Korean and English and Japanese) and you don't use flag for language links. the html code will be like this
    <ul>
    <li><a href="URL/lang/en/" title="English for 'Subject of Post'">English<span class="none"> for "Subject of Post'"</span></a></li>
    <li><a href="URL/lang/ko/" title="Korean for 'Subject of Post'">Korean<span class="none"> for "Subject of Post'"</span></a></li>
    <li><a href="URL/lang/ja/" title="Japanese for 'Subject of Post'">Japanese<span class="none"> for "Subject of Post'"</span></a></li>
    </ul>
    
    And it will be shown like this

4. Related Links

Categories : Wordpress