| 64 | 'wp-frontend' => array( |
| 65 | 'description' => 'Translation of frontend strings in WordPress {version}', |
| 66 | 'copyright-holder' => 'WordPress', |
| 67 | 'package-name' => 'WordPress', |
| 68 | 'package-version' => '{version}', |
| 69 | ), |
| 70 | 'wp-site-admin' => array( |
| 71 | 'description' => 'Translation of site admin strings in WordPress {version}', |
| 72 | 'copyright-holder' => 'WordPress', |
| 73 | 'package-name' => 'WordPress', |
| 74 | 'package-version' => '{version}', |
| 75 | ), |
| 76 | 'wp-network-admin' => array( |
| 77 | 'description' => 'Translation of network admin strings in WordPress {version}', |
| 78 | 'copyright-holder' => 'WordPress', |
| 79 | 'package-name' => 'WordPress', |
| 80 | 'package-version' => '{version}', |
| 81 | ), |
| 82 | 'wp-user-admin' => array( |
| 83 | 'description' => 'Translation of user admin strings in WordPress {version}', |
| 84 | 'copyright-holder' => 'WordPress', |
| 85 | 'package-name' => 'WordPress', |
| 86 | 'package-version' => '{version}', |
| 87 | ), |
| 216 | if ( !file_exists( "$dir/wp-admin/user/about.php" ) ) { |
| 217 | // WP 3.3 or earlier. |
| 218 | return $this->wp_generic( $dir, array( |
| 219 | 'project' => 'wp-core', 'output' => $output, |
| 220 | ) ); |
| 221 | } else { |
| 222 | // WP 3.4 and later |
| 223 | // @todo check returns |
| 224 | $this->wp_frontend($dir, $output); |
| 225 | $this->wp_site_admin($dir, null); |
| 226 | $this->wp_network_admin($dir, null); |
| 227 | $this->wp_user_admin($dir, null); |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | function wp_frontend($dir, $output) { |
189 | | 'project' => 'wp-core', 'output' => $output, |
| 233 | 'project' => 'wp-frontend', 'output' => $output, |
| 234 | 'includes' => array(), 'excludes' => array( 'wp-admin/.*', 'wp-content/themes/twentyten/.*', 'wp-content/themes/twentyeleven/.*' ), |
| 235 | 'default_output' => 'wordpress.pot', |
| 236 | 'extract_not_gettexted' => false, |
| 240 | function wp_site_admin($dir, $output) { |
| 241 | $frontend_pot = tempnam( sys_get_temp_dir(), 'frontend.pot'); |
| 242 | if ( false === $frontend_pot ) return false; |
| 243 | |
| 244 | $frontend_result = $this->wp_frontend( $dir, $frontend_pot ); |
| 245 | if ( ! $frontend_result ) { |
| 246 | unlink( $frontend_pot ); |
| 247 | return false; |
| 248 | } |
| 249 | |
| 250 | $result = $this->wp_generic( $dir, array( |
| 251 | 'project' => 'wp-site-admin', 'output' => $output, |
| 252 | 'includes' => array( 'wp-admin/.*' ), 'excludes' => array( 'wp-admin/includes/continents-cities\.php', 'wp-admin/network/.*', 'wp-admin/user/.*' ), |
| 253 | 'default_output' => 'wordpress-site-admin.pot', |
| 254 | 'extract_not_gettexted' => false, |
| 255 | ) ); |
| 256 | |
| 257 | if ( ! $result ) { |
| 258 | return false; |
| 259 | } |
| 260 | |
| 261 | $common_pot = tempnam( sys_get_temp_dir(), 'common.pot' ); |
| 262 | if ( ! $common_pot ) { |
| 263 | unlink( $frontend_pot ); |
| 264 | return false; |
| 265 | } |
| 266 | $site_pot = realpath( is_null( $output ) ? 'wordpress-site-admin.pot' : $output ); |
| 267 | system( "msgcat --more-than=1 --use-first $frontend_pot $site_pot > $common_pot" ); |
| 268 | system( "msgcat -u --use-first $site_pot $common_pot -o $site_pot" ); |
| 269 | return true; |
| 270 | } |
| 271 | |
| 272 | function wp_network_admin($dir, $output) { |
| 273 | return $this->wp_generic( $dir, array( |
| 274 | 'project' => 'wp-network-admin', 'output' => $output, |
| 275 | 'includes' => array( 'wp-admin/network/.*' ), 'excludes' => array(), |
| 276 | 'default_output' => 'wordpress-network-admin.pot', |
| 277 | 'extract_not_gettexted' => false, |
| 278 | ) ); |
| 279 | } |
| 280 | |
| 281 | function wp_user_admin($dir, $output) { |
| 282 | return $this->wp_generic( $dir, array( |
| 283 | 'project' => 'wp-user-admin', 'output' => $output, |
| 284 | 'includes' => array( 'wp-admin/user/.*' ), 'excludes' => array(), |
| 285 | 'default_output' => 'wordpress-user-admin.pot', |
| 286 | 'extract_not_gettexted' => false, |
| 287 | ) ); |
| 288 | } |
| 289 | |