Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4111525
ext.translate.storage.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ext.translate.storage.js
View Options
(
function
()
{
'use strict'
;
/**
* This class can save a translation into MediaWiki pages using the
* MediaWiki edit WebApi.
*
* @since 2013.10
*/
var
TranslationApiStorage
=
function
()
{
// No-op for now. Could take api module as param for example.
};
TranslationApiStorage
.
prototype
=
{
/**
* Save the translation.
*
* @param {string} title The title of the page including language code
* to store the translation.
* @param {string} translation The translation of the message
* @param {string} editSummary The edit summary
* @return {jQuery.Promise}
*/
save
:
function
(
title
,
translation
,
editSummary
)
{
var
api
=
new
mw
.
Api
();
return
api
.
postWithToken
(
'csrf'
,
{
format
:
'json'
,
formatversion
:
2
,
action
:
'edit'
,
title
:
title
,
text
:
translation
,
summary
:
editSummary
,
errorformat
:
'html'
,
errorlang
:
'uselang'
,
errorsuselocal
:
1
,
uselang
:
mw
.
config
.
get
(
'wgUserLanguage'
),
// If the session expires, fail the saving instead of saving it
// as an anonymous user (if anonymous can save).
// When undefined, the parameter is not included in the request
assert
:
mw
.
user
.
isAnon
()
?
undefined
:
'user'
}
);
}
};
mw
.
translate
=
mw
.
translate
||
{};
/** @private */
mw
.
translate
.
TranslationApiStorage
=
TranslationApiStorage
;
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Aug 18, 22:23 (1 d, 11 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f1/ab/72691fe2c2eacd3df0ba1b86bdfe
Default Alt Text
ext.translate.storage.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment