Skip to content

Instantly share code, notes, and snippets.

@thefuxia
Created August 2, 2010 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thefuxia/504854 to your computer and use it in GitHub Desktop.
Save thefuxia/504854 to your computer and use it in GitHub Desktop.
Change language declarations in WordPress.
<?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