Changeset 664567
- Timestamp:
- 02/06/2013 10:17:10 PM (13 years ago)
- Location:
- codestyling-localization/trunk
- Files:
-
- 5 edited
-
codestyling-localization.php (modified) (10 diffs)
-
includes/class-translationfile.php (modified) (12 diffs)
-
includes/locale-definitions.php (modified) (5 diffs)
-
languages/codestyling-localization-de_DE.mo (modified) (previous)
-
languages/codestyling-localization-de_DE.po (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
codestyling-localization/trunk/codestyling-localization.php
r641938 r664567 4 4 Plugin URI: http://www.code-styling.de/english/development/wordpress-plugin-codestyling-localization-en 5 5 Description: You can manage and edit all gettext translation files (*.po/*.mo) directly out of your WordPress Admin Center without any need of an external editor. It automatically detects the gettext ready components like <b>WordPress</b> itself or any <b>Plugin</b> / <b>Theme</b> supporting gettext, is able to scan the related source files and can assists you using <b>Google Translate API</b> or <b>Microsoft Translator API</b> during translation.This plugin supports <b>WordPress MU</b> and allows explicit <b>WPMU Plugin</b> translation too. It newly introduces ignore-case and regular expression search during translation. <b>BuddyPress</b> and <b>bbPress</b> as part of BuddyPress can be translated too. Produces transalation files are 100% compatible to <b>PoEdit</b>. 6 Version: 1.99. 296 Version: 1.99.30 7 7 Author: Heiko Rabe 8 8 Author URI: http://www.code-styling.de/english/ … … 48 48 //error_reporting(E_ALL|E_STRICT); 49 49 //@unlink(dirname(__FILE__).'/.htaccess'); 50 51 if (!defined('E_RECOVERABLE_ERROR')) 52 define('E_RECOVERABLE_ERROR', 4096); 53 if (!defined('E_DEPRECATED')) 54 define('E_DEPRECATED', 8192); 55 if (!defined('E_USER_DEPRECATED ')) 56 define('E_USER_DEPRECATED ', 16384); 50 57 51 58 function csp_split_url($url) { … … 103 110 //Attention: Google Chrome and Safari behave in different way (shared WebKit issue or all other are wrong?)! 104 111 list($csp_domain, $csp_target) = csp_split_url( ( function_exists("admin_url") ? rtrim(admin_url(), '/') : rtrim(get_site_url().'/wp-admin/', '/') ) ); 112 define('CSP_SELF_DOMAIN', $csp_domain); 105 113 if ( 106 114 stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false … … 2108 2116 function csp_po_init_per_user_trans() { 2109 2117 //process per user settings 2110 if ( defined('TRANSLATION_API_PER_USER') && (TRANSLATION_API_PER_USER === true) && current_user_can('manage_options')) {2118 if (is_user_logged_in() && defined('TRANSLATION_API_PER_USER') && (TRANSLATION_API_PER_USER === true) && current_user_can('manage_options')) { 2111 2119 $myself = wp_get_current_user(); 2112 2120 $func = function_exists('get_user_meta') ? 'get_user_meta' : 'get_usermeta'; … … 2317 2325 <li><a href="http://wordpress.org/extend/plugins/debug-bar/" target="_blank">Debug Bar</a> <small>(by wordpressdotorg)</small></li> 2318 2326 <li><a href="http://wordpress.org/extend/plugins/debug-bar-console/" target="_blank">Debug Bar Console</a> <small>(by koopersmith)</small></li> 2327 <li><a href="http://wordpress.org/extend/plugins/wp-piwik/" target="_blank">WP-Piwik</a> <small>(by braekling)</small></li> 2319 2328 </ul> 2320 2329 <?php … … 2415 2424 '/debug-bar/', 2416 2425 '/debug-bar-console/', 2417 '/localization/' 2426 '/localization/', 2427 '/wp-piwik/' 2418 2428 ); 2419 2429 foreach($valid as $slug) … … 2435 2445 if (isset($wp_scripts->registered[$token]->src) && !empty($wp_scripts->registered[$token]->src)) { 2436 2446 if (preg_match('|^http|', $wp_scripts->registered[$token]->src)) { 2437 if(!preg_match('|^'.str_replace('.','\.', get_site_url()).'|', $wp_scripts->registered[$token]->src)) {2447 if(!preg_match('|^'.str_replace('.','\.',CSP_SELF_DOMAIN).'|', $wp_scripts->registered[$token]->src)) { 2438 2448 if (in_array($token, $csp_known_wordpress_externals) || csp_known_and_valid_cdn($wp_scripts->registered[$token]->src)) { 2439 2449 if (!in_array($token, $csp_external_scripts['cdn']['tokens'])) { … … 2562 2572 } 2563 2573 } 2564 elseif (stripos($url[1], get_site_url()) === false && !in_array($url[1], $csp_external_scripts['cdn']['scripts'])) {2574 elseif (stripos($url[1], CSP_SELF_DOMAIN) === false && !in_array($url[1], $csp_external_scripts['cdn']['scripts'])) { 2565 2575 //external 2566 2576 $dirty_index[] = $i; … … 2614 2624 } 2615 2625 } 2616 elseif (stripos($url[1], get_site_url()) === false && !in_array($url[1], $csp_external_scripts['cdn']['scripts'])) {2626 elseif (stripos($url[1], CSP_SELF_DOMAIN) === false && !in_array($url[1], $csp_external_scripts['cdn']['scripts'])) { 2617 2627 //external 2618 2628 $dirty_index[] = $i; … … 3187 3197 foreach($rows as $data) : 3188 3198 ?> 3189 <tr<?php if ( preg_match("/^".__("activated",CSP_PO_TEXTDOMAIN)."/", $data['status'])) echo " class=\"csp-active\""; ?>>3199 <tr<?php if (__("activated",CSP_PO_TEXTDOMAIN) == $data['status']) echo " class=\"csp-active\""; ?>> 3190 3200 <td align="center"><img alt="" src="<?php echo CSP_PO_BASE_URL."/images/".$data['img_type'].".gif"; ?>" /><div><strong><?php echo $data['type-desc']; ?></strong></div></td> 3191 3201 <td> -
codestyling-localization/trunk/includes/class-translationfile.php
r629816 r664567 85 85 'Content-Transfer-Encoding' => '8bit', 86 86 'Plural-Forms' => 'nplurals=2; plural=n != 1;', 87 'X-Generator' => 'CSL v1.x', 87 88 'X-Poedit-Language' => '', 88 89 'X-Poedit-Country' => '', … … 95 96 ); 96 97 $this->header_vars = array_keys($this->header); 98 $this->mo_header_vars = array( 99 'PO-Revision-Date', 100 'MIME-Version', 101 'Content-Type', 102 'Content-Transfer-Encoding', 103 'Plural-Forms', 104 'X-Generator', 105 'Project-Id-Version' 106 ); 97 107 array_splice($this->header_vars, array_search('X-Poedit-KeywordsList', $this->header_vars), 1 ); 98 108 $this->plural_definitions = array( … … 127 137 } 128 138 129 function _set_header_from_string($head, $lang='' ) {139 function _set_header_from_string($head, $lang='', $mo_hdr_vars = false) { 130 140 if (!is_string($head)) return; 131 141 $hdr = explode("\n", $head); 142 $hdr_vars = $mo_hdr_vars ? $this->mo_header_vars : $this->header_vars; 132 143 foreach($hdr as $e) { 133 144 if ($this->strings->_strpos($e, ':') === false) continue; 134 145 list($key, $val) = explode(':', $e, 2); 135 146 $key = trim($key);$val = str_replace("\\","/", trim($val)); 136 if (in_array($key, $ this->header_vars)) {147 if (in_array($key, $hdr_vars)) { 137 148 $this->header[$key] = $val; 138 149 //ensure qualified pluralization forms now 139 if ($key == 'Plural-Forms' ) {150 if ($key == 'Plural-Forms' && !$mo_hdr_vars) { 140 151 $func = ''; 141 152 foreach($this->plural_definitions as $f => $langs) { … … 260 271 $country = strtoupper($country); 261 272 $this->_set_header_from_string( 262 "Project-Id-Version: $proj_id\nPO-Revision-Date: $timestamp\nLast-Translator: $translator\nX-Poedit-Language: $language\nX-Poedit-Country: $country\nX-Poedit-Basepath: $rel\nPlural-Forms: \nX-Textdomain-Support: yes ",273 "Project-Id-Version: $proj_id\nPO-Revision-Date: $timestamp\nLast-Translator: $translator\nX-Poedit-Language: $language\nX-Poedit-Country: $country\nX-Poedit-Basepath: $rel\nPlural-Forms: \nX-Textdomain-Support: yes\n", 263 274 $po_lang 264 275 ); … … 359 370 $po_lang = $this->strings->_substr($_POST['language'],0,2); 360 371 } 361 $this->_set_header_from_string("PO-Revision-Date: $stamp\nPlural-Forms: \nX-Textdomain-Support: $tds ", $po_lang);372 $this->_set_header_from_string("PO-Revision-Date: $stamp\nPlural-Forms: \nX-Textdomain-Support: $tds\n", $po_lang); 362 373 363 374 //write header if last because it has no code ref anyway … … 432 443 //update the revision date 433 444 $stamp = date("Y-m-d H:i:sO"); 434 $this->_set_header_from_string("PO-Revision-Date: $stamp\nPlural-Forms: \nX-Textdomain-Support: $tds ");445 $this->_set_header_from_string("PO-Revision-Date: $stamp\nPlural-Forms: \nX-Textdomain-Support: $tds\n"); 435 446 436 447 //write header if last because it has no code ref anyway … … 628 639 } 629 640 641 function _reduce_header_for_mofile() { 642 if (isset($this->map[''])) { 643 $header = $this->map['']; 644 645 $this->map[''] = $header; 646 } 647 } 648 630 649 function write_mofile($mofile, $textdomain) { 631 650 //handle WordPress continent cities patch to separate "Center" for UI and Continent/City use … … 635 654 $this->map["Center"] = $trans; 636 655 } 656 657 //reduce the mofile header 658 $mohdr = $this->map['']['T']; 659 $mohdr_h = $this->header; 660 $this->header = array(); 661 $this->_set_header_from_string($mohdr, '', true); 662 637 663 $handle = @fopen($mofile, "wb"); 638 if ($handle === false) return false; 664 if ($handle === false){ 665 $this->header = $mohdr_h; 666 $this->_set_header_from_string($mohdr, '', false); 667 return false; 668 } 639 669 ksort($this->map, SORT_REGULAR); 640 670 //let's calculate none empty values … … 669 699 fwrite($handle,$trans_table); 670 700 fclose($handle); 701 $this->header = $mohdr_h; 702 $this->_set_header_from_string($mohdr, '', false); 671 703 return true; 672 704 } … … 679 711 $this->map["Center"] = $trans; 680 712 } 713 714 //reduce the mofile header 715 $mohdr = $this->map['']['T']; 716 $mohdr_h = $this->header; 717 $this->header = array(); 718 $this->_set_header_from_string($mohdr, '', true); 681 719 682 720 $content = ''; … … 712 750 $content = substr_replace($content, $org_table, 28, strlen($org_table)); 713 751 $content = substr_replace($content, $trans_table, 28 + strlen($org_table), strlen($trans_table)); 752 $this->header = $mohdr_h; 753 $this->_set_header_from_string($mohdr, '', false); 714 754 return $content; 715 755 } … … 725 765 $func = array(&$this, '_reset_data'); 726 766 array_walk($this->map, $func); 727 $this->_set_header_from_string("X-Textdomain-Support: yes ");767 $this->_set_header_from_string("X-Textdomain-Support: yes\n"); 728 768 } 729 769 -
codestyling-localization/trunk/includes/locale-definitions.php
r551808 r664567 29 29 'hr' => array('hr_HR'), 30 30 'hu' => array('hu_HU'), 31 'hy' => array('hy_AM'), 31 32 'id' => array('id_ID'), 32 33 'in' => array('in_ID'), … … 97 98 'hr' => "Jezik", 98 99 'hu' => "Nyelv", 100 'hy' => "լեզու", 99 101 'id' => "Bahasa", 100 102 'in' => "Bahasa", … … 166 168 'hr' => "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);", 167 169 'hu' => "nplurals=1; plural=0;", 170 'hy' => "nplurals=2; plural=n != 1;", 168 171 'id' => "nplurals=2; plural=n != 1;", 169 172 'in' => "nplurals=2; plural=n != 1;", … … 196 199 'th' => "nplurals=1; plural=0;", 197 200 'tl' => "nplurals=2; plural=n != 1;", 198 'tr' => "nplurals= 1; plural=0;",201 'tr' => "nplurals=2; plural=(n>1);", 199 202 'uk' => "nplurals=3; plural=n%100/10==1 ? 2 : n%10==1 ? 0 : (n+9)%10>3 ? 2 : 1;", 200 203 'ug' => "nplurals=1; plural=0;", … … 1129 1132 'microsoft-api' => 'hu' 1130 1133 ), 1134 'hy_AM' => array ( 1135 'country' => "Armenia", 1136 'country-www' => 'hy', 1137 'lang' => 'Armenian', 1138 'lang-native' => 'հայերեն/Հայաստան', 1139 'lang-www' => 'hy-AM', 1140 'dir' => 'ltr', 1141 'ms-loc' => 'hy', 1142 'ms-cp' => 'CP1256', 1143 'google-api' => 'hy', 1144 'microsoft-api' => '' 1145 ), 1131 1146 'id_ID' => array ( 1132 1147 'country' => "Indonesia", -
codestyling-localization/trunk/languages/codestyling-localization-de_DE.po
r641938 r664567 1 1 msgid "" 2 2 msgstr "" 3 "Project-Id-Version: CodeStyling Localization v1.99. 29\n"3 "Project-Id-Version: CodeStyling Localization v1.99.30\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 5 "POT-Creation-Date: 2008-08-25 03:13+0100\n" 6 "PO-Revision-Date: 2012-12- 19 19:38:34+0000\n"6 "PO-Revision-Date: 2012-12-27 17:01:53+0000\n" 7 7 "Last-Translator: Heiko Rabe <[email protected]>\n" 8 8 "Language-Team: \n" … … 11 11 "Content-Transfer-Encoding: 8bit\n" 12 12 "Plural-Forms: nplurals=2; plural=n != 1;\n" 13 "X-Generator: CSL v1.x\n" 13 14 "X-Poedit-Language: German\n" 14 15 "X-Poedit-Country: GERMANY\n" … … 514 515 #: codestyling-localization.php:1752 515 516 #: codestyling-localization.php:1996 516 #: includes/class-translationfile.php:9 38517 #: includes/class-translationfile.php:970 517 518 #@ codestyling-localization 518 519 msgid "m/d/Y H:i:s" … … 557 558 #: codestyling-localization.php:3437 558 559 #: codestyling-localization.php:3467 559 #: includes/class-translationfile.php:9 38560 #: includes/class-translationfile.php:970 560 561 #@ codestyling-localization 561 562 msgid "unknown" … … 1743 1744 #: codestyling-localization.php:0 1744 1745 #@ codestyling-localization 1745 msgid "1.99. 29"1746 msgstr "" 1747 1746 msgid "1.99.30" 1747 msgstr "" 1748
Note: See TracChangeset
for help on using the changeset viewer.