+ Reply to Thread
Results 1 to 5 of 5

Thread: For all those with Wordpress language issues.

  1. #1
    Join Date
    Jan 2008
    Location
    Brazil
    Posts
    21

    Default For all those with Wordpress language issues.

    It seems that thereīs an issue with the gettext library and wordpress running on x64 based machine. Basically itīs a byte addressing issue regarding the language files located at wp-includes/languages. The system cannot read the .mo file them it loads default english captions.

    For Wordpress 2.3.2 open wp-includes/gettext.php and at line 105 find:
    Code:
    		// Caching can be turned off
    		$this->enable_cache = $enable_cache;
    
    		// $MAGIC1 = (int)0x950412de; //bug in PHP 5.0.2, see https://savannah.nongnu.org/bugs/?func=detailitem&item_id=10565
    		$MAGIC1 = (int) - 1794895138;
    		// $MAGIC2 = (int)0xde120495; //bug
    		$MAGIC2 = (int) - 569244523;
    		// 64-bit fix
    		$MAGIC3 = (int) 2500072158;
    
    		$this->STREAM = $Reader;
    		$magic = $this->readint();
    		if ($magic == ($MAGIC1 & 0xFFFFFFFF) || $magic == ($MAGIC3 & 0xFFFFFFFF)) { // to make sure it works for 64-bit platforms
    			$this->BYTEORDER = 0;
    		} elseif ($magic == ($MAGIC2 & 0xFFFFFFFF)) {
    			$this->BYTEORDER = 1;
    		} else {
    			$this->error = 1; // not MO file
    			return false;
    		}
    Then change it to:
    Code:
    		// Caching can be turned off
    		$this->enable_cache = $enable_cache;
    
    		// $MAGIC1 = (int)0x950412de; //bug in PHP 5.0.2, see https://savannah.nongnu.org/bugs/?func=detailitem&item_id=10565
    		$MAGIC1 = (int) - 1794895138;
    		// $MAGIC2 = (int)0xde120495; //bug
    		$MAGIC2 = (int) - 569244523;
    		// 64-bit fix
    		$MAGIC3 = (int) 2500072158;
    
    		$this->STREAM = $Reader;
    		$magic = $this->readint();
    		if ($magic == $MAGIC1 || $magic == $MAGIC3) { // <- 64 BIT FIX: CHANGE THIS LINE!
    			$this->BYTEORDER = 0;
    		} elseif ($magic == ($MAGIC2)) {
    			$this->BYTEORDER = 1;
    		} else {
    			$this->error = 1; // not MO file
    			return false;
    		}
    Note the "& 0xFFFFFFFF"s have to be wiped out. Now Wordpress can recognize your .mo file under x64 architecture machines and load the correct language file. Please test it and post any questions, for me it worked.
    P.S: Based upon wordpress and gettext forum threads.
    Last edited by Diogenes; 01-17-2008 at 04:06 AM. Reason: This fix does apply to 2.3.2 version of wordpress

  2. #2
    Early Out's Avatar
    Early Out is offline Former Moderator, Still Respected
    Join Date
    Mar 2006
    Location
    Sector R
    Posts
    4,650

    Default

    Diogenes, many thanks for posting this. For many of us, we never have to deal with language issues (or even worse, character encoding), so we're ill-equipped to help people who are having problems in that area.

    I designed a skin for JAlbum, and one of the users was having trouble getting it to display the proper characters in the title bar on the page - in Chinese! To say that I wasn't much help would be an understatement.

  3. #3
    Join Date
    Jan 2008
    Location
    Brazil
    Posts
    21

    Default

    Diogenes, many thanks for posting this. For many of us, we never have to deal with language issues (or even worse, character encoding), so we're ill-equipped to help people who are having problems in that area.

    I designed a skin for JAlbum, and one of the users was having trouble getting it to display the proper characters in the title bar on the page - in Chinese! To say that I wasn't much help would be an understatement.
    Youīre Welcome! It worked for me and I wanted to share with you all.
    Last edited by felgall; 01-26-2008 at 10:31 AM.

  4. #4
    Join Date
    Jul 2007
    Location
    Brazil
    Posts
    4

    Thumbs up

    Men you salve my life, thanks for the answer to that strange behavior

  5. #5
    Join Date
    Jan 2008
    Location
    Brazil
    Posts
    21

    Default

    News!

    Wordpress people has released a fixed version of their software. Check at www.wordpress.org, version 2.3.3 has some security related fixes and the language issue resolved.

    If anyone could test it under bluehost, please post here

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts