Version Description
- Critical PHP < 5.4 compatibility bug fix
- Added option to exclude Fuzzy strings from MO files
Download this release
Release Info
Developer | timwhitlock |
Plugin | Loco Translate |
Version | 1.5.3 |
Comparing to | |
See all releases |
Code changes from version 1.5.2 to 1.5.3
- languages/loco-translate.pot +21 -17
- lib/compat/loco-iconv.php +2 -2
- lib/compat/loco-json.php +20 -0
- lib/compat/loco-mbstring.php +2 -2
- lib/compat/{loco-old-php.php → loco-php.php} +0 -0
- lib/compat/loco-tokenizer.php +4 -1
- lib/loco-admin.php +12 -5
- lib/loco-boot.php +4 -2
- lib/test/bootstrap.php +17 -1
- lib/test/tests/CompatTest.php +18 -8
- lib/test/tests/GettextTest.php +7 -2
- lib/test/tests/PhpVersionTest.php +17 -0
- loco.php +1 -1
- readme.txt +8 -3
- tpl/admin-opts.tpl.php +6 -0
languages/loco-translate.pot
CHANGED
@@ -5,7 +5,7 @@ msgstr ""
|
|
5 |
"Project-Id-Version: Loco Translate\n"
|
6 |
"Report-Msgid-Bugs-To: \n"
|
7 |
"POT-Creation-Date: Thu Jan 02 2014 17:30:57 GMT+0000 (GMT)\n"
|
8 |
-
"POT-Revision-Date:
|
9 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
10 |
"Last-Translator: \n"
|
11 |
"Language-Team: \n"
|
@@ -157,37 +157,37 @@ msgstr ""
|
|
157 |
msgid "%s untranslated"
|
158 |
msgstr ""
|
159 |
|
160 |
-
#: ../lib/loco-admin.php:
|
161 |
msgid "Failed to compile MO file with built-in compiler"
|
162 |
msgstr ""
|
163 |
|
164 |
-
#: ../lib/loco-admin.php:
|
165 |
msgid "Loco, Translation Management"
|
166 |
msgstr ""
|
167 |
|
168 |
-
#: ../lib/loco-admin.php:
|
169 |
msgid "Manage translations"
|
170 |
msgstr ""
|
171 |
|
172 |
-
#: ../lib/loco-admin.php:
|
173 |
msgid "Translation options"
|
174 |
msgstr ""
|
175 |
|
176 |
-
#: ../lib/loco-admin.php:
|
177 |
msgid "Loco Translate"
|
178 |
msgstr ""
|
179 |
|
180 |
-
#: ../lib/loco-admin.php:
|
181 |
#: tpl.php:7 ../tpl/admin-poedit.tpl.php:7 ../tpl/admin-poinit.tpl.php:7 ..
|
182 |
#: /tpl/admin-root.tpl.php:7
|
183 |
msgid "Settings"
|
184 |
msgstr ""
|
185 |
|
186 |
-
#: ../lib/loco-admin.php:
|
187 |
msgid "File download failed"
|
188 |
msgstr ""
|
189 |
|
190 |
-
#: ../lib/loco-admin.php:
|
191 |
msgid "WPLANG is deprecated and should be removed from wp-config.php"
|
192 |
msgstr ""
|
193 |
|
@@ -257,8 +257,8 @@ msgstr ""
|
|
257 |
msgid "%s has a strange POT file name (%s). A better name would be \"%s.pot\""
|
258 |
msgstr ""
|
259 |
|
260 |
-
#: ../lib/compat/loco-iconv.php:13 ../lib/compat/loco-
|
261 |
-
#: /lib/compat/loco-tokenizer.php:
|
262 |
#, php-format
|
263 |
msgid ""
|
264 |
"PHP extension \"%s\" is not installed. If you experience problems you should "
|
@@ -437,7 +437,7 @@ msgstr ""
|
|
437 |
msgid "Back"
|
438 |
msgstr ""
|
439 |
|
440 |
-
#: ../tpl/admin-fscheck.tpl.php:58 ../tpl/admin-opts.tpl.php:
|
441 |
msgid "Get help"
|
442 |
msgstr ""
|
443 |
|
@@ -510,23 +510,27 @@ msgstr ""
|
|
510 |
msgid "Generate hash tables"
|
511 |
msgstr ""
|
512 |
|
513 |
-
#: ../tpl/admin-opts.tpl.php:
|
|
|
|
|
|
|
|
|
514 |
msgid "Backing up PO files"
|
515 |
msgstr ""
|
516 |
|
517 |
-
#: ../tpl/admin-opts.tpl.php:
|
518 |
msgid "Number of backups to keep of each file:"
|
519 |
msgstr ""
|
520 |
|
521 |
-
#: ../tpl/admin-opts.tpl.php:
|
522 |
msgid "Experimental features"
|
523 |
msgstr ""
|
524 |
|
525 |
-
#: ../tpl/admin-opts.tpl.php:
|
526 |
msgid "Enable Wordpress core translations"
|
527 |
msgstr ""
|
528 |
|
529 |
-
#: ../tpl/admin-opts.tpl.php:
|
530 |
msgid "Save settings"
|
531 |
msgstr ""
|
532 |
|
5 |
"Project-Id-Version: Loco Translate\n"
|
6 |
"Report-Msgid-Bugs-To: \n"
|
7 |
"POT-Creation-Date: Thu Jan 02 2014 17:30:57 GMT+0000 (GMT)\n"
|
8 |
+
"POT-Revision-Date: Fri Jul 24 2015 17:03:20 GMT+0100 (BST)\n"
|
9 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
10 |
"Last-Translator: \n"
|
11 |
"Language-Team: \n"
|
157 |
msgid "%s untranslated"
|
158 |
msgstr ""
|
159 |
|
160 |
+
#: ../lib/loco-admin.php:1027
|
161 |
msgid "Failed to compile MO file with built-in compiler"
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: ../lib/loco-admin.php:1070 ../tpl/admin-nav.tpl.php:27
|
165 |
msgid "Loco, Translation Management"
|
166 |
msgstr ""
|
167 |
|
168 |
+
#: ../lib/loco-admin.php:1071 ../lib/loco-admin.php:1108
|
169 |
msgid "Manage translations"
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: ../lib/loco-admin.php:1072
|
173 |
msgid "Translation options"
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: ../lib/loco-admin.php:1079
|
177 |
msgid "Loco Translate"
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: ../lib/loco-admin.php:1109 ../tpl/admin-fscheck.tpl.php:8 ../tpl/admin-opts.
|
181 |
#: tpl.php:7 ../tpl/admin-poedit.tpl.php:7 ../tpl/admin-poinit.tpl.php:7 ..
|
182 |
#: /tpl/admin-root.tpl.php:7
|
183 |
msgid "Settings"
|
184 |
msgstr ""
|
185 |
|
186 |
+
#: ../lib/loco-admin.php:1133
|
187 |
msgid "File download failed"
|
188 |
msgstr ""
|
189 |
|
190 |
+
#: ../lib/loco-admin.php:1143
|
191 |
msgid "WPLANG is deprecated and should be removed from wp-config.php"
|
192 |
msgstr ""
|
193 |
|
257 |
msgid "%s has a strange POT file name (%s). A better name would be \"%s.pot\""
|
258 |
msgstr ""
|
259 |
|
260 |
+
#: ../lib/compat/loco-iconv.php:13 ../lib/compat/loco-json.php:13 ..
|
261 |
+
#: /lib/compat/loco-mbstring.php:13 ../lib/compat/loco-tokenizer.php:12
|
262 |
#, php-format
|
263 |
msgid ""
|
264 |
"PHP extension \"%s\" is not installed. If you experience problems you should "
|
437 |
msgid "Back"
|
438 |
msgstr ""
|
439 |
|
440 |
+
#: ../tpl/admin-fscheck.tpl.php:58 ../tpl/admin-opts.tpl.php:102
|
441 |
msgid "Get help"
|
442 |
msgstr ""
|
443 |
|
510 |
msgid "Generate hash tables"
|
511 |
msgstr ""
|
512 |
|
513 |
+
#: ../tpl/admin-opts.tpl.php:60
|
514 |
+
msgid "Include Fuzzy strings"
|
515 |
+
msgstr ""
|
516 |
+
|
517 |
+
#: ../tpl/admin-opts.tpl.php:67 ../tpl/admin-opts.tpl.php:71
|
518 |
msgid "Backing up PO files"
|
519 |
msgstr ""
|
520 |
|
521 |
+
#: ../tpl/admin-opts.tpl.php:75
|
522 |
msgid "Number of backups to keep of each file:"
|
523 |
msgstr ""
|
524 |
|
525 |
+
#: ../tpl/admin-opts.tpl.php:83 ../tpl/admin-opts.tpl.php:87
|
526 |
msgid "Experimental features"
|
527 |
msgstr ""
|
528 |
|
529 |
+
#: ../tpl/admin-opts.tpl.php:92
|
530 |
msgid "Enable Wordpress core translations"
|
531 |
msgstr ""
|
532 |
|
533 |
+
#: ../tpl/admin-opts.tpl.php:101
|
534 |
msgid "Save settings"
|
535 |
msgstr ""
|
536 |
|
lib/compat/loco-iconv.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
*/
|
6 |
|
7 |
|
8 |
-
function
|
9 |
return $str;
|
10 |
}
|
11 |
|
@@ -15,7 +15,7 @@ if( ! extension_loaded('iconv') && WP_DEBUG && ( ! defined('DOING_AJAX') || ! DO
|
|
15 |
|
16 |
if( ! function_exists('iconv') ){
|
17 |
function iconv( $in_charset = '', $out_charset = '', $str = '' ){
|
18 |
-
return
|
19 |
}
|
20 |
}
|
21 |
|
5 |
*/
|
6 |
|
7 |
|
8 |
+
function loco_compat_iconv( $in_charset, $out_charset, $str ){
|
9 |
return $str;
|
10 |
}
|
11 |
|
15 |
|
16 |
if( ! function_exists('iconv') ){
|
17 |
function iconv( $in_charset = '', $out_charset = '', $str = '' ){
|
18 |
+
return loco_compat_iconv( $in_charset, $out_charset, $str );
|
19 |
}
|
20 |
}
|
21 |
|
lib/compat/loco-json.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Polyfiller for missing PHP json extension.
|
4 |
+
* Simply avoids fatal errors. Doesn't attempt to really replace the functionality
|
5 |
+
*/
|
6 |
+
|
7 |
+
|
8 |
+
function loco_compat_json_encode( $value ){
|
9 |
+
return '{"error":{"code":-1,"message":"json extension is not installed"}}';
|
10 |
+
}
|
11 |
+
|
12 |
+
if( ! extension_loaded('json_encode') && WP_DEBUG && ( ! defined('DOING_AJAX') || ! DOING_AJAX ) ){
|
13 |
+
LocoAdmin::warning( sprintf( Loco::__('PHP extension "%s" is not installed. If you experience problems you should install it'), 'json_encode' ) );
|
14 |
+
}
|
15 |
+
|
16 |
+
if( ! function_exists('json_encode') ){
|
17 |
+
function json_encode( $value = '' ){
|
18 |
+
return loco_compat_json_encode( $value );
|
19 |
+
}
|
20 |
+
}
|
lib/compat/loco-mbstring.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
*/
|
6 |
|
7 |
|
8 |
-
function
|
9 |
return 'UTF-8';
|
10 |
}
|
11 |
|
@@ -15,7 +15,7 @@ if( ! extension_loaded('mbstring') && WP_DEBUG && ( ! defined('DOING_AJAX') || !
|
|
15 |
|
16 |
if( ! function_exists('mb_detect_encoding') ){
|
17 |
function mb_detect_encoding( $str = '', array $encoding_list = array(), $strict = false ){
|
18 |
-
return
|
19 |
}
|
20 |
}
|
21 |
|
5 |
*/
|
6 |
|
7 |
|
8 |
+
function loco_compat_mb_detect_encoding( $str, array $encoding_list, $strict ){
|
9 |
return 'UTF-8';
|
10 |
}
|
11 |
|
15 |
|
16 |
if( ! function_exists('mb_detect_encoding') ){
|
17 |
function mb_detect_encoding( $str = '', array $encoding_list = array(), $strict = false ){
|
18 |
+
return loco_compat_mb_detect_encoding( $str, $encoding_list, $strict );
|
19 |
}
|
20 |
}
|
21 |
|
lib/compat/{loco-old-php.php → loco-php.php}
RENAMED
File without changes
|
lib/compat/loco-tokenizer.php
CHANGED
@@ -4,6 +4,9 @@
|
|
4 |
* Simply avoids fatal errors. Doesn't attempt to really replace the functionality
|
5 |
*/
|
6 |
|
|
|
|
|
|
|
7 |
|
8 |
if( ! extension_loaded('tokenizer') && WP_DEBUG && ( ! defined('DOING_AJAX') || ! DOING_AJAX ) ){
|
9 |
LocoAdmin::warning( sprintf( Loco::__('PHP extension "%s" is not installed. If you experience problems you should install it'), 'tokenizer' ) );
|
@@ -11,6 +14,6 @@ if( ! extension_loaded('tokenizer') && WP_DEBUG && ( ! defined('DOING_AJAX') ||
|
|
11 |
|
12 |
if( ! function_exists('token_get_all') ){
|
13 |
function token_get_all(){
|
14 |
-
return
|
15 |
}
|
16 |
}
|
4 |
* Simply avoids fatal errors. Doesn't attempt to really replace the functionality
|
5 |
*/
|
6 |
|
7 |
+
function loco_compat_token_get_all(){
|
8 |
+
return array();
|
9 |
+
}
|
10 |
|
11 |
if( ! extension_loaded('tokenizer') && WP_DEBUG && ( ! defined('DOING_AJAX') || ! DOING_AJAX ) ){
|
12 |
LocoAdmin::warning( sprintf( Loco::__('PHP extension "%s" is not installed. If you experience problems you should install it'), 'tokenizer' ) );
|
14 |
|
15 |
if( ! function_exists('token_get_all') ){
|
16 |
function token_get_all(){
|
17 |
+
return loco_compat_token_get_all();
|
18 |
}
|
19 |
}
|
lib/loco-admin.php
CHANGED
@@ -79,9 +79,9 @@ abstract class LocoAdmin {
|
|
79 |
*/
|
80 |
public static function render_page_options(){
|
81 |
self::check_capability();
|
82 |
-
// update
|
83 |
if( isset($_POST['loco']) && is_array( $update = $_POST['loco'] ) ){
|
84 |
-
$update += array( 'gen_hash' => '0', 'enable_core' => '0' );
|
85 |
$args = Loco::config( $update );
|
86 |
$args['success'] = Loco::__('Settings saved');
|
87 |
}
|
@@ -988,7 +988,7 @@ abstract class LocoAdmin {
|
|
988 |
|
989 |
|
990 |
/**
|
991 |
-
* get configured path to external msgfmt command, including --no-hash
|
992 |
* @return string
|
993 |
*/
|
994 |
public static function msgfmt_command(){
|
@@ -1000,6 +1000,9 @@ abstract class LocoAdmin {
|
|
1000 |
if( ! $conf['gen_hash'] ){
|
1001 |
$cmd .= ' --no-hash';
|
1002 |
}
|
|
|
|
|
|
|
1003 |
return $cmd;
|
1004 |
}
|
1005 |
|
@@ -1014,7 +1017,8 @@ abstract class LocoAdmin {
|
|
1014 |
$conf = Loco::config();
|
1015 |
loco_require('build/gettext-compiled');
|
1016 |
$gen_hash = (bool) $conf['gen_hash'];
|
1017 |
-
$
|
|
|
1018 |
}
|
1019 |
catch( Exception $Ex ){
|
1020 |
error_log( $Ex->getMessage(), 0 );
|
@@ -1126,7 +1130,7 @@ function _loco_hook__wp_ajax_download(){
|
|
1126 |
extract( Loco::postdata() );
|
1127 |
if( isset($action) ){
|
1128 |
require Loco::basedir().'/php/loco-download.php';
|
1129 |
-
die( __('File download failed') );
|
1130 |
}
|
1131 |
}
|
1132 |
|
@@ -1162,4 +1166,7 @@ if( ! defined('WP_LANG_DIR') ){
|
|
1162 |
extension_loaded('mbstring') or loco_require('compat/loco-mbstring');
|
1163 |
extension_loaded('tokenizer') or loco_require('compat/loco-tokenizer');
|
1164 |
extension_loaded('iconv') or loco_require('compat/loco-iconv');
|
|
|
1165 |
|
|
|
|
79 |
*/
|
80 |
public static function render_page_options(){
|
81 |
self::check_capability();
|
82 |
+
// update application settings if posted
|
83 |
if( isset($_POST['loco']) && is_array( $update = $_POST['loco'] ) ){
|
84 |
+
$update += array( 'gen_hash' => '0', 'use_fuzzy' => '0', 'enable_core' => '0' );
|
85 |
$args = Loco::config( $update );
|
86 |
$args['success'] = Loco::__('Settings saved');
|
87 |
}
|
988 |
|
989 |
|
990 |
/**
|
991 |
+
* get configured path to external msgfmt command, including --no-hash and --use-fuzzy arguments
|
992 |
* @return string
|
993 |
*/
|
994 |
public static function msgfmt_command(){
|
1000 |
if( ! $conf['gen_hash'] ){
|
1001 |
$cmd .= ' --no-hash';
|
1002 |
}
|
1003 |
+
if( $conf['use_fuzzy'] ){
|
1004 |
+
$cmd .= ' --use-fuzzy';
|
1005 |
+
}
|
1006 |
return $cmd;
|
1007 |
}
|
1008 |
|
1017 |
$conf = Loco::config();
|
1018 |
loco_require('build/gettext-compiled');
|
1019 |
$gen_hash = (bool) $conf['gen_hash'];
|
1020 |
+
$use_fuzzy = (bool) $conf['use_fuzzy'];
|
1021 |
+
$mo = loco_msgfmt( $po, $gen_hash, $use_fuzzy );
|
1022 |
}
|
1023 |
catch( Exception $Ex ){
|
1024 |
error_log( $Ex->getMessage(), 0 );
|
1130 |
extract( Loco::postdata() );
|
1131 |
if( isset($action) ){
|
1132 |
require Loco::basedir().'/php/loco-download.php';
|
1133 |
+
die( Loco::__('File download failed') );
|
1134 |
}
|
1135 |
}
|
1136 |
|
1166 |
extension_loaded('mbstring') or loco_require('compat/loco-mbstring');
|
1167 |
extension_loaded('tokenizer') or loco_require('compat/loco-tokenizer');
|
1168 |
extension_loaded('iconv') or loco_require('compat/loco-iconv');
|
1169 |
+
extension_loaded('json') or loco_require('compat/loco-json');
|
1170 |
|
1171 |
+
// emergency polyfills for php<5.4
|
1172 |
+
version_compare( phpversion(), '5.4', '>=' ) or loco_require('compat/loco-php');
|
lib/loco-boot.php
CHANGED
@@ -9,7 +9,7 @@ abstract class Loco {
|
|
9 |
const NS = 'loco-translate';
|
10 |
|
11 |
/** plugin version */
|
12 |
-
const VERSION = '1.5.
|
13 |
|
14 |
/* current plugin locale */
|
15 |
private static $locale;
|
@@ -290,8 +290,10 @@ abstract class Loco {
|
|
290 |
'use_msgfmt' => false,
|
291 |
// which external msgfmt command to use
|
292 |
'which_msgfmt' => '',
|
293 |
-
// whether to compile hash table into
|
294 |
'gen_hash' => '0',
|
|
|
|
|
295 |
// number of backups to keep of PO and MO files
|
296 |
'num_backups' => '1',
|
297 |
// whether to enable core package translation
|
9 |
const NS = 'loco-translate';
|
10 |
|
11 |
/** plugin version */
|
12 |
+
const VERSION = '1.5.3';
|
13 |
|
14 |
/* current plugin locale */
|
15 |
private static $locale;
|
290 |
'use_msgfmt' => false,
|
291 |
// which external msgfmt command to use
|
292 |
'which_msgfmt' => '',
|
293 |
+
// whether to compile hash table into MO files
|
294 |
'gen_hash' => '0',
|
295 |
+
// whether to include Fuzzy strings in MO files
|
296 |
+
'use_fuzzy' => '1',
|
297 |
// number of backups to keep of PO and MO files
|
298 |
'num_backups' => '1',
|
299 |
// whether to enable core package translation
|
lib/test/bootstrap.php
CHANGED
@@ -86,4 +86,20 @@ define('WP_PLUGIN_DIR', __DIR__.'/../../..' );
|
|
86 |
|
87 |
require __DIR__.'/../../loco.php';
|
88 |
|
89 |
-
loco_require(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
require __DIR__.'/../../loco.php';
|
88 |
|
89 |
+
loco_require (
|
90 |
+
// top-level classes
|
91 |
+
'loco-boot',
|
92 |
+
'loco-admin',
|
93 |
+
// core library classes
|
94 |
+
'loco-locales',
|
95 |
+
'loco-packages',
|
96 |
+
// all compiled libraries
|
97 |
+
'build/gettext-compiled',
|
98 |
+
'build/shell-compiled',
|
99 |
+
// all compatibilty polyfills
|
100 |
+
'compat/loco-tokenizer',
|
101 |
+
'compat/loco-mbstring',
|
102 |
+
'compat/loco-iconv',
|
103 |
+
'compat/loco-json',
|
104 |
+
'compat/loco-php'
|
105 |
+
);
|
lib/test/tests/CompatTest.php
CHANGED
@@ -3,18 +3,28 @@
|
|
3 |
* @group compat
|
4 |
*/
|
5 |
class CompatText extends PHPUnit_Framework_TestCase {
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
public function testDummyDetectEncodingAlwaysUtf8(){
|
10 |
-
$this->assertSame( 'UTF-8',
|
11 |
}
|
12 |
|
13 |
|
14 |
public function testDummyIconvReturnsInput(){
|
15 |
-
$this->assertSame( 'OK',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
20 |
}
|
3 |
* @group compat
|
4 |
*/
|
5 |
class CompatText extends PHPUnit_Framework_TestCase {
|
6 |
+
|
7 |
+
|
|
|
8 |
public function testDummyDetectEncodingAlwaysUtf8(){
|
9 |
+
$this->assertSame( 'UTF-8', loco_compat_mb_detect_encoding( 'whatever', array(), true ) );
|
10 |
}
|
11 |
|
12 |
|
13 |
public function testDummyIconvReturnsInput(){
|
14 |
+
$this->assertSame( 'OK', loco_compat_iconv('anything','whatever','OK') );
|
15 |
+
}
|
16 |
+
|
17 |
+
|
18 |
+
public function testDummyJsonEncodeReturnsError(){
|
19 |
+
$json = loco_compat_json_encode('anything');
|
20 |
+
$data = json_decode( $json, true );
|
21 |
+
$this->assertSame( array('error'=>array('code'=>-1,'message'=>'json extension is not installed')), $data );
|
22 |
}
|
23 |
+
|
24 |
+
|
25 |
+
public function testDummyTokenizerReturnsEmptyArray(){
|
26 |
+
$tokens = loco_compat_token_get_all('anything');
|
27 |
+
$this->assertSame( array(), $tokens );
|
28 |
+
}
|
29 |
+
|
30 |
}
|
lib/test/tests/GettextTest.php
CHANGED
@@ -26,12 +26,17 @@ class GettextTest extends PHPUnit_Framework_TestCase {
|
|
26 |
|
27 |
/**
|
28 |
* Test native MO writer
|
29 |
-
* @depends testParsePO
|
30 |
*/
|
31 |
-
public function testNativeMsgfmt(
|
|
|
|
|
|
|
|
|
32 |
$bin = loco_msgfmt( $po );
|
33 |
$this->assertStringStartsWith( "\xDE\x12\x04\x95\0\0\0\0", $bin, 'Bad magic number encoding' );
|
34 |
$this->assertStringEndsWith( "\0", $bin, 'Bad mo file ending' );
|
|
|
|
|
35 |
}
|
36 |
|
37 |
|
26 |
|
27 |
/**
|
28 |
* Test native MO writer
|
|
|
29 |
*/
|
30 |
+
public function testNativeMsgfmt(){
|
31 |
+
$po = array(
|
32 |
+
array( 'source' => '', 'target' => 'Project-Id-Version: Test' ),
|
33 |
+
array( 'source' => '__Foo__', 'target' => '__Bar__' ),
|
34 |
+
);
|
35 |
$bin = loco_msgfmt( $po );
|
36 |
$this->assertStringStartsWith( "\xDE\x12\x04\x95\0\0\0\0", $bin, 'Bad magic number encoding' );
|
37 |
$this->assertStringEndsWith( "\0", $bin, 'Bad mo file ending' );
|
38 |
+
$this->assertContains( '__Foo__', $bin );
|
39 |
+
$this->assertContains( '__Bar__', $bin );
|
40 |
}
|
41 |
|
42 |
|
lib/test/tests/PhpVersionTest.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @group compat
|
4 |
+
*/
|
5 |
+
class PhpVersionTest extends PHPUnit_Framework_TestCase {
|
6 |
+
|
7 |
+
|
8 |
+
/*public function testPhp54BracketSyntax(){
|
9 |
+
$ok = [];
|
10 |
+
}*/
|
11 |
+
|
12 |
+
public function testPhpIsAtLeast53(){
|
13 |
+
$this->assertTrue( version_compare( phpversion(), '5.4', '>=' ) );
|
14 |
+
}
|
15 |
+
|
16 |
+
|
17 |
+
}
|
loco.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Loco Translate
|
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/loco-translate
|
5 |
Description: Translate Wordpress plugins and themes directly in your browser
|
6 |
Author: Tim Whitlock
|
7 |
-
Version: 1.5.
|
8 |
Author URI: http://localise.biz/help/wordpress/translate-plugin
|
9 |
Text Domain: loco-translate
|
10 |
Domain Path: /languages/
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/loco-translate
|
5 |
Description: Translate Wordpress plugins and themes directly in your browser
|
6 |
Author: Tim Whitlock
|
7 |
+
Version: 1.5.3
|
8 |
Author URI: http://localise.biz/help/wordpress/translate-plugin
|
9 |
Text Domain: loco-translate
|
10 |
Domain Path: /languages/
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: timwhitlock
|
3 |
Tags: translation, translators, localization, localisation, l10n, i18n, Gettext, PO, MO, productivity
|
4 |
Requires at least: 3.5
|
5 |
-
Tested up to: 4.2.
|
6 |
-
Stable tag: 1.5.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -133,9 +133,14 @@ If you have a suggestion on how to improve the experience of using Loco Translat
|
|
133 |
|
134 |
== Changelog ==
|
135 |
|
|
|
|
|
|
|
|
|
136 |
= 1.5.2 =
|
137 |
* Handle locale codes used wrongly in POT file names
|
138 |
* Added French, Brazilian Portuguese, Persian, Japanese and Spanish translations. Updated Turkish and German
|
|
|
139 |
|
140 |
= 1.5.1 =
|
141 |
* Better handling of incorrectly named POT files
|
@@ -255,7 +260,7 @@ If you have a suggestion on how to improve the experience of using Loco Translat
|
|
255 |
|
256 |
== Upgrade Notice ==
|
257 |
|
258 |
-
= 1.5.
|
259 |
* Bug fixes and improvements.
|
260 |
|
261 |
|
2 |
Contributors: timwhitlock
|
3 |
Tags: translation, translators, localization, localisation, l10n, i18n, Gettext, PO, MO, productivity
|
4 |
Requires at least: 3.5
|
5 |
+
Tested up to: 4.2.3
|
6 |
+
Stable tag: 1.5.3
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
133 |
|
134 |
== Changelog ==
|
135 |
|
136 |
+
= 1.5.3 =
|
137 |
+
* Critical PHP < 5.4 compatibility bug fix
|
138 |
+
* Added option to exclude Fuzzy strings from MO files
|
139 |
+
|
140 |
= 1.5.2 =
|
141 |
* Handle locale codes used wrongly in POT file names
|
142 |
* Added French, Brazilian Portuguese, Persian, Japanese and Spanish translations. Updated Turkish and German
|
143 |
+
* Note that this release is broken for PHP < 5.4
|
144 |
|
145 |
= 1.5.1 =
|
146 |
* Better handling of incorrectly named POT files
|
260 |
|
261 |
== Upgrade Notice ==
|
262 |
|
263 |
+
= 1.5.3 =
|
264 |
* Bug fixes and improvements.
|
265 |
|
266 |
|
tpl/admin-opts.tpl.php
CHANGED
@@ -54,6 +54,12 @@ $nav = array (
|
|
54 |
<?php Loco::h( Loco::__('Generate hash tables') )?>
|
55 |
</label>
|
56 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
</fieldset>
|
58 |
</td>
|
59 |
</tr>
|
54 |
<?php Loco::h( Loco::__('Generate hash tables') )?>
|
55 |
</label>
|
56 |
</p>
|
57 |
+
<p>
|
58 |
+
<label for="loco--use-fuzzy">
|
59 |
+
<input type="checkbox" name="loco[use_fuzzy]" value="1" id="loco--use-fuzzy"<?php echo $use_fuzzy ? ' checked' : '';?> />
|
60 |
+
<?php Loco::h( Loco::__('Include Fuzzy strings') )?>
|
61 |
+
</label>
|
62 |
+
</p>
|
63 |
</fieldset>
|
64 |
</td>
|
65 |
</tr>
|