WordPress 月や曜日を英語表記に。

いやなんか月とか曜日の表示を英語にしたかったんだ。
でも設定画面でそのような操作ができないようだったので、直接デリケートゾーン(wp-includes/locale.php)を弄くった。
本当はja.poだかja.moをいんぐりもんぐりするべきなんだろうけどね。
こっちの方が手間が掛からない感じ。
だからきっと真似はしない方がいいと思う。

	function init() {
		// The Weekdays
		$this->weekday[0] = 'Sunday';
		$this->weekday[1] = 'Monday';
		$this->weekday[2] = 'Tuesday';
		$this->weekday[3] = 'Wednesday';
		$this->weekday[4] = 'Thursday';
		$this->weekday[5] = 'Friday';
		$this->weekday[6] = 'Saturday';

		// The first letter of each day.  The _%day%_initial suffix is a hack to make
		// sure the day initials are unique.
		$this->weekday_initial['Sunday']    = 'Sun';
		$this->weekday_initial['Monday']    = 'Mon';
		$this->weekday_initial['Tuesday']   = 'Tue';
		$this->weekday_initial['Wednesday'] = 'Wed';
		$this->weekday_initial['Thursday']  = 'Thu';
		$this->weekday_initial['Friday']    = 'Fri';
		$this->weekday_initial['Saturday']  = 'Sat';

		foreach ($this->weekday_initial as $weekday_ => $weekday_initial_) {
			$this->weekday_initial[$weekday_] = preg_replace('/_.+_initial$/', '', $weekday_initial_);
		}

		// Abbreviations for each day.
		$this->weekday_abbrev['Sunday']    = 'Sun';
		$this->weekday_abbrev['Monday']    = 'Mon';
		$this->weekday_abbrev['Tuesday']   = 'Tue';
		$this->weekday_abbrev['Wednesday'] = 'Wed';
		$this->weekday_abbrev['Thursday']  = 'Thu';
		$this->weekday_abbrev['Friday']    = 'Fri';
		$this->weekday_abbrev['Saturday']  = 'Sat';

		// The Months
		$this->month['01'] = 'January';
		$this->month['02'] = 'February';
		$this->month['03'] = 'March';
		$this->month['04'] = 'April';
		$this->month['05'] = 'May';
		$this->month['06'] = 'June';
		$this->month['07'] = 'July';
		$this->month['08'] = 'August';
		$this->month['09'] = 'September';
		$this->month['10'] = 'October';
		$this->month['11'] = 'November';
		$this->month['12'] = 'December';

		// Abbreviations for each month. Uses the same hack as above to get around the
		// 'May' duplication.
		$this->month_abbrev['January'] = 'Jan';
		$this->month_abbrev['February'] = 'Feb';
		$this->month_abbrev['March'] = 'Mar';
		$this->month_abbrev['April'] = 'Apr';
		$this->month_abbrev['May'] = 'May';
		$this->month_abbrev['June'] = 'Jun';
		$this->month_abbrev['July'] = 'Jul';
		$this->month_abbrev['August'] = 'Aug';
		$this->month_abbrev['September'] = 'Sep';
		$this->month_abbrev['October'] = 'Oct';
		$this->month_abbrev['November'] = 'Nov';
		$this->month_abbrev['December'] = 'Dec';

		foreach ($this->month_abbrev as $month_ => $month_abbrev_) {
			$this->month_abbrev[$month_] = preg_replace('/_.+_abbreviation$/', '', $month_abbrev_);
		}

と思ったら同じやり方が紹介されていたからこの方法でもいいんじゃないかと。
小粋空間: WordPress の月および曜日を英語表記にする

よく見たらコードがなんとなく違っているのは、WordPressのバージョンが違うからだと思います。
上にダラダラーと掲載しているのは現時点で最近版である2.7.1のものです。
自己責任でいんぐりもんぐりしてみよう。

4月7日追記
冒頭で触れた「.po」ファイルを書き換えて「.mo」に変換する方法が丁寧に紹介されています。
勿論こちらが正攻法。
迷わず行けよ!行けば分かるさ!!
WordPress の月や曜日を英語表記に – ぶっちろぐ

関連してるくさい記事

  1. TB 飛ばしたけど自動承認じゃーないぽいなw
    この記事みて俺もマネマネしてみたよ。
    日付が英表記なのに「月」とか気にくわなかったから犯した。
    po 弄って mo 作ってみた。
    良い感じわな。

    つかあれだよ、最近俺は error とんのパクリが多い希ガス。

    • >>BuCCi
      あれっと思って確認してみたけどTB届いてなかったぜ!?
      送信の際にピュニコードで引っ掛かってるか、こっちで受け取る時にTB関連のプラグインがなんかなってるのか…。
      というかエントリーを編集して直接リンク貼ってやんぜコノヤロー!!

  2. あらーそなのか trackback uri から URL ぱくってトラックバックとこずっぽしはめたんだけどなぁ。

    つかわざわざ編集噛ましてくれてサンコス!

    • >>BuCCi
      まぁ地味にTBとして表示されてるよりも同じことしたい人を誘導してあげるには記事中にあった方がいいしね。
      結果オーライ!!!!
      てゆかどう考えてもこっちの側の問題だよなぁ…。
      直すのメンドイぜwww

  1. 2009年 7月 13日
    トラックバック先 :ぶっちろぐ

Additional comments powered by BackType