How to Convert Date to Thai

Update setlocale(LC_TIME, “th_TH.UTF-8”); echo strftime(“%A %d %B %Y”, strtotime(get_the_date())); Before: อาทิตย์ 03 มกราคม 2016 //$strdate = get_thai_date(); //print_r($strdate[“number”]); //preg, strstr or others. //$strdate = date_i18n(…); After: อาทิตย์ ๐๓ มกราคม ๒๐๑๖

How to ‘manually’ load translations/test domain outside theme context?

Already found out: load_textdomain(‘my-text-domain’, TEMPLATEPATH . ‘/languages/’. $my_locale . ‘.mo’); In some cases it could be useful to restore the previous text domain, so we should make a backup. An old function I had hidden in my code that does all, is this one: function __2($string, $textdomain, $locale){ global $l10n; if(isset($l10n[$textdomain])) $backup = $l10n[$textdomain]; load_textdomain($textdomain, … Read more

Translation ready code format for taxonomy

_x( ‘Categories’, ‘taxonomy general name’ ) does it make taxonomy general name a text domain? wont it resulting in multiple translation? That taxonomy general name is the gettext or translation context used in the POT file. The text domain is the third parameter, which defaults to default. From the Codex: Sometimes a single term is … Read more

How to get custom translations from child theme to be loaded?

Actually my mistake, I was overriding the translation of the parent theme using it’s text domain for child theme, while I should have defined a different text domain for child theme and load both domains into child theme’s functions.php like this: add_action( ‘after_setup_theme’, ‘mr_load_textdomain’ ); function mr_load_textdomain(){ //for child load_theme_textdomain (MR_DOMAIN,get_stylesheet_directory().’/languages’); //for parent load_theme_textdomain (ET_DOMAIN,get_template_directory().’/lang’); … Read more