diff --git a/tools/i18n/not-gettexted.php b/tools/i18n/not-gettexted.php
index e8ae2c3..e896d71 100644
|
a
|
b
|
class NotGettexted { |
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | function make_string_aggregator($global_array_name, $filename) { |
| 71 | | $a = $global_array_name; |
| 72 | | return create_function('$string, $comment_id, $line_number', 'global $'.$a.'; $'.$a.'[] = array($string, $comment_id, '.var_export($filename, true).', $line_number);'); |
| | 71 | return array( new NotGettexted_Aggregator( $global_array_name, $filename ), 'aggregate' ); |
| 73 | 72 | } |
| 74 | 73 | |
| 75 | 74 | function make_mo_replacer($global_mo_name) { |
| 76 | | $m = $global_mo_name; |
| 77 | | return create_function('$token, $string', 'global $'.$m.'; return var_export($'.$m.'->translate($string), true);'); |
| | 75 | return array( new NotGettexted_Replacer( $global_mo_name ), 'replace' ); |
| 78 | 76 | } |
| 79 | 77 | |
| 80 | 78 | function walk_tokens(&$tokens, $string_action, $other_action, $register_action=null) { |
| … |
… |
class NotGettexted { |
| 222 | 220 | } |
| 223 | 221 | } |
| 224 | 222 | |
| | 223 | class NotGettexted_Aggregator { |
| | 224 | private $global_array_name; |
| | 225 | private $filename; |
| | 226 | |
| | 227 | public function __construct( $global_array_name, $filename ) { |
| | 228 | $this->global_array_name = $global_array_name; |
| | 229 | $this->filename = $filename; |
| | 230 | } |
| | 231 | |
| | 232 | public function aggregate( $string, $comment_id, $line_number ) { |
| | 233 | if ( ! is_array( $GLOBALS[ $this->global_array_name ] ) ) { |
| | 234 | $GLOBALS[ $this->global_array_name ] = array(); |
| | 235 | } |
| | 236 | $GLOBALS[ $this->global_array_name ] []= array( $string, $comment_id, $this->filename, $line_number ); |
| | 237 | } |
| | 238 | } |
| | 239 | |
| | 240 | class NotGettexted_Replacer { |
| | 241 | private $global_mo_name; |
| | 242 | |
| | 243 | public function __construct( $global_mo_name ) { |
| | 244 | $this->global_mo_name = $global_mo_name; |
| | 245 | } |
| | 246 | |
| | 247 | public function replace( $token, $string ) { |
| | 248 | if ( ! empty( $GLOBALS[ $this->global_mo_name ] ) ) { |
| | 249 | $mo = &$GLOBALS[ $this->global_mo_name ]; |
| | 250 | if ( is_object( $mo ) && method_exists( $mo, 'translate' ) ) { |
| | 251 | return var_export( $mo->translate( $string ), true ); |
| | 252 | } |
| | 253 | } |
| | 254 | } |
| | 255 | } |
| | 256 | |
| 225 | 257 | // run the CLI only if the file |
| 226 | 258 | // wasn't included |
| 227 | 259 | $included_files = get_included_files(); |
diff --git a/tools/i18n/t/NotGettextedTest.php b/tools/i18n/t/NotGettextedTest.php
index 22ac7b9..69b3e70 100644
|
a
|
b
|
require_once dirname( dirname( __FILE__ ) ) . '/not-gettexted.php'; |
| 10 | 10 | |
| 11 | 11 | class NotGettextedTest extends PHPUnit_Framework_TestCase { |
| 12 | 12 | |
| 13 | | function __construct() { |
| | 13 | function setUp() { |
| | 14 | parent::setUp(); |
| 14 | 15 | $this->ng = new NotGettexted; |
| 15 | 16 | } |
| 16 | 17 | |
diff --git a/tools/i18n/t/data/not-gettexted-0.mo b/tools/i18n/t/data/not-gettexted-0.mo
index 4042fb0..90cbd1b 100644
Binary files a/tools/i18n/t/data/not-gettexted-0.mo and b/tools/i18n/t/data/not-gettexted-0.mo differ
diff --git a/tools/i18n/t/data/not-gettexted-0.po b/tools/i18n/t/data/not-gettexted-0.po
index 606ac7e..326184c 100644
|
a
|
b
|
msgstr "" |
| 11 | 11 | |
| 12 | 12 | #. Not gettexted string WP_I18N_CONFIG |
| 13 | 13 | #: not-gettext-0.php:11 |
| 14 | | msgid " There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%s' class='button'>Create a Configuration File</a>" |
| 15 | | msgstr "Translation: There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%s' class='button'>Create a Configuration File</a>" |
| | 14 | msgid " There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='https://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%s' class='button'>Create a Configuration File</a>" |
| | 15 | msgstr "Translation: There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='https://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%s' class='button'>Create a Configuration File</a>" |
| 16 | 16 | |
| 17 | 17 | #. Not gettexted string WP_I18N_ERROR |
| 18 | 18 | #: not-gettext-0.php:11 |