Loco Translate - Version 1.2.2

Version Description

  • Fixed incorrect plural equation offset
  • Compacted pre-compiled locale data
  • Added settings link from plugin meta row
Download this release

Release Info

Developer timwhitlock
Plugin Icon 128x128 Loco Translate
Version 1.2.2
Comparing to
See all releases

Code changes from version 1.2.1 to 1.2.2

Files changed (5) hide show
  1. lib/loco-admin.php +8 -2
  2. lib/loco-boot.php +1 -1
  3. lib/loco-locales.php +7 -3
  4. loco.php +1 -1
  5. readme.txt +6 -1
lib/loco-admin.php CHANGED
@@ -158,8 +158,13 @@ abstract class LocoAdmin {
158
  $update = '';
159
  if( $updates = get_site_transient('update_plugins') ){
160
  $key = Loco::NS.'/loco.php';
161
- if( isset($updates->checked[$key]) && 1 === version_compare( $updates->checked[$key], Loco::VERSION ) ){
162
- $update = $updates->checked[$key];
 
 
 
 
 
163
  }
164
  }
165
  Loco::render('admin-root', compact('themes','plugins','update') );
@@ -800,6 +805,7 @@ function _loco_hook__admin_menu() {
800
  function _loco_hook__plugin_row_meta( $links, $file = '' ){
801
  if( false !== strpos($file,'/loco.php') ){
802
  $links[] = '<a href="tools.php?page='.Loco::NS.'"><strong>'.Loco::__('Manage translations').'</strong></a>';
 
803
  }
804
  return $links;
805
  }
158
  $update = '';
159
  if( $updates = get_site_transient('update_plugins') ){
160
  $key = Loco::NS.'/loco.php';
161
+ if( isset($updates->checked[$key]) && isset($updates->response[$key]) ){
162
+ $old = $updates->checked[$key];
163
+ $new = $updates->response[$key]->new_version;
164
+ if( 1 === version_compare( $new, $old ) ){
165
+ // current version is lower than latest
166
+ $update = $new;
167
+ }
168
  }
169
  }
170
  Loco::render('admin-root', compact('themes','plugins','update') );
805
  function _loco_hook__plugin_row_meta( $links, $file = '' ){
806
  if( false !== strpos($file,'/loco.php') ){
807
  $links[] = '<a href="tools.php?page='.Loco::NS.'"><strong>'.Loco::__('Manage translations').'</strong></a>';
808
+ $links[] = '<a href="options-general.php?page='.Loco::NS.'"><strong>'.Loco::__('Settings').'</strong></a>';
809
  }
810
  return $links;
811
  }
lib/loco-boot.php CHANGED
@@ -8,7 +8,7 @@ abstract class Loco {
8
  /** plugin namespace */
9
  const NS = 'loco-translate';
10
 
11
- const VERSION = '1.2.1';
12
  const CAPABILITY = 'manage_options';
13
 
14
  /* whether to enable APC cache */
8
  /** plugin namespace */
9
  const NS = 'loco-translate';
10
 
11
+ const VERSION = '1.2.2';
12
  const CAPABILITY = 'manage_options';
13
 
14
  /* whether to enable APC cache */
lib/loco-locales.php CHANGED
@@ -84,7 +84,8 @@ final class LocoLocale {
84
  */
85
  public static function init( $lc, $cc ){
86
  // pre-compiled locale data
87
- static $plurals = array ( 0 => '(n != 1)', 1 => 'n == 1 ? 0 : 1', 2 => '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)', 3 => '(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2', 4 => '(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2)', 5 => '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 or n%100>=20) ? 1 : 2)', 6 => '(n==1 ? 0 : n==0 || ( n%100>1 && n%100<11) ? 1 : (n%100>10 && n%100<20 ) ? 2 : 3)', 7 => '(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)', 8 => '(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2)', 9 => '(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0)', 10 => 0, 11 => '(n > 1)', 12 => '(n%10!=1 || n%100==11)', 13 => 'n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5', 14 => '(n>1)', 15 => '(n==1) ? 0 : (n==2) ? 1 : (n != 8 && n != 11) ? 2 : 3', 16 => 'n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : 4', 17 => 'n!=0', 18 => '(n!=1)', 19 => 'n != 1', ), $locales = array ( 'en' => array ( 'GB' => array ( 0 => 'English (UK)', 1 => 2, 2 => 0, ), 'IE' => array ( 0 => 'English (Ireland)', 1 => 2, 2 => 0, ), 'US' => array ( 0 => 'English (USA)', 1 => 2, 2 => 0, ), 'CA' => array ( 0 => 'English (Canada)', 1 => 2, 2 => 0, ), 'AU' => array ( 0 => 'English (Australia)', 1 => 2, 2 => 0, ), 'NZ' => array ( 0 => 'English (New Zealand)', 1 => 2, 2 => 0, ), 'HK' => array ( 0 => 'English (Hong Kong)', 1 => 2, 2 => 0, ), 'SG' => array ( 0 => 'English (Singapore)', 1 => 2, 2 => 0, ), 'AE' => array ( 0 => 'English (United Arab Emirates)', 1 => 2, 2 => 0, ), 'ZA' => array ( 0 => 'English (South Africa)', 1 => 2, 2 => 0, ), 'IN' => array ( 0 => 'English (India)', 1 => 2, 2 => 0, ), ), 'fr' => array ( 'FR' => array ( 0 => 'French', 1 => 2, 2 => 1, ), 'CH' => array ( 0 => 'French (Switzerland)', 1 => 2, 2 => 1, ), 'BE' => array ( 0 => 'French (Belgium)', 1 => 2, 2 => 1, ), 'HT' => array ( 0 => 'French (Haiti)', 1 => 2, 2 => 1, ), 'CA' => array ( 0 => 'French (Canada)', 1 => 2, 2 => 1, ), ), 'it' => array ( 'IT' => array ( 0 => 'Italian', 1 => 2, 2 => 0, ), 'CH' => array ( 0 => 'Italian (Switzerland)', 1 => 2, 2 => 0, ), ), 'de' => array ( 'DE' => array ( 0 => 'German', 1 => 2, 2 => 0, ), 'CH' => array ( 0 => 'German (Switzerland)', 1 => 2, 2 => 0, ), 'AT' => array ( 0 => 'German (Austria)', 1 => 2, 2 => 0, ), ), 'es' => array ( 'ES' => array ( 0 => 'Spanish', 1 => 2, 2 => 0, ), 'MX' => array ( 0 => 'Spanish (Mexico)', 1 => 2, 2 => 0, ), 'AR' => array ( 0 => 'Spanish (Argentina)', 1 => 2, 2 => 0, ), 'BO' => array ( 0 => 'Spanish (Bolivia)', 1 => 2, 2 => 0, ), 'CL' => array ( 0 => 'Spanish (Chile)', 1 => 2, 2 => 0, ), 'CO' => array ( 0 => 'Spanish (Colombia)', 1 => 2, 2 => 0, ), 'CR' => array ( 0 => 'Spanish (Costa Rica)', 1 => 2, 2 => 0, ), 'CU' => array ( 0 => 'Spanish (Cuba)', 1 => 2, 2 => 0, ), 'DO' => array ( 0 => 'Spanish (Dominican Republic)', 1 => 2, 2 => 0, ), 'EC' => array ( 0 => 'Spanish (Ecuador)', 1 => 2, 2 => 0, ), 'SV' => array ( 0 => 'Spanish (El Salvador)', 1 => 2, 2 => 0, ), 'GT' => array ( 0 => 'Spanish (Guatemala)', 1 => 2, 2 => 0, ), 'HN' => array ( 0 => 'Spanish (Honduras)', 1 => 2, 2 => 0, ), 'NI' => array ( 0 => 'Spanish (Nicaragua)', 1 => 2, 2 => 0, ), 'PA' => array ( 0 => 'Spanish (Panama)', 1 => 2, 2 => 0, ), 'PY' => array ( 0 => 'Spanish (Paraguay)', 1 => 2, 2 => 0, ), 'PE' => array ( 0 => 'Spanish (Peru)', 1 => 2, 2 => 0, ), 'UY' => array ( 0 => 'Spanish (Uruguay)', 1 => 2, 2 => 0, ), 'VE' => array ( 0 => 'Spanish (Venezuela)', 1 => 2, 2 => 0, ), ), 'pt' => array ( 'PT' => array ( 0 => 'Portuguese', 1 => 2, 2 => 0, ), 'BR' => array ( 0 => 'Portuguese (Brazil)', 1 => 2, 2 => 0, ), ), 'ru' => array ( 'RU' => array ( 0 => 'Russian', 1 => 3, 2 => 2, ), 'UA' => array ( 0 => 'Russian (Ukraine)', 1 => 3, 2 => 2, ), ), 'sv' => array ( 'SE' => array ( 0 => 'Swedish', 1 => 2, 2 => 0, ), ), 'no' => array ( 'NO' => array ( 0 => 'Norwegian', 1 => 2, 2 => 0, ), ), 'da' => array ( 'DK' => array ( 0 => 'Danish', 1 => 2, 2 => 0, ), ), 'fi' => array ( 'FI' => array ( 0 => 'Finnish', 1 => 2, 2 => 1, ), ), 'nl' => array ( 'BE' => array ( 0 => 'Dutch (Belgium)', 1 => 2, 2 => 0, ), 'NL' => array ( 0 => 'Dutch', 1 => 2, 2 => 0, ), ), 'bg' => array ( 'BG' => array ( 0 => 'Bulgarian', 1 => 2, 2 => 0, ), ), 'cs' => array ( 'CZ' => array ( 0 => 'Czech', 1 => 3, 2 => 3, ), ), 'et' => array ( 'EE' => array ( 0 => 'Estonian', 1 => 2, 2 => 0, ), ), 'el' => array ( 'GR' => array ( 0 => 'Greek', 1 => 2, 2 => 0, ), 'CY' => array ( 0 => 'Greek (Cyprus)', 1 => 2, 2 => 0, ), ), 'hu' => array ( 'HU' => array ( 0 => 'Hungarian', 1 => 2, 2 => 0, ), ), 'lv' => array ( 'LV' => array ( 0 => 'Latvian', 1 => 3, 2 => 4, ), ), 'lt' => array ( 'LT' => array ( 0 => 'Lithuanian', 1 => 3, 2 => 5, ), ), 'lb' => array ( 'LU' => array ( 0 => 'Luxembourgish', 1 => 2, 2 => 0, ), ), 'mt' => array ( 'MT' => array ( 0 => 'Maltese', 1 => 4, 2 => 6, ), ), 'pl' => array ( 'PL' => array ( 0 => 'Polish', 1 => 3, 2 => 7, ), ), 'ro' => array ( 'RO' => array ( 0 => 'Romanian', 1 => 3, 2 => 8, ), ), 'sk' => array ( 'SK' => array ( 0 => 'Slovak', 1 => 3, 2 => 3, ), ), 'sl' => array ( 'SI' => array ( 0 => 'Slovenian', 1 => 4, 2 => 9, ), ), 'ht' => array ( 'HT' => array ( 0 => 'Haitian Creole', 1 => 2, 2 => 1, ), ), 'gn' => array ( 'PY' => array ( 0 => 'Guarani (Paraguay)', 1 => 2, 2 => 1, ), ), 'ja' => array ( 'JP' => array ( 0 => 'Japanese', 1 => 1, 2 => 10, ), ), 'zh' => array ( 'CN' => array ( 0 => 'Chinese', 1 => 2, 2 => 11, ), 'HK' => array ( 0 => 'Chinese (Hong Kong)', 1 => 2, 2 => 11, ), 'TW' => array ( 0 => 'Chinese (Taiwan)', 1 => 2, 2 => 11, ), ), 'af' => array ( 'ZA' => array ( 0 => 'Afrikaans (South Africa)', 1 => 2, 2 => 0, ), ), 'hr' => array ( 'HR' => array ( 0 => 'Croatian', 1 => 3, 2 => 2, ), ), 'is' => array ( 'IS' => array ( 0 => 'Icelandic', 1 => 2, 2 => 12, ), ), 'he' => array ( 'IL' => array ( 0 => 'Hebrew (Israel)', 1 => 2, 2 => 0, ), ), 'ar' => array ( 'IL' => array ( 0 => 'Arabic (Israel)', 1 => 6, 2 => 13, ), 'AE' => array ( 0 => 'Arabic (United Arab Emirates)', 1 => 6, 2 => 13, ), ), 'hi' => array ( 'IN' => array ( 0 => 'Hindi (India)', 1 => 2, 2 => 0, ), ), 'sr' => array ( 'RS' => array ( 0 => 'Serbian', 1 => 3, 2 => 2, ), ), 'tr' => array ( 'TR' => array ( 0 => 'Turkish', 1 => 2, 2 => 14, ), ), 'ko' => array ( 'KR' => array ( 0 => 'Korean', 1 => 1, 2 => 10, ), ), 'cy' => array ( 'GB' => array ( 0 => 'Welsh', 1 => 4, 2 => 15, ), ), 'ms' => array ( 'MY' => array ( 0 => 'Malay (Malaysia)', 1 => 1, 2 => 10, ), ), 'az' => array ( 'TR' => array ( 0 => 'Azerbaijani (Turkey)', 1 => 2, 2 => 0, ), ), 'bn' => array ( 'BD' => array ( 0 => 'Bengali (Bangladesh)', 1 => 2, 2 => 0, ), ), 'bs' => array ( 'BA' => array ( 0 => 'Bosnian (Bosnia & Herzegovina)', 1 => 3, 2 => 2, ), ), 'fa' => array ( 'AF' => array ( 0 => 'Persian (Afghanistan)', 1 => 2, 2 => 1, ), 'IR' => array ( 0 => 'Persian (Iran', 1 => 2, 2 => 1, ), ), 'fo' => array ( 'FO' => array ( 0 => 'Faroese (Faroe Islands)', 1 => 2, 2 => 1, ), 'DK' => array ( 0 => 'Faroese (Denmark)', 1 => 2, 2 => 1, ), ), 'ga' => array ( 'IE' => array ( 0 => 'Irish (Ireland)', 1 => 5, 2 => 16, ), ), 'gl' => array ( 'ES' => array ( 0 => 'Galician (Spain)', 1 => 2, 2 => 0, ), ), 'hy' => array ( 'AM' => array ( 0 => 'Armenian', 1 => 2, 2 => 0, ), ), 'id' => array ( 'ID' => array ( 0 => 'Indonesian', 1 => 1, 2 => 10, ), ), 'jv' => array ( 'ID' => array ( 0 => 'Javanese (Indonesia)', 1 => 2, 2 => 17, ), ), 'ka' => array ( 'GE' => array ( 0 => 'Georgian', 1 => 1, 2 => 10, ), ), 'kk' => array ( 'KZ' => array ( 0 => 'Kazakh', 1 => 1, 2 => 10, ), ), 'kn' => array ( 'IN' => array ( 0 => 'Kannada (India)', 1 => 2, 2 => 18, ), ), 'li' => array ( 'NL' => array ( 0 => 'Limburgish (Netherlands)', 1 => 2, 2 => 1, ), ), 'lo' => array ( 'LA' => array ( 0 => 'Lao (Laos)', 1 => 1, 2 => 10, ), ), 'mg' => array ( 'MG' => array ( 0 => 'Malagasy (Madagascar)', 1 => 2, 2 => 11, ), ), 'my' => array ( 'MM' => array ( 0 => 'Burmese (Myanmar)', 1 => 1, 2 => 10, ), ), 'nb' => array ( 'NO' => array ( 0 => 'Bokmål', 1 => 2, 2 => 0, ), ), 'nn' => array ( 'NO' => array ( 0 => 'Nynorsk', 1 => 2, 2 => 0, ), ), 'ne' => array ( 'NP' => array ( 0 => 'Nepali', 1 => 2, 2 => 0, ), ), 'os' => array ( 'TR' => array ( 0 => 'Ossetian (Turkey)', 1 => 2, 2 => 1, ), 'RU' => array ( 0 => 'Ossetian (Russia)', 1 => 2, 2 => 1, ), 'GE' => array ( 0 => 'Ossetian (Georgia)', 1 => 2, 2 => 1, ), ), 'pa' => array ( 'IN' => array ( 0 => 'Punjabi (India)', 1 => 2, 2 => 0, ), ), 'uk' => array ( 'UA' => array ( 0 => 'Ukrainian (Ukraine)', 1 => 3, 2 => 2, ), ), 'sa' => array ( 'IN' => array ( 0 => 'Sanskrit (India)', 1 => 2, 2 => 1, ), ), 'sd' => array ( 'PK' => array ( 0 => 'Sindhi (Pakistan)', 1 => 2, 2 => 0, ), ), 'si' => array ( 'LK' => array ( 0 => 'Sinhala (Sri Lanka)', 1 => 2, 2 => 0, ), ), 'so' => array ( 'SO' => array ( 0 => 'Somali', 1 => 2, 2 => 19, ), ), 'sq' => array ( 'AL' => array ( 0 => 'Albanian (Albania)', 1 => 2, 2 => 0, ), ), 'sc' => array ( 'IT' => array ( 0 => 'Sardinian (Italy)', 1 => 2, 2 => 1, ), ), 'su' => array ( 'ID' => array ( 0 => 'Sundanese (Indonesia)', 1 => 1, 2 => 10, ), ), 'sw' => array ( 'KE' => array ( 0 => 'Swahili (Kenya)', 1 => 2, 2 => 0, ), 'UG' => array ( 0 => 'Swahili (Uganda)', 1 => 2, 2 => 0, ), 'TZ' => array ( 0 => 'Swahili (Tanzania)', 1 => 2, 2 => 0, ), 'KM' => array ( 0 => 'Swahili (Comoros)', 1 => 2, 2 => 0, ), ), 'ta' => array ( 'IN' => array ( 0 => 'Tamil (India)', 1 => 2, 2 => 0, ), 'LK' => array ( 0 => 'Tamil (Sri Lanka)', 1 => 2, 2 => 0, ), ), 'te' => array ( 'IN' => array ( 0 => 'Telugu (India)', 1 => 2, 2 => 0, ), ), 'th' => array ( 'TW' => array ( 0 => 'Thai (Taiwan)', 1 => 1, 2 => 10, ), ), 'tg' => array ( 'TJ' => array ( 0 => 'Tajik (Tajikistan)', 1 => 2, 2 => 11, ), ), 'ug' => array ( 'CN' => array ( 0 => 'Uyghur (China)', 1 => 1, 2 => 10, ), ), 'ur' => array ( 'IN' => array ( 0 => 'Urdu (India)', 1 => 2, 2 => 0, ), 'PK' => array ( 0 => 'Urdu (Pakistan)', 1 => 2, 2 => 0, ), ), 'uz' => array ( 'UZ' => array ( 0 => 'Uzbek (Uzbekistan)', 1 => 2, 2 => 11, ), ), 'vi' => array ( 'VN' => array ( 0 => 'Vietnamese', 1 => 1, 2 => 10, ), ), );
 
88
  // end pre-compiled locale data
89
  $locale = new LocoLocale( $lc, $cc );
90
  if( isset($locales[$lc]) ){
@@ -92,8 +93,11 @@ final class LocoLocale {
92
  $cc = key( $locales[$lc] );
93
  }
94
  if( isset($locales[$lc][$cc]) ){
95
- $raw = $locales[$lc][$cc];
96
- $raw[2] = $plurals[ $raw[1] ];
 
 
 
97
  $locale->__import( $lc, $cc, $raw );
98
  }
99
  }
84
  */
85
  public static function init( $lc, $cc ){
86
  // pre-compiled locale data
87
+ static $plurals = array ( '(n != 1)', 'n == 1 ? 0 : 1', '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)', '(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2', '(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2)', '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 or n%100>=20) ? 1 : 2)', '(n==1 ? 0 : n==0 || ( n%100>1 && n%100<11) ? 1 : (n%100>10 && n%100<20 ) ? 2 : 3)', '(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)', '(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2)', '(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0)', 0, '(n > 1)', '(n%10!=1 || n%100==11)', 'n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5', '(n>1)', '(n==1) ? 0 : (n==2) ? 1 : (n != 8 && n != 11) ? 2 : 3', 'n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : 4', 'n!=0', '(n!=1)', 'n != 1', ),
88
+ $locales = array ( 'en' => array ( 'GB' => array ( 'English (UK)', 2, 0, ), 'IE' => array ( 'English (Ireland)', 2, 0, ), 'US' => array ( 'English (USA)', 2, 0, ), 'CA' => array ( 'English (Canada)', 2, 0, ), 'AU' => array ( 'English (Australia)', 2, 0, ), 'NZ' => array ( 'English (New Zealand)', 2, 0, ), 'HK' => array ( 'English (Hong Kong)', 2, 0, ), 'SG' => array ( 'English (Singapore)', 2, 0, ), 'AE' => array ( 'English (United Arab Emirates)', 2, 0, ), 'ZA' => array ( 'English (South Africa)', 2, 0, ), 'IN' => array ( 'English (India)', 2, 0, ), ), 'fr' => array ( 'FR' => array ( 'French', 2, 1, ), 'CH' => array ( 'French (Switzerland)', 2, 1, ), 'BE' => array ( 'French (Belgium)', 2, 1, ), 'HT' => array ( 'French (Haiti)', 2, 1, ), 'CA' => array ( 'French (Canada)', 2, 1, ), ), 'it' => array ( 'IT' => array ( 'Italian', 2, 0, ), 'CH' => array ( 'Italian (Switzerland)', 2, 0, ), ), 'de' => array ( 'DE' => array ( 'German', 2, 0, ), 'CH' => array ( 'German (Switzerland)', 2, 0, ), 'AT' => array ( 'German (Austria)', 2, 0, ), ), 'es' => array ( 'ES' => array ( 'Spanish', 2, 0, ), 'MX' => array ( 'Spanish (Mexico)', 2, 0, ), 'AR' => array ( 'Spanish (Argentina)', 2, 0, ), 'BO' => array ( 'Spanish (Bolivia)', 2, 0, ), 'CL' => array ( 'Spanish (Chile)', 2, 0, ), 'CO' => array ( 'Spanish (Colombia)', 2, 0, ), 'CR' => array ( 'Spanish (Costa Rica)', 2, 0, ), 'CU' => array ( 'Spanish (Cuba)', 2, 0, ), 'DO' => array ( 'Spanish (Dominican Republic)', 2, 0, ), 'EC' => array ( 'Spanish (Ecuador)', 2, 0, ), 'SV' => array ( 'Spanish (El Salvador)', 2, 0, ), 'GT' => array ( 'Spanish (Guatemala)', 2, 0, ), 'HN' => array ( 'Spanish (Honduras)', 2, 0, ), 'NI' => array ( 'Spanish (Nicaragua)', 2, 0, ), 'PA' => array ( 'Spanish (Panama)', 2, 0, ), 'PY' => array ( 'Spanish (Paraguay)', 2, 0, ), 'PE' => array ( 'Spanish (Peru)', 2, 0, ), 'UY' => array ( 'Spanish (Uruguay)', 2, 0, ), 'VE' => array ( 'Spanish (Venezuela)', 2, 0, ), ), 'pt' => array ( 'PT' => array ( 'Portuguese', 2, 0, ), 'BR' => array ( 'Portuguese (Brazil)', 2, 0, ), ), 'ru' => array ( 'RU' => array ( 'Russian', 3, 2, ), 'UA' => array ( 'Russian (Ukraine)', 3, 2, ), ), 'sv' => array ( 'SE' => array ( 'Swedish', 2, 0, ), ), 'no' => array ( 'NO' => array ( 'Norwegian', 2, 0, ), ), 'da' => array ( 'DK' => array ( 'Danish', 2, 0, ), ), 'fi' => array ( 'FI' => array ( 'Finnish', 2, 1, ), ), 'bg' => array ( 'BG' => array ( 'Bulgarian', 2, 0, ), ), 'cs' => array ( 'CZ' => array ( 'Czech', 3, 3, ), ), 'et' => array ( 'EE' => array ( 'Estonian', 2, 0, ), ), 'el' => array ( 'GR' => array ( 'Greek', 2, 0, ), 'CY' => array ( 'Greek (Cyprus)', 2, 0, ), ), 'hu' => array ( 'HU' => array ( 'Hungarian', 2, 0, ), ), 'lv' => array ( 'LV' => array ( 'Latvian', 3, 4, ), ), 'lt' => array ( 'LT' => array ( 'Lithuanian', 3, 5, ), ), 'lb' => array ( 'LU' => array ( 'Luxembourgish', 2, 0, ), ), 'mt' => array ( 'MT' => array ( 'Maltese', 4, 6, ), ), 'nl' => array ( 'NL' => array ( 'Dutch', 2, 0, ), 'BE' => array ( 'Dutch (Belgium)', 2, 0, ), ), 'pl' => array ( 'PL' => array ( 'Polish', 3, 7, ), ), 'ro' => array ( 'RO' => array ( 'Romanian', 3, 8, ), ), 'sk' => array ( 'SK' => array ( 'Slovak', 3, 3, ), ), 'sl' => array ( 'SI' => array ( 'Slovenian', 4, 9, ), ), 'ht' => array ( 'HT' => array ( 'Haitian Creole', 2, 1, ), ), 'gn' => array ( 'PY' => array ( 'Guarani (Paraguay)', 2, 1, ), ), 'ja' => array ( 'JP' => array ( 'Japanese', 1, 10, ), ), 'zh' => array ( 'CN' => array ( 'Chinese', 2, 11, ), 'HK' => array ( 'Chinese (Hong Kong)', 2, 11, ), 'TW' => array ( 'Chinese (Taiwan)', 2, 11, ), ), 'af' => array ( 'ZA' => array ( 'Afrikaans (South Africa)', 2, 0, ), ), 'hr' => array ( 'HR' => array ( 'Croatian', 3, 2, ), ), 'is' => array ( 'IS' => array ( 'Icelandic', 2, 12, ), ), 'he' => array ( 'IL' => array ( 'Hebrew (Israel)', 2, 0, ), ), 'ar' => array ( 'IL' => array ( 'Arabic (Israel)', 6, 13, ), 'AE' => array ( 'Arabic (United Arab Emirates)', 6, 13, ), ), 'hi' => array ( 'IN' => array ( 'Hindi (India)', 2, 0, ), ), 'sr' => array ( 'RS' => array ( 'Serbian', 3, 2, ), ), 'tr' => array ( 'TR' => array ( 'Turkish', 2, 14, ), ), 'ko' => array ( 'KR' => array ( 'Korean', 1, 10, ), ), 'cy' => array ( 'GB' => array ( 'Welsh', 4, 15, ), ), 'ms' => array ( 'MY' => array ( 'Malay (Malaysia)', 1, 10, ), ), 'az' => array ( 'TR' => array ( 'Azerbaijani (Turkey)', 2, 0, ), ), 'bn' => array ( 'BD' => array ( 'Bengali (Bangladesh)', 2, 0, ), ), 'bs' => array ( 'BA' => array ( 'Bosnian (Bosnia & Herzegovina)', 3, 2, ), ), 'fa' => array ( 'AF' => array ( 'Persian (Afghanistan)', 2, 1, ), 'IR' => array ( 'Persian (Iran)', 2, 1, ), ), 'fo' => array ( 'FO' => array ( 'Faroese (Faroe Islands)', 2, 1, ), 'DK' => array ( 'Faroese (Denmark)', 2, 1, ), ), 'ga' => array ( 'IE' => array ( 'Irish (Ireland)', 5, 16, ), ), 'gl' => array ( 'ES' => array ( 'Galician (Spain)', 2, 0, ), ), 'hy' => array ( 'AM' => array ( 'Armenian', 2, 0, ), ), 'id' => array ( 'ID' => array ( 'Indonesian', 1, 10, ), ), 'jv' => array ( 'ID' => array ( 'Javanese (Indonesia)', 2, 17, ), ), 'ka' => array ( 'GE' => array ( 'Georgian', 1, 10, ), ), 'kk' => array ( 'KZ' => array ( 'Kazakh', 1, 10, ), ), 'kn' => array ( 'IN' => array ( 'Kannada (India)', 2, 18, ), ), 'li' => array ( 'NL' => array ( 'Limburgish (Netherlands)', 2, 1, ), ), 'lo' => array ( 'LA' => array ( 'Lao (Laos)', 1, 10, ), ), 'mg' => array ( 'MG' => array ( 'Malagasy (Madagascar)', 2, 11, ), ), 'my' => array ( 'MM' => array ( 'Burmese (Myanmar)', 1, 10, ), ), 'nb' => array ( 'NO' => array ( 'Bokmål', 2, 0, ), ), 'nn' => array ( 'NO' => array ( 'Nynorsk', 2, 0, ), ), 'ne' => array ( 'NP' => array ( 'Nepali', 2, 0, ), ), 'os' => array ( 'TR' => array ( 'Ossetian (Turkey)', 2, 1, ), 'RU' => array ( 'Ossetian (Russia)', 2, 1, ), 'GE' => array ( 'Ossetian (Georgia)', 2, 1, ), ), 'pa' => array ( 'IN' => array ( 'Punjabi (India)', 2, 0, ), ), 'uk' => array ( 'UA' => array ( 'Ukrainian (Ukraine)', 3, 2, ), ), 'sa' => array ( 'IN' => array ( 'Sanskrit (India)', 2, 1, ), ), 'sd' => array ( 'PK' => array ( 'Sindhi (Pakistan)', 2, 0, ), ), 'si' => array ( 'LK' => array ( 'Sinhala (Sri Lanka)', 2, 0, ), ), 'so' => array ( 'SO' => array ( 'Somali', 2, 19, ), ), 'sq' => array ( 'AL' => array ( 'Albanian (Albania)', 2, 0, ), ), 'sc' => array ( 'IT' => array ( 'Sardinian (Italy)', 2, 1, ), ), 'su' => array ( 'ID' => array ( 'Sundanese (Indonesia)', 1, 10, ), ), 'sw' => array ( 'KE' => array ( 'Swahili (Kenya)', 2, 0, ), 'UG' => array ( 'Swahili (Uganda)', 2, 0, ), 'TZ' => array ( 'Swahili (Tanzania)', 2, 0, ), 'KM' => array ( 'Swahili (Comoros)', 2, 0, ), ), 'ta' => array ( 'IN' => array ( 'Tamil (India)', 2, 0, ), 'LK' => array ( 'Tamil (Sri Lanka)', 2, 0, ), ), 'te' => array ( 'IN' => array ( 'Telugu (India)', 2, 0, ), ), 'th' => array ( 'TW' => array ( 'Thai (Taiwan)', 1, 10, ), ), 'tg' => array ( 'TJ' => array ( 'Tajik (Tajikistan)', 2, 11, ), ), 'ug' => array ( 'CN' => array ( 'Uyghur (China)', 1, 10, ), ), 'ur' => array ( 'IN' => array ( 'Urdu (India)', 2, 0, ), 'PK' => array ( 'Urdu (Pakistan)', 2, 0, ), ), 'uz' => array ( 'UZ' => array ( 'Uzbek (Uzbekistan)', 2, 11, ), ), 'vi' => array ( 'VN' => array ( 'Vietnamese', 1, 10, ), ), );
89
  // end pre-compiled locale data
90
  $locale = new LocoLocale( $lc, $cc );
91
  if( isset($locales[$lc]) ){
93
  $cc = key( $locales[$lc] );
94
  }
95
  if( isset($locales[$lc][$cc]) ){
96
+ // get raw locale format: [ name, nplurals, plural ] e.g: [ 'English (UK)', 2, 0 ]
97
+ $raw = $locales[$lc][$cc];
98
+ // swap plural equation index with reusable value
99
+ $raw[2] = $plurals[ $raw[2] ];
100
+ // construct locale object from raw data
101
  $locale->__import( $lc, $cc, $raw );
102
  }
103
  }
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.2.1
8
  Author URI: http://localise.biz/help/wordpress/translate-plugin
9
  */
10
 
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.2.2
8
  Author URI: http://localise.biz/help/wordpress/translate-plugin
9
  */
10
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: timwhitlock
3
  Tags: translation, translators, localization, localisation, l10n, i18n, Gettext, POEdit, productivity
4
  Requires at least: 3.5
5
  Tested up to: 3.5
6
- Stable tag: 1.2.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -95,6 +95,11 @@ At the user end, yes you can access the interface on Windows using Internet Expl
95
 
96
  == Changelog ==
97
 
 
 
 
 
 
98
  = 1.2.1 =
99
  * Fixed incorrect version update message
100
  * Added note about Windows support in readme.txt
3
  Tags: translation, translators, localization, localisation, l10n, i18n, Gettext, POEdit, productivity
4
  Requires at least: 3.5
5
  Tested up to: 3.5
6
+ Stable tag: 1.2.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
95
 
96
  == Changelog ==
97
 
98
+ = 1.2.2 =
99
+ * Fixed incorrect plural equation offset
100
+ * Compacted pre-compiled locale data
101
+ * Added settings link from plugin meta row
102
+
103
  = 1.2.1 =
104
  * Fixed incorrect version update message
105
  * Added note about Windows support in readme.txt