修正遗漏的语言项

修正GetText库无法读取mo文件的bug
This commit is contained in:
joyqi 2013-12-18 00:19:52 +08:00
parent 02b7eda2a7
commit 4bc3e9d97b
4 changed files with 29 additions and 14 deletions

View File

@ -214,7 +214,7 @@ $(document).ready(function () {
// 编辑预览切换
var edittab = $('.editor').prepend('<div class="wmd-edittab"><a href="#wmd-editarea" class="active">撰写</a><a href="#wmd-preview">预览</a></div>'),
var edittab = $('.editor').prepend('<div class="wmd-edittab"><a href="#wmd-editarea" class="active"><?php _e('撰写'); ?></a><a href="#wmd-preview"><?php _e('预览'); ?></a></div>'),
editarea = $(textarea.parent()).attr("id", "wmd-editarea");
$(".wmd-edittab a").click(function() {

View File

@ -27,7 +27,7 @@ Typecho_Widget::widget('Widget_Contents_Attachment_Edit')->to($attachment);
</p>
<div id="upload-panel" class="p">
<div class="upload-area">拖放替换文件到这里 或者 <a href="###" class="upload-file">选择文件替换</a></div>
<div class="upload-area"><?php _e('拖放文件到这里<br>或者 %s选择文件上传%s', '<a href="###" class="upload-file">', '</a>'); ?></div>
<ul id="file-list"></ul>
</div>
</div>

View File

@ -9,7 +9,7 @@
if ($user->logged > 0) {
_e('最后登录: %s', Typecho_I18n::dateWord($user->logged + $options->timezone, $options->gmtTime + $options->timezone));
}
?>" href="<?php $options->adminUrl('profile.php'); ?>" class="author"><?php $user->screenName(); ?></a><a class="exit" href="<?php $options->logoutUrl(); ?>"><?php _e('登出'); ?></a><a href="<?php $options->siteUrl(); ?>">网站</a>
?>" href="<?php $options->adminUrl('profile.php'); ?>" class="author"><?php $user->screenName(); ?></a><a class="exit" href="<?php $options->logoutUrl(); ?>"><?php _e('登出'); ?></a><a href="<?php $options->siteUrl(); ?>"><?php _e('网站'); ?></a>
</div>
</div>

View File

@ -78,17 +78,14 @@ class Typecho_I18n_GetText
// Caching can be turned off
$this->enable_cache = $enable_cache;
// $MAGIC1 = (int)0x950412de; //bug in PHP 5
$MAGIC1 = (int) - 1794895138;
// $MAGIC2 = (int)0xde120495; //bug
$MAGIC2 = (int) - 569244523;
$this->STREAM = @fopen($file, 'rb');
$magic = $this->readint();
if ($magic == $MAGIC1) {
$unpacked = unpack('c', $this->read(4));
$magic = array_shift($unpacked);
if (-34 == $magic) {
$this->BYTEORDER = 0;
} elseif ($magic == $MAGIC2) {
} elseif (-107 == $magic) {
$this->BYTEORDER = 1;
} else {
$this->error = 1; // not MO file
@ -103,6 +100,24 @@ class Typecho_I18n_GetText
$this->translations = $this->readint();
}
/**
* read
*
* @param mixed $count
* @access private
* @return void
*/
private function read($count)
{
$count = abs($count);
if ($count > 0) {
return fread($this->STREAM, $count);
}
return NULL;
}
/**
* Reads a 32bit Integer from the Stream
*
@ -111,7 +126,7 @@ class Typecho_I18n_GetText
*/
private function readint()
{
$end = unpack($this->BYTEORDER == 0 ? 'V' : 'N', fread($this->STREAM, 4));
$end = unpack($this->BYTEORDER == 0 ? 'V' : 'N', $this->read(4));
return array_shift($end);
}
@ -123,7 +138,7 @@ class Typecho_I18n_GetText
*/
private function readintarray($count)
{
return unpack(($this->BYTEORDER == 0 ? 'V' : 'N') . $count, fread($this->STREAM, 4 * $count));
return unpack(($this->BYTEORDER == 0 ? 'V' : 'N') . $count, $this->read(4 * $count));
}
/**