From 18708e0105bc8360eac65824327fdd7c8ec247d7 Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Mon, 5 Oct 2009 04:03:33 +0000 Subject: [PATCH] * more language stubs updates * mv_embed window.$mw updates * fixed audio width for oggHandler rewrites via remote MwEmbed * initial testing page to compare mediaWiki output to js output transformations * sample test JS lang test files .. (probably temporary) --- js2/mwEmbed/jsScriptLoader.php | 2 + js2/mwEmbed/libEmbedVideo/embedVideo.js | 10 +- js2/mwEmbed/mv_embed.js | 205 ++++++++++++-- js2/mwEmbed/php/clrdConverter.php | 207 -------------- .../php/{ => languages}/cldrConverter.php | 10 +- js2/mwEmbed/php/languages/mwEmbed.i18n.php | 256 +++++++++--------- js2/mwEmbed/php/noMediaWikiConfig.php | 1 + js2/mwEmbed/tests/testLang.html | 62 +++++ js2/mwEmbed/tests/testLangEn.js | 14 + js2/mwEmbed/tests/testLangRU.js | 23 ++ js2/remoteMwEmbed.js | 3 +- 11 files changed, 417 insertions(+), 376 deletions(-) delete mode 100644 js2/mwEmbed/php/clrdConverter.php rename js2/mwEmbed/php/{ => languages}/cldrConverter.php (96%) create mode 100644 js2/mwEmbed/tests/testLang.html create mode 100644 js2/mwEmbed/tests/testLangEn.js create mode 100644 js2/mwEmbed/tests/testLangRU.js diff --git a/js2/mwEmbed/jsScriptLoader.php b/js2/mwEmbed/jsScriptLoader.php index c0bfbb009b..3cc5e2ec43 100644 --- a/js2/mwEmbed/jsScriptLoader.php +++ b/js2/mwEmbed/jsScriptLoader.php @@ -300,6 +300,8 @@ class jsScriptLoader { // Do the language lookup if ( $jmsg ) { + //see if any msgKey has the PLURAL template tag + //package in PLURAL mapping foreach ( $jmsg as $msgKey => $default_en_value ) { $jmsg[$msgKey] = wfMsgNoTrans( $msgKey ); } diff --git a/js2/mwEmbed/libEmbedVideo/embedVideo.js b/js2/mwEmbed/libEmbedVideo/embedVideo.js index 7b288726da..bddf73bbc9 100644 --- a/js2/mwEmbed/libEmbedVideo/embedVideo.js +++ b/js2/mwEmbed/libEmbedVideo/embedVideo.js @@ -1404,11 +1404,11 @@ embedVideo.prototype = { this.thumbnail_disp = true; }, refreshControlsHTML:function(){ - js_log('refreshing controls HTML'); - if($j('#mv_embedded_controls_'+this.id).length==0) + js_log('refreshControlsHTML::'); + if($j('#mv_embedded_controls_'+this.id).length == 0) { js_log('#mv_embedded_controls_'+this.id + ' not present, returning'); - return; + return ; }else{ $j('#mv_embedded_controls_'+this.id).html( this.getControlsHTML() ); this.ctrlBuilder.addControlHooks(this); @@ -1427,7 +1427,7 @@ embedVideo.prototype = { 'class="' + this.ctrlBuilder.pClass + '">'; html_code += '
' + this.getThumbnailHTML() + - '
'; + ''; //js_log("mvEmbed:controls "+ typeof this.controls); if( this.controls ) { @@ -1435,7 +1435,7 @@ embedVideo.prototype = { this.ctrlBuilder = new ctrlBuilder( this ); js_log("f:getHTML:AddControls"); - html_code +='
'; + html_code +='
'; html_code += this.getControlsHTML(); html_code +='
'; //block out some space by encapulating the top level div diff --git a/js2/mwEmbed/mv_embed.js b/js2/mwEmbed/mv_embed.js index 8acf477153..131e55391f 100644 --- a/js2/mwEmbed/mv_embed.js +++ b/js2/mwEmbed/mv_embed.js @@ -70,15 +70,14 @@ parseUri.options = { // For use when mv_embed with script-loader is in the root MediaWiki path var mediaWiki_mvEmbed_path = 'js2/mwEmbed/'; - var _global = this; // Global obj /* * setup the empty global $mw object * will ensure all our functions are properly namespaced */ -if(!_global['$mw']){ - _global['$mw'] = {} +if(!window['$mw']){ + window['$mw'] = {} } //@@todo move these into $mw @@ -91,26 +90,29 @@ var global_req_cb = new Array(); // The global request callback array if( !mv_embed_path ) { var mv_embed_path = getMvEmbedPath(); } - - -/* -* Language classes $mw.lang -* -* Localized Language suport attempts to mirror the functionality of Language.php in MediaWiki -* It contains methods for loading and transforming msg text -* -* code style:: -* We could wrap each $mw extend in (function( $ ) { //functions here })($mw); and refrence $mw as $ +/** +* wrap the global $mw object here: +* +* Any global functions/classes that are not jQuery plugins should make +* there way into the $mw namespace */ (function( $ ) { + /* + * Language classes $mw.lang + * + * Localized Language support attempts to mirror the functionality of Language.php in MediaWiki + * It contains methods for loading and transforming msg text + * + */ $.lang = {}; /** * Setup the lang object */ var gMsg = {}; + var gRuleSet = {}; /** * loadGM function - * Loads a set of json messeges into the lang object. + * Loads a set of json messages into the lang object. * * @param json msgSet The set of msgs to be loaded */ @@ -119,6 +121,18 @@ if( !mv_embed_path ) { gMsg[ i ] = msgSet[i]; } }, + /** + * loadRS function + * Loads a ruleset by given template key ie PLURAL : { //ruleSetObj } + * + * @param json ruleSet The ruleset object ( extends gRuleSet ) + */ + $.lang.loadRS = function( ruleSet ){ + for( var i in ruleSet){ + gRuleSet[ i ] = ruleSet[ i ]; + } + } + /** * Returns a transformed msg string * @@ -131,12 +145,14 @@ if( !mv_embed_path ) { * @return string */ $.lang.gM = function( key , args ) { - var ms = ''; - if ( key in gMsg ) { + var supportedMagicLang = ['PLURAL']; + + if ( gMsg[ key ] ) { + var ms = ''; + //get the messege string: ms = gMsg[ key ]; - //test if we have a special replacement template call - + //replace values if( typeof args == 'object' || typeof args == 'array' ) { for( var v in args ) { // Message test replace arguments start at 1 instead of zero: @@ -146,12 +162,84 @@ if( !mv_embed_path ) { } else if( typeof args =='string' || typeof args =='number' ) { ms = ms.replace(/\$1/, args); } - return ms; + + //a quick check to see if we need to send the msg via the 'parser' + //(we can add more detailed check once we suport more wiki syntax) + if(ms.indexOf('{{')==-1) + return ms; + + //send the msg key through the parser + pObj = $.parse( ms ); + //return the transformed msg + return pObj.getHTML(); + } else { // Missing key placeholder return '<' + key + '>'; } - }, + } + /** + * Process a special language template (ie PLURAL ) + */ + $.lang.procLangTemp = function( tObj ){ + + /* local lang templates: */ + function procPLURAL(){ + //Plural matchRuleTest + function matchRuleTest(cRule, val){ + js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val ); + //check for simple cRule type: + if( typeof cRule == 'number'){ + return ( parseInt( val ) == parseInt( cRule) ); + } + } + //maps a given rule Index to template params: + function getTempParamFromRuleInx( ruleInx ){ + //in general this is a one to one mapping: + + js_log('getTempParamFromRuleInx: ruleInx: ' + ruleInx + ' tempParamLength ' + tObj.param.length ); + var cat = tObj; + debugger; + return tObj.param[ ruleInx ]; + } + + //setup shortcuts + var rs = gRuleSet['PLURAL']; + var val = tObj.val; + for(var ruleInx in rs){ + cRule = rs[ruleInx]; + if( matchRuleTest( cRule, val )){ + js_log("matched rule: " + ruleInx ); + return getTempParamFromRuleInx( ruleInx ); + } + } + js_log('no match found for: ' + val + ' using last/other : ' + tObj.param [ tObj.param.length -1 ] ); + //return the last /"other" template param + return tObj.param [ tObj.param.length -1 ]; + } + + /* + * Master rule switch statement + */ + switch( tObj.n ){ + case 'PLURAL': + return procPLURAL(); + break; + } + } + /** + * gMsgNoTrans + * + * @returns string The msg key without transforming it + */ + $.lang.gMsgNoTrans = function( key ){ + if( gMsg[ key ] ) + return gMsg[ key ] + + // Missing key placeholder + return '<' + key + '>'; + } + /** * gMsgLoadRemote loads remote msg strings * @@ -187,7 +275,7 @@ if( !mv_embed_path ) { } callback(); }); - }, + } /** * Format a size in bytes for output, using an appropriate * unit (B, KB, MB or GB) according to the magnitude in question @@ -223,16 +311,75 @@ if( !mv_embed_path ) { //@@todo we need a formatNum and we need to request some special packaged info to deal with that case. return gM( msg , size ); } -})($mw); + + + /** + * MediaWiki wikitext "Parser" + * + * This is not feature complete but we need a way to get at template properties + * + * Template parsing is based in part on Magnus initial version: en:User:Magnus_Manske/tmpl.js + * + * @param wikiText the wikitext to be parsed + * @return parserObj returns a parser object that has methods for getting at + * things you would want + */ + $.parse = function( wikiText, opt ){ + var parseObj = function( wikiText, opt){ + return this.init( wikiText, opt ) + } + parseObj.prototype = { + pObj : {}, //the parser object that stores the parsed element structure + pOut : '', //the parser output string container + init :function( wikiText ){ + this.wikiText = wikiText; + this.parse(); + }, + parse : function(){ + //basic parser stores wikiText structure in pObj + + //tries to mirror Extension:Page Object Model + }, + templates : function( name ){ + //get template objects (optionally get a set by its name) + //hard code for plural for now: + return [{ + 'n': 'PLURAL', + 'val': '1', + 'param': ['one','other'] + }]; + }, + doMagicExpand : function(){ + //expand all the templates + tSet = this.templates(); + for(var tInx in tSet){ + var tObj = tSet[ tInx ] ; + //@@todo replace PLURARL with tObj.n + this.pOut = this.pOut.replace( /\{\{PLURAL[^\}]*\}\}/, + $.lang.procLangTemp(tObj) ); + } + }, + //returns the transformed wikitext + getHTML : function(){ + //copy the wikiText into the output (where we will do replaces) + this.pOut = this.wikiText; + this.doMagicExpand(); + return this.pOut; + } + }; + //return the parserObj + return new parseObj( wikiText, opt) ; + } + + +})(window.$mw); //setup legacy global shortcuts: var loadGM = $mw.lang.loadGM; var gM = $mw.lang.gM; - - // All default messages in [English] should be overwritten by the CMS language message system. -loadGM({ +$mw.lang.loadGM({ "mwe-loading_txt" : "loading ...<\/blink>", "mwe-loading_title" : "Loading...", "mwe-size-gigabytes" : "$1 GB", @@ -242,6 +389,8 @@ loadGM({ "mwe-error_load_lib" : "Error: JavaScript $1 was not retrievable or does not define $2" }); + + /** * AutoLoader paths (this should mirror the file: jsAutoloadLocalClasses.php ) * Any file _not_ listed here won't be auto-loadable @@ -1013,7 +1162,7 @@ function mv_jqueryBindings() { /* * Utility functions: */ -// Simple URL rewriter (could probably be refactored into an inline regular expresion) +// Simple URL rewriter (could probably be refactored into an inline regular exp) function getURLParamReplace( url, opt ) { var pSrc = parseUri( url ); if( pSrc.protocol != '' ) { @@ -1185,7 +1334,7 @@ function mwGetLocalApiUrl( url ) { } return false; } -// Grab wiki form error for wiki html page proccessing (should be deprecated) +// Grab wiki form error for wiki html page processing (should be deprecated because we use api now) function grabWikiFormError( result_page ) { var res = {}; sp = result_page.indexOf( '' ); @@ -1234,7 +1383,7 @@ function do_request( req_url, callback ) { } else { // Get data via DOM injection with callback global_req_cb.push( callback ); - // Prepend json_ to feed_format if not already requesting json format + // Prepend json_ to feed_format if not already requesting json format (metavid specific) if( req_url.indexOf( "feed_format=" ) != -1 && req_url.indexOf( "feed_format=json" ) == -1 ) req_url = req_url.replace( /feed_format=/, 'feed_format=json_' ); loadExternalJs( req_url + '&cb=mv_jsdata_cb&cb_inx=' + (global_req_cb.length - 1) ); diff --git a/js2/mwEmbed/php/clrdConverter.php b/js2/mwEmbed/php/clrdConverter.php deleted file mode 100644 index b77e5a20db..0000000000 --- a/js2/mwEmbed/php/clrdConverter.php +++ /dev/null @@ -1,207 +0,0 @@ - array('az','fa','hu','ja','ko','my to','tr','vi','yo','zh', - 'bo','dz','id','jv ka','km','kn','ms','th') - ), - array( - 'locales'=> array('ar'), - 'rules' => array( - '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') - ) - ), - array( 'locales' => array( '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'), - 'rules' => array( - 'one' => 1 - ) - ), - array( 'locales' => array('pt','am','bh','fil','tl','guw','hi','ln','mg','nso','ti','wa'), - 'rules'=> array( - 'one'=> '0-1' - ) - ), - array( 'locales' => array('fr'), - 'rules'=>array( - //n within 0..2 and n is not 2 - 'one' => array( 'is'=>'0-2', 'not' => 2) - ) - ), - array( 'locales' => array('lv'), - 'rules' => array( - '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) - ) - ) - ), - array( 'locales' => array('ga','se','sma','smi','smj','smn','sms'), - 'rules' => array( - 'one' => 1, - 'two' => 2 - ) - ), - array( 'locales' => array('ro','mo'), - 'rules' => array( - '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') - ) - ) - ) - ), - array( 'locales' => array( 'lt' ), - 'rules' => array( - //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') - ), - ) - ), - array( 'locales' => array( 'hr','ru','sr','uk','be','bs','sh' ), - 'rules' => array( - //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( - array( 'mod'=> 10, 'is' => 0), - 'or', - array( 'mod'=> 10, 'is' => '5-9'), - 'or', - array( 'mod'=> 100, 'is' => '11-14') - ), - ) - ), - array( 'locales' => array('cs','sk'), - 'rules' => array( - 'one' => 1, - 'few'=> '2-4' - ) - ), - array( 'locales' => array('pl'), - 'rules '=> array( - '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') - ) - ) - ), - array( 'locales' => array('sl'), - 'rules' => array( - 'one' => array( 'mod'=>100, 'is' => 1 ), - 'two' => array( 'mod'=>100, 'is' => 2 ), - 'few' => array( 'mod'=>100, 'is' => '3-4') - ) - ), - array( 'locales' => array('mt'), - 'rules' => array( - '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') - ) - ), - array( 'locales' => array( 'mk' ), - 'rules' => array( - 'one' => array('mod' => 10, 'is' => '1') - ) - ), - array( 'locales' => array( 'cy' ), - 'rules' => array( - 'one' => 1, - 'two' => 2, - //n is 8 or n is 11 - 'many' => array( - array( 'is' => 8 ), - array( 'is' => 11 ) - ) - ) - ) - ); - //takes the cldr representation and returns the proper form - function cldrConvertPlural($count, $forms){ - if ( !count($forms) ) { return ''; } - //get the rule set - $ruleSet = $this->getCldrRuleSet(); - //get the number of forms (ruleSet Count + 1 for 'other' ) - $fomsCount = count( $ruleSet ) + 1; - - //if count is 1 no plurals for this language: - if( count( $forms ) == 1) - return $forms[0]; - - $forms = $this->preConvertPlural( $forms, $fomsCount ); - - } - - function getCldrRuleSet(){ - $code = $this->getCode(); - foreach($this->masterCLDR as $ruleSet){ - if( in_array($code, $ruleSet['locales']) ){ - return $ruleSet['rules']; - } - } - //could not find the language code - return false; - } -} \ No newline at end of file diff --git a/js2/mwEmbed/php/cldrConverter.php b/js2/mwEmbed/php/languages/cldrConverter.php similarity index 96% rename from js2/mwEmbed/php/cldrConverter.php rename to js2/mwEmbed/php/languages/cldrConverter.php index de8b209356..612f4cabd9 100644 --- a/js2/mwEmbed/php/cldrConverter.php +++ b/js2/mwEmbed/php/languages/cldrConverter.php @@ -14,10 +14,9 @@ * * cldr also allows export of rule sets in json to associated javascript */ - class cldrConverter { static $masterCLDR = array( - // if locale is known to have no plurals, there are no rules + // if locales is known to have no plurals, there are no rules array( 'locales'=> array('az','fa','hu','ja','ko','my to','tr','vi','yo','zh', 'bo','dz','id','jv ka','km','kn','ms','th') @@ -190,13 +189,10 @@ class cldrConverter { if( count( $forms ) == 1) return $forms[0]; - $forms = $this->preConvertPlural( $forms, $fomsCount ); - } - function getCldrRuleSet(){ - $code = $this->getCode(); - foreach($this->masterCLDR as $ruleSet){ + static function getCldrRuleSet( $code ){ + foreach(self::$masterCLDR as $ruleSet){ if( in_array($code, $ruleSet['locales']) ){ return $ruleSet['rules']; } diff --git a/js2/mwEmbed/php/languages/mwEmbed.i18n.php b/js2/mwEmbed/php/languages/mwEmbed.i18n.php index 3c236e7add..92b70ef0ad 100644 --- a/js2/mwEmbed/php/languages/mwEmbed.i18n.php +++ b/js2/mwEmbed/php/languages/mwEmbed.i18n.php @@ -11,31 +11,6 @@ $messages = array(); $messages['en'] = array( - /* - * js file: /libClipEdit/mvClipEdit.js - */ - 'mwe-crop' => 'Crop image', - 'mwe-apply_crop' => 'Apply crop to image', - 'mwe-reset_crop' => 'Reset crop', - 'mwe-insert_image_page' => 'Insert into page', - 'mwe-insert_into_sequence' => 'Insert into sequence', - 'mwe-preview_insert' => 'Preview insert', - 'mwe-cancel_image_insert' => 'Cancel insert', - 'mwe-sc_fileopts' => 'Clip detail edit', - 'mwe-sc_inoutpoints' => 'Set in-out points', - 'mwe-sc_overlays' => 'Overlays', - 'mwe-sc_audio' => 'Audio control', - 'mwe-sc_duration' => 'Duration', - 'mwe-template_properties' => 'Template properties', - 'mwe-custom_title' => 'Custom title', - 'mwe-edit_properties' => 'Edit properties', - 'mwe-other_properties' => 'Other properties', - 'mwe-resource_page' => 'Resource page:', - 'mwe-set_in_out_points' => 'Set in-out points', - 'mwe-start_time' => 'Start time', - 'mwe-end_time' => 'End time', - 'mwe-preview_inout' => 'Preview in-out points', - /* * js file: /libTimedText/mvTextInterface.js */ @@ -46,63 +21,54 @@ $messages['en'] = array( 'mwe-no_text_tracks_found' => 'No text tracks were found', /* - * js file: /libSequencer/mvTimedEffectsEdit.js + * js file: /libAddMedia/mvBaseUploadInterface.js */ - 'mwe-transition_in' => 'Transition in', - 'mwe-transition_out' => 'Transition out', - 'mwe-effects' => 'Effects stack', - 'mwe-remove_transition' => 'Remove transition', - 'mwe-edit_transin' => 'Edit transition into clip', - 'mwe-edit_transout' => 'Edit transition out of clip', + 'mwe-upload-transcode-in-progress' => 'Transcode and upload in progress (do not close this window)', + 'mwe-upload-in-progress' => 'Upload in progress (do not close this window)', + 'mwe-upload-transcoded-status' => 'Transcoded', + 'mwe-uploaded-status' => 'Uploaded', + 'mwe-upload-stats-fileprogres' => '$1 of $2', + 'mwe-upload_completed' => 'Your upload is complete', + 'mwe-upload_done' => 'Your upload should be accessible.', + 'mwe-upload-unknown-size' => 'Unknown size', + 'mwe-cancel-confim' => 'Are you sure you want to cancel?', + 'mwe-successfulupload' => 'Upload successful', + 'mwe-uploaderror' => 'Upload error', + 'mwe-uploadwarning' => 'Upload warning', + 'mwe-unknown-error' => 'Unknown error:', + 'mwe-return-to-form' => 'Return to form', + 'mwe-file-exists-duplicate' => 'This file is a duplicate of the following file:', + 'mwe-fileexists' => 'A file with this name exists already. Please check $1 if you are not sure if you want to change it.', + 'mwe-fileexists-thumb' => '
Existing file
', + 'mwe-ignorewarning' => 'Ignore warning and save file anyway', + 'mwe-file-thumbnail-no' => 'The filename begins with $1', + 'mwe-go-to-resource' => 'Go to resource page', + 'mwe-upload-misc-error' => 'Unknown upload error', + 'mwe-wgfogg_warning_bad_extension' => 'You have selected a file with an unsuported extension (more information).', + 'mwe-cancel-button' => 'Cancel', + 'mwe-ok-button' => 'OK', /* - * js file: /libSequencer/mvSequencer.js + * js file: /libAddMedia/mvAdvFirefogg.js */ - 'mwe-menu_clipedit' => 'Edit media', - 'mwe-menu_transition' => 'Transitions and effects', - 'mwe-menu_cliplib' => 'Add media', - 'mwe-menu_resource_overview' => 'Resource overview', - 'mwe-menu_options' => 'Options', - 'mwe-loading_timeline' => 'Loading timeline ...', - 'mwe-loading_user_rights' => 'Loading user rights ...', - 'mwe-no_edit_permissions' => 'You do not have permissions to save changes to this sequence', - 'mwe-edit_clip' => 'Edit clip', - 'mwe-edit_save' => 'Save sequence changes', - 'mwe-saving_wait' => 'Save in progress (please wait)', - 'mwe-save_done' => 'Save complete', - 'mwe-edit_cancel' => 'Cancel sequence edit', - 'mwe-edit_cancel_confirm' => 'Are you sure you want to cancel your edit? Changes will be lost.', - 'mwe-zoom_in' => 'Zoom in', - 'mwe-zoom_out' => 'Zoom out', - 'mwe-cut_clip' => 'Cut clips', - 'mwe-expand_track' => 'Expand track', - 'mwe-collapse_track' => 'Collapse track', - 'mwe-play_from_position' => 'Play from playline position', - 'mwe-pixle2sec' => 'pixels to seconds', - 'mwe-rmclip' => 'Remove clip', - 'mwe-clip_in' => 'clip in', - 'mwe-clip_out' => 'clip out', - 'mwe-welcome_to_sequencer' => '

Welcome to the sequencer demo

Very limited functionality right now. Not much documentation yet either.', - 'mwe-no_selected_resource' => '

No resource selected

Select a clip to enable editing.', - 'mwe-error_edit_multiple' => '

Multiple resources selected

Select a single clip to edit it.', - 'mwe-editor_options' => 'Editor options', - 'mwe-editor_mode' => 'Editor mode', - 'mwe-simple_editor_desc' => 'simple editor (iMovie style)', - 'mwe-advanced_editor_desc' => 'advanced editor (Final Cut style)', - 'mwe-other_options' => 'Other options', - 'mwe-contextmenu_opt' => 'Enable context menus', - 'mwe-sequencer_credit_line' => 'Developed by Kaltura, Inc. in partnership with the Wikimedia Foundation (more information).', + 'fogg-help-sticky' => 'Help (click to stick)', + 'fogg-cg-preset' => 'Preset: $1', + 'fogg-cg-quality' => 'Basic quality and resolution control', + 'fogg-cg-meta' => 'Metadata for the clip', + 'fogg-cg-range' => 'Encoding range', + 'fogg-cg-advVideo' => 'Advanced video encoding controls', + 'fogg-cg-advAudio' => 'Advanced audio encoding controls', + 'fogg-preset-custom' => 'Custom settings', /* - * js file: /mv_embed.js + * js file: /libAddMedia/searchLibs/metavidSearch.js */ - 'mwe-loading_txt' => 'loading ...', - 'mwe-loading_title' => 'Loading...', - 'mwe-size-gigabytes' => '$1 GB', - 'mwe-size-megabytes' => '$1 MB', - 'mwe-size-kilobytes' => '$1 K', - 'mwe-size-bytes' => '$1 B', - 'mwe-error_load_lib' => 'Error: JavaScript $1 was not retrievable or does not define $2', + 'mwe-stream_title' => '$1 $2 to $3', + + /* + * js file: /libAddMedia/searchLibs/baseRemoteSearch.js + */ + 'mwe-imported_from' => '$1 imported from [$2 $3]. See the original [$4 resource page] for more information.', /* * js file: /libAddMedia/mvFirefogg.js @@ -124,26 +90,16 @@ $messages['en'] = array( 'fogg-hidepreview' => 'Hide preview', /* - * js file: /libAddMedia/searchLibs/baseRemoteSearch.js - */ - 'mwe-imported_from' => '$1 imported from [$2 $3]. See the original [$4 resource page] for more information.', - - /* - * js file: /libAddMedia/searchLibs/metavidSearch.js - */ - 'mwe-stream_title' => '$1 $2 to $3', - - /* - * js file: /libAddMedia/mvAdvFirefogg.js + * js file: /libAddMedia/simpleUploadForm.js */ - 'fogg-help-sticky' => 'Help (click to stick)', - 'fogg-cg-preset' => 'Preset: $1', - 'fogg-cg-quality' => 'Basic quality and resolution control', - 'fogg-cg-meta' => 'Metadata for the clip', - 'fogg-cg-range' => 'Encoding range', - 'fogg-cg-advVideo' => 'Advanced video encoding controls', - 'fogg-cg-advAudio' => 'Advanced audio encoding controls', - 'fogg-preset-custom' => 'Custom settings', + 'mwe-select_file' => 'Select file', + 'mwe-more_licence_options' => 'For more licence options, view the normal upload page', + 'mwe-select_ownwork' => 'I am uploading entirely my own work, and licencing it under:', + 'mwe-licence_cc-by-sa' => 'Creative Commons Share Alike (3.0)', + 'mwe-upload' => 'Upload file', + 'mwe-destfilename' => 'Destination filename:', + 'mwe-summary' => 'Summary', + 'mwe-error_not_loggedin' => 'You do not appear to be logged in or do not have upload privileges.', /* * js file: /libAddMedia/remoteSearchDriver.js @@ -186,44 +142,52 @@ $messages['en'] = array( 'mwe-preview_insert_resource' => 'Preview insert of resource: $1', /* - * js file: /libAddMedia/simpleUploadForm.js + * js file: /libSequencer/mvSequencer.js */ - 'mwe-select_file' => 'Select file', - 'mwe-more_licence_options' => 'For more licence options, view the normal upload page', - 'mwe-select_ownwork' => 'I am uploading entirely my own work, and licencing it under:', - 'mwe-licence_cc-by-sa' => 'Creative Commons Share Alike (3.0)', - 'mwe-upload' => 'Upload file', - 'mwe-destfilename' => 'Destination filename:', - 'mwe-summary' => 'Summary', - 'mwe-error_not_loggedin' => 'You do not appear to be logged in or do not have upload privileges.', + 'mwe-menu_clipedit' => 'Edit media', + 'mwe-menu_transition' => 'Transitions and effects', + 'mwe-menu_cliplib' => 'Add media', + 'mwe-menu_resource_overview' => 'Resource overview', + 'mwe-menu_options' => 'Options', + 'mwe-loading_timeline' => 'Loading timeline ...', + 'mwe-loading_user_rights' => 'Loading user rights ...', + 'mwe-no_edit_permissions' => 'You do not have permissions to save changes to this sequence', + 'mwe-edit_clip' => 'Edit clip', + 'mwe-edit_save' => 'Save sequence changes', + 'mwe-saving_wait' => 'Save in progress (please wait)', + 'mwe-save_done' => 'Save complete', + 'mwe-edit_cancel' => 'Cancel sequence edit', + 'mwe-edit_cancel_confirm' => 'Are you sure you want to cancel your edit? Changes will be lost.', + 'mwe-zoom_in' => 'Zoom in', + 'mwe-zoom_out' => 'Zoom out', + 'mwe-cut_clip' => 'Cut clips', + 'mwe-expand_track' => 'Expand track', + 'mwe-collapse_track' => 'Collapse track', + 'mwe-play_from_position' => 'Play from playline position', + 'mwe-pixle2sec' => 'pixels to seconds', + 'mwe-rmclip' => 'Remove clip', + 'mwe-clip_in' => 'clip in', + 'mwe-clip_out' => 'clip out', + 'mwe-welcome_to_sequencer' => '

Welcome to the sequencer demo

Very limited functionality right now. Not much documentation yet either.', + 'mwe-no_selected_resource' => '

No resource selected

Select a clip to enable editing.', + 'mwe-error_edit_multiple' => '

Multiple resources selected

Select a single clip to edit it.', + 'mwe-editor_options' => 'Editor options', + 'mwe-editor_mode' => 'Editor mode', + 'mwe-simple_editor_desc' => 'simple editor (iMovie style)', + 'mwe-advanced_editor_desc' => 'advanced editor (Final Cut style)', + 'mwe-other_options' => 'Other options', + 'mwe-contextmenu_opt' => 'Enable context menus', + 'mwe-sequencer_credit_line' => 'Developed by Kaltura, Inc. in partnership with the Wikimedia Foundation (more information).', /* - * js file: /libAddMedia/mvBaseUploadInterface.js + * js file: /libSequencer/mvTimedEffectsEdit.js */ - 'mwe-upload-transcode-in-progress' => 'Transcode and upload in progress (do not close this window)', - 'mwe-upload-in-progress' => 'Upload in progress (do not close this window)', - 'mwe-upload-transcoded-status' => 'Transcoded', - 'mwe-uploaded-status' => 'Uploaded', - 'mwe-upload-stats-fileprogres' => '$1 of $2', - 'mwe-upload_completed' => 'Your upload is complete', - 'mwe-upload_done' => 'Your upload should be accessible.', - 'mwe-upload-unknown-size' => 'Unknown size', - 'mwe-cancel-confim' => 'Are you sure you want to cancel?', - 'mwe-successfulupload' => 'Upload successful', - 'mwe-uploaderror' => 'Upload error', - 'mwe-uploadwarning' => 'Upload warning', - 'mwe-unknown-error' => 'Unknown error:', - 'mwe-return-to-form' => 'Return to form', - 'mwe-file-exists-duplicate' => 'This file is a duplicate of the following file:', - 'mwe-fileexists' => 'A file with this name exists already. Please check $1 if you are not sure if you want to change it.', - 'mwe-fileexists-thumb' => '
Existing file
', - 'mwe-ignorewarning' => 'Ignore warning and save file anyway', - 'mwe-file-thumbnail-no' => 'The filename begins with $1', - 'mwe-go-to-resource' => 'Go to resource page', - 'mwe-upload-misc-error' => 'Unknown upload error', - 'mwe-wgfogg_warning_bad_extension' => 'You have selected a file with an unsuported extension (more information).', - 'mwe-cancel-button' => 'Cancel', - 'mwe-ok-button' => 'OK', + 'mwe-transition_in' => 'Transition in', + 'mwe-transition_out' => 'Transition out', + 'mwe-effects' => 'Effects stack', + 'mwe-remove_transition' => 'Remove transition', + 'mwe-edit_transin' => 'Edit transition into clip', + 'mwe-edit_transout' => 'Edit transition out of clip', /* * js file: /libEmbedVideo/embedVideo.js @@ -275,6 +239,42 @@ $messages['en'] = array( 'mwe-read_before_embed' => 'Please read the security notes on remote embedding before acually embeding!', 'mwe-embed_site_or_blog' => 'Embed on your site or blog', 'mwe_related_videos' => 'Related videos', + + /* + * js file: /libClipEdit/mvClipEdit.js + */ + 'mwe-crop' => 'Crop image', + 'mwe-apply_crop' => 'Apply crop to image', + 'mwe-reset_crop' => 'Reset crop', + 'mwe-insert_image_page' => 'Insert into page', + 'mwe-insert_into_sequence' => 'Insert into sequence', + 'mwe-preview_insert' => 'Preview insert', + 'mwe-cancel_image_insert' => 'Cancel insert', + 'mwe-sc_fileopts' => 'Clip detail edit', + 'mwe-sc_inoutpoints' => 'Set in-out points', + 'mwe-sc_overlays' => 'Overlays', + 'mwe-sc_audio' => 'Audio control', + 'mwe-sc_duration' => 'Duration', + 'mwe-template_properties' => 'Template properties', + 'mwe-custom_title' => 'Custom title', + 'mwe-edit_properties' => 'Edit properties', + 'mwe-other_properties' => 'Other properties', + 'mwe-resource_page' => 'Resource page:', + 'mwe-set_in_out_points' => 'Set in-out points', + 'mwe-start_time' => 'Start time', + 'mwe-end_time' => 'End time', + 'mwe-preview_inout' => 'Preview in-out points', + + /* + * js file: /mv_embed.js + */ + 'mwe-loading_txt' => 'loading ...', + 'mwe-loading_title' => 'Loading...', + 'mwe-size-gigabytes' => '$1 GB', + 'mwe-size-megabytes' => '$1 MB', + 'mwe-size-kilobytes' => '$1 K', + 'mwe-size-bytes' => '$1 B', + 'mwe-error_load_lib' => 'Error: JavaScript $1 was not retrievable or does not define $2', ); /** Message documentation (Message documentation) diff --git a/js2/mwEmbed/php/noMediaWikiConfig.php b/js2/mwEmbed/php/noMediaWikiConfig.php index cf1024b928..531e13476a 100644 --- a/js2/mwEmbed/php/noMediaWikiConfig.php +++ b/js2/mwEmbed/php/noMediaWikiConfig.php @@ -24,6 +24,7 @@ $wgJSAutoloadLocalClasses = array(); /*Localization:*/ $wgEnableScriptLocalization = true; + $mwLanguageCode = 'en'; $wgContLanguageCode = ''; diff --git a/js2/mwEmbed/tests/testLang.html b/js2/mwEmbed/tests/testLang.html new file mode 100644 index 0000000000..b228e34049 --- /dev/null +++ b/js2/mwEmbed/tests/testLang.html @@ -0,0 +1,62 @@ + + +Test Plural Conversions (should match php) + + + + + + +

Test Javascript plural msg transformations

+ +
+ + + + diff --git a/js2/mwEmbed/tests/testLangEn.js b/js2/mwEmbed/tests/testLangEn.js new file mode 100644 index 0000000000..d970ea6ef2 --- /dev/null +++ b/js2/mwEmbed/tests/testLangEn.js @@ -0,0 +1,14 @@ +/* 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}}' +}); + +$mw.lang.loadRS({ + 'PLURAL' : { "one":1 } +}); \ No newline at end of file diff --git a/js2/mwEmbed/tests/testLangRU.js b/js2/mwEmbed/tests/testLangRU.js new file mode 100644 index 0000000000..2772c394ff --- /dev/null +++ b/js2/mwEmbed/tests/testLangRU.js @@ -0,0 +1,23 @@ +/* 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|правку|правки|правок}}', +}); +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"} + ] + } +}); diff --git a/js2/remoteMwEmbed.js b/js2/remoteMwEmbed.js index 0f535ccf4d..0b3a61ae8f 100644 --- a/js2/remoteMwEmbed.js +++ b/js2/remoteMwEmbed.js @@ -59,7 +59,8 @@ function rewrite_for_OggHandler( vidIdList ){ var type_attr = ''; // Check for audio if( pwidth == '22' && pheight == '22' ) { - pwidth = '400'; + //set width to parent width: + pwidth = $j( '#' + vidId ).width(); pheight = '100'; type_attr = 'type="audio/ogg"'; poster_attr = ''; -- 2.20.1