Created
August 2, 2010 16:06
-
-
Save thefuxia/504854 to your computer and use it in GitHub Desktop.
Change language declarations in WordPress.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Adjust the public visible language declarations. | |
* | |
* @author "Thomas Scholz" http://toscho.de | |
* @version 1.0 | |
*/ | |
class Toscho_Language_Filter | |
{ | |
/** | |
* @var string | |
*/ | |
public static $lang = 'de'; | |
/** | |
* Pseudo constructor. | |
* | |
* @param string $lang The language according to … | |
* @link http://www.evertype.com/standards/iso639/iana-lang-assignments.html | |
* @return void | |
*/ | |
public static function setup($lang = 'de-DE-1901') | |
{ | |
self::$lang = $lang; | |
add_filter( | |
'language_attributes' | |
, array ( __CLASS__, 'html' ) | |
); | |
add_filter( | |
'pre_option_rss_language' | |
, array ( __CLASS__, 'get_lang' ) | |
); | |
} | |
/** | |
* Returns the language string. | |
* @return string | |
*/ | |
public static function get_lang() | |
{ | |
return self::$lang; | |
} | |
/** | |
* Output for language_attributes(). | |
* We drop the 'dir' attribute. | |
* | |
* @return string | |
*/ | |
public static function html() | |
{ | |
return 'lang="' . self::$lang . '"'; | |
} | |
} | |
// Adjust this to your needs. | |
Toscho_Language_Filter::setup('de-DE-1901'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment