* stubs for larger lang test
authorMichael Dale <dale@users.mediawiki.org>
Thu, 29 Oct 2009 10:57:02 +0000 (10:57 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Thu, 29 Oct 2009 10:57:02 +0000 (10:57 +0000)
* updated compressed cortado

js2/mwEmbed/binPlayers/cortado/cortado-ovt-stripped-0.5.0.jar
js2/mwEmbed/mv_embed.js
js2/mwEmbed/php/languages/cldrConverter.php
js2/mwEmbed/tests/testLang.html
js2/mwEmbed/tests/testLang.js [new file with mode: 0644]
js2/mwEmbed/tests/testLangEn.js [deleted file]
js2/mwEmbed/tests/testLangRU.js [deleted file]

index 209fe56..02c541f 100644 (file)
Binary files a/js2/mwEmbed/binPlayers/cortado/cortado-ovt-stripped-0.5.0.jar and b/js2/mwEmbed/binPlayers/cortado/cortado-ovt-stripped-0.5.0.jar differ
index 2ed2174..7bf7d4c 100644 (file)
@@ -59,9 +59,10 @@ function lcCssPath( cssSet ) {
  *
  * Right now the PHP AutoLoader only reads this mv_embed.js file.
  * In the future we could have multiple lcPath calls that PHP reads
- * (if our autoloading class list becomes too long) just have to add those
- * files to the jsAutoLoader file list. 
- * (ie extensions that want to use the autoloader) 
+ * (if our autoloading class list becomes too long) 
+ * or 
+ * we could support direct file requests to the script loader instead 
+ * of shared class names read from a central location.
  */
 lcPaths({
        "mv_embed"                      : "mv_embed.js",
@@ -75,7 +76,9 @@ lcPaths({
        "$j.Jcrop"                      : "libClipEdit/Jcrop/js/jquery.Jcrop.js",
        "$j.fn.simpleUploadForm" : "libAddMedia/simpleUploadForm.js",
        
-       "$mw.proxy"             : "libMwApi/mw.proxy.js", 
+       "$mw.proxy"             : "libMwApi/mw.proxy.js",
+       
+       "$mw.testLang"  :  "tests/testLang.js",
        
        "ctrlBuilder"   : "skins/ctrlBuilder.js",
        "kskinConfig"   : "skins/kskin/kskin.js",
index 612f4ca..fc187b3 100644 (file)
@@ -76,11 +76,13 @@ class cldrConverter {
                                        'one' => 1,
                                        //n is 0 OR n is not 1 AND n mod 100 in 1..19
                                        'few' => array(
-                                                               array( 'is' => 0),
-                                                               'or',
-                                                               array(
-                                                                       array( 'not' => 1),
-                                                                       array( 'mod' => 100, 'is'=>'1-19')
+                                                               'or'=> array(
+                                                                       array( 'is' => 0),                                                              
+                                                                       array(
+                                                                               array( 'not' => 1),
+                                                                               //and
+                                                                               array( 'mod' => 100, 'is'=>'1-19')
+                                                                       )
                                                                )
                                                        )
                                )
@@ -113,11 +115,11 @@ class cldrConverter {
                                        ),
                                        //n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14
                                        'many' => array(
-                                               array( 'mod'=> 10, 'is' => 0),
-                                               'or',
-                                               array( 'mod'=> 10, 'is' => '5-9'),
-                                               'or',
-                                               array( 'mod'=> 100, 'is' => '11-14')
+                                               'or'=>array(
+                                                       array( 'mod'=> 10, 'is' => 0),
+                                                       array( 'mod'=> 10, 'is' => '5-9'),
+                                                       array( 'mod'=> 100, 'is' => '11-14')
+                                               )
                                        ),
                                )
                ),
index 30840e3..1f10058 100644 (file)
 <head>
 <title>Test Plural Conversions (should match php) </title>
 <script type="text/javascript" src="../mv_embed.js"></script>
-<script type="text/javascript" src="testLangEn.js"></script>
 <style>
 td{
        border:solid thin black;
 }
 </style>
 <script type="text/javascript" >
-       var langKey = 'en';
+//shortLangKey is an array of at least one language from every group in cldrConverter.php
+var shortLangKey = ['en','az', 'da', 'pt'];
+
+//longlangKey is every language we have a much more verbose test
+var longLangKey = [
+               //no plurals, there are no rules
+               'az','fa','hu','ja','ko','my to','tr','vi','yo','zh',
+               'bo','dz','id','jv ka','km','kn','ms','th',
+               
+               /*
+               'zero'  => 0,
+               'one'   => 1,
+               'two'   => 2,
+               //n mod 100 in 3..10
+               'few'   => array( 'mod' => 100, 'is'=>'3-10' ),
+               //n mod 100 in 11..99
+               'many'  => array( 'mod' => 100, 'is'=>'11-99')
+               */
+               'ar',
+               
+               /*
+               'one' => 1
+               */              
+               'da','de','el','en','eo','es','et','fi','fo','gl',
+               'he','iw','it','nb','nl','nn','no','pt_PT','sv',
+               'af','bg','bn','ca','eu','fur','fy','gu','ha',
+               'is','ku','lb','ml','mr','nah','ne','om','or',
+               'pa','pap','ps','so','sq','sw','ta','te','tk',
+               'ur','zu','mn','gsw',
+               
+               /*
+               'one'=> '0-1'
+               */
+               'pt','am','bh','fil','tl','guw','hi','ln','mg','nso','ti','wa',
+               
+               /*
+               'one' => array( 'is'=>'0-2', 'not' => 2)
+               */
+               'fr',
+                
+               /*
+               'zero' => 0,
+               //n mod 10 is 1 and n mod 100 is not 11
+               'one'=>array(
+                               array( 'mod' => 10, 'is' => 1 ),
+                               //AND
+                               array( 'mod' => 100, 'not' => 11)
+                       )
+               */
+               'lv',
+               
+               /*
+               'one' => 1,
+               'two' => 2
+               */
+               'ga','se','sma','smi','smj','smn','sms',
+               
+               
+               /*
+               'one' => 1,
+               //n is 0 OR n is not 1 AND n mod 100 in 1..19
+               'few' => array(
+                                       'or'=> array(
+                                               array( 'is' => 0),                                                              
+                                               array(
+                                                       array( 'not' => 1),
+                                                       //and
+                                                       array( 'mod' => 100, 'is'=>'1-19')
+                                               )
+                                       )
+                               )
+                       */
+               'ro','mo',
+               
+               
+               /*
+               //n mod 10 is 1 and n mod 100 not in 11..19
+               'one' => array(
+                                       array( 'mod'=>10, 'is'=> 1 ),
+                                       array( 'mod'=> 100, 'not'=> '11-19')
+                               ),
+               //n mod 10 in 2..9 and n mod 100 not in 11..19
+               'few' => array(
+                                       array( 'mod'=> 10, 'is'=> '2-9' ),
+                                       array( 'mod'=> 100, 'not' => '11-19')
+                               ),
+               */
+               'lt',
+               
+               
+               /*
+               //n mod 10 is 1 and n mod 100 is not 11
+               'one' => array(
+                       array( 'mod' => 10, 'is' => 1),
+                       array( 'mod' => 100, 'not' => 11)
+               ),
+               //n mod 10 in 2..4 and n mod 100 not in 12..14
+               'few' => array(
+                       array( 'mod' => 10, 'is' => '2-4'),
+                       array( 'mod' => 100, 'not' => '12-14')
+               ),
+               //n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14
+               'many' => array(
+                       'or'=>array(
+                               array( 'mod'=> 10, 'is' => 0),
+                               array( 'mod'=> 10, 'is' => '5-9'),
+                               array( 'mod'=> 100, 'is' => '11-14')
+                       )
+               ),
+               */
+               'hr','ru','sr','uk','be','bs','sh',
+               
+               
+               /*
+               'one' => 1,
+               'few' => array(
+                       //n mod 10 in 2..4
+                       array( 'mod' => 10, 'is' => '2-4'),
+                       //and n mod 100 not in 12..14
+                       array( 'mod' => 100, 'not'=> '12-14'),
+                       //and n mod 100 not in 22..24
+                       array( 'mod' => 100, 'in' => '22-24')
+               )
+               */
+               'pl', 
+               
+               /*
+               'one' => array( 'mod'=>100, 'is' => 1 ),
+               'two' => array( 'mod'=>100, 'is' => 2 ),
+               'few' => array( 'mod'=>100, 'is' => '3-4')
+               */
+               'sl', 
+
+       
+               /*
+               'one' => 1,
+               //n is 0 or n mod 100 in 2..10
+               'few' => array(
+                       array( 'is' => 0 ),
+                       'or',
+                       array( 'mod' => 100, 'is' => '2-10')
+               ),
+               //n mod 100 in 11..19
+               'many' => array( 'mod'=>100, 'is' => '11-19')
+               */      
+               'mt',
+               
+               /*
+               'one' => array('mod' => 10, 'is' => '1')
+               */
+               'mk', 
+               
+               /*
+               'one' => 1,
+               'two' => 2,
+               //n is 8 or n is 11
+               'many' => array(
+                       array( 'is' => 8 ),
+                       array( 'is' => 11 )
+               )*/
+               'cy'
+];
+
 js2AddOnloadHook( function(){
+       //do mauall script loaders calls to test multiple languages:
+       
                //build table output: 
                var o = '<table>';              
                var msgTestSet = { 
diff --git a/js2/mwEmbed/tests/testLang.js b/js2/mwEmbed/tests/testLang.js
new file mode 100644 (file)
index 0000000..2314304
--- /dev/null
@@ -0,0 +1,17 @@
+/* a simple language tester replacements
+ */
+
+loadGM({
+       //test msg with English words to see whats going on
+       'test_plural_msg' : '{{PLURAL:$1|one|other}}',
+       //sample real world msgs: 
+       'undelete_short'  : 'Undelete {{PLURAL:$1|one edit|$1 edits}}',
+       'category-subcat-count' : "fish {{PLURAL:$2|This {{PLURAL:$1|fistsub|$1 secondsub}} category has only the following subcategory.|This category has the following {{PLURAL:$1|subcategory|$1 subcategories}}, out of $2 total.}}"        
+});
+
+$mw.lang.loadRS({
+       'PLURAL' : { "one":1 }  
+});
+
+//define a class by the name of this file:  
+$mw.testLang = {};
\ No newline at end of file
diff --git a/js2/mwEmbed/tests/testLangEn.js b/js2/mwEmbed/tests/testLangEn.js
deleted file mode 100644 (file)
index ca575d0..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/* a simple language tester replacements
- */
-
-loadGM({
-       //test msg with English words to see whats going on
-       'test_plural_msg' : '{{PLURAL:$1|one|other}}',
-       //sample real world msgs: 
-       'undelete_short'  : 'Undelete {{PLURAL:$1|one edit|$1 edits}}',
-       'category-subcat-count' : "fish {{PLURAL:$2|This {{PLURAL:$1|fistsub|$1 secondsub}} category has only the following subcategory.|This category has the following {{PLURAL:$1|subcategory|$1 subcategories}}, out of $2 total.}}"        
-});
-
-$mw.lang.loadRS({
-       'PLURAL' : { "one":1 }  
-});
-
-//need to run through script-loader
\ No newline at end of file
diff --git a/js2/mwEmbed/tests/testLangRU.js b/js2/mwEmbed/tests/testLangRU.js
deleted file mode 100644 (file)
index c41399d..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* a simple language tester replacements
-
- */
-
-loadGM({
-       //test msg with english words to see whats going on
-       'test_plural_msg' : '{{PLURAL:$1|one|few|many}}',
-       //sample real world msgs: 
-       'undelete_short' : 'Восстановить $1 {{PLURAL:$1|правку|правки|правок}}'
-});
-$mw.lang.loadRS({
-       'PLURAL' :
-               {
-               "one":[{"mod":10,"is":1},{"mod":100,"not":11}],
-               "few":[{"mod":10,"is":"2-4"},{"mod":100,"not":"12-14"}],
-               "many":[{"mod":10,"is":0},
-                               "or",
-                               {"mod":10,"is":"5-9"},
-                               "or",
-                               {"mod":100,"is":"11-14"}
-                               ]
-               }
-});
-/*
-one    1, 21, 31, 41, 51, 61...        
-few    2-4, 22-24, 32-34...
-many   0, 5-20, 25-30, 35-40...
-other  1.31, 2.31, 5.31...
-*/