'use strict';
window.SwaggerTranslator = {
_words: [],
translate: function ()
{
var $this = this;
$('[data-sw-translate]').each(function ()
{
$(this).html($this._tryTranslate($(this).html()));
$(this).val($this._tryTranslate($(this).val()));
$(this).attr('title', $this._tryTranslate($(this).attr('title')));
});
},
setControllerSummary: function ()
{
$.ajax({
type: "get",
async: true,
url: $("#input_baseUrl").val(),
dataType: "json",
success: function (data)
{
var summaryDict = data.ControllerDesc;
var id, controllerName, strSummary;
$("#resources_container .resource").each(function (i, item)
{
id = $(item).attr("id");
if (id)
{
controllerName = id.substring(9);
strSummary = summaryDict[controllerName];
if (strSummary)
{
$(item).children(".heading").children(".options").first().prepend('
' + strSummary + '');
}
}
});
}
});
},
setModelDescriptions: function() {
$.ajax({
type: "get",
url: $("#input_baseUrl").val(),
dataType: "json",
success: function(data) {
var modelDesc = data.ModelDesc;
// ÔÚÄ£ÐÍÕ¹Ê¾ÇøÓòÌí¼ÓÃèÊö
$(".model-box").each(function() {
var modelName = $(this).find(".model-title").text();
if (modelDesc[modelName]) {
$(this).find(".model-description").remove();
$(this).append(
`${modelDesc[modelName]}
`
);
}
});
}
});
},
_tryTranslate: function (word)
{
return this._words[$.trim(word)] !== undefined ? this._words[$.trim(word)] : word;
},
learn: function (wordsMap)
{
this._words = wordsMap;
}
};
/* jshint quotmark: float */
window.SwaggerTranslator.learn({
"Warning: Deprecated": "¾¯¸æ£ºÒѹýʱ",
"Implementation Notes": "ʵÏÖ±¸×¢",
"Response Class": "ÏìÓ¦Àà",
"Status": "״̬",
"Parameters": "²ÎÊý",
"Parameter": "²ÎÊý",
"Value": "Öµ",
"Description": "ÃèÊö",
"Parameter Type": "²ÎÊýÀàÐÍ",
"Data Type": "Êý¾ÝÀàÐÍ",
"Response Messages": "ÏìÓ¦ÏûÏ¢",
"HTTP Status Code": "HTTP ״̬Âë",
"Reason": "ÔÒò",
"Response Model": "ÏìӦģÐÍ",
"Request URL": "ÇëÇó URL",
"Response Body": "ÏìÓ¦Ìå",
"Response Code": "ÏìÓ¦Âë",
"Response Headers": "ÏìӦͷ",
"Hide Response": "Òþ²ØÏìÓ¦",
"Headers": "Í·",
"Try it out!": "ÊÔһϣ¡",
"Show/Hide": "ÏÔʾ/Òþ²Ø",
"List Operations": "ÏÔʾ²Ù×÷",
"Expand Operations": "Õ¹¿ª²Ù×÷",
"Raw": "Ôʼ",
"can't parse JSON. Raw result": "ÎÞ·¨½âÎö JSON¡£Ôʼ½á¹û",
"Model Schema": "Ä£Ðͼܹ¹",
"Model": "Ä£ÐÍ",
"apply": "Ó¦ÓÃ",
"Username": "Óû§Ãû",
"Password": "ÃÜÂë",
"Terms of service": "·þÎñÌõ¿î",
"Created by": "´´½¨Õß",
"See more at": "²é¿´¸ü¶à£º",
"Contact the developer": "ÁªÏµ¿ª·¢Õß",
"api version": "api °æ±¾",
"Response Content Type": "ÏìÓ¦ Content Type",
"fetching resource": "ÕýÔÚ»ñÈ¡×ÊÔ´",
"fetching resource list": "ÕýÔÚ»ñÈ¡×ÊÔ´Áбí",
"Explore": "ä¯ÀÀ",
"Show Swagger Petstore Example Apis": "ÏÔʾ Swagger Petstore ʾÀý Apis",
"Can't read from server. It may not have the appropriate access-control-origin settings.": "ÎÞ·¨´Ó·þÎñÆ÷¶ÁÈ¡¡£¿ÉÄÜûÓÐÕýÈ·ÉèÖà access-control-origin¡£",
"Please specify the protocol for": "ÇëÖ¸¶¨ÐÒ飺",
"Can't read swagger JSON from": "ÎÞ·¨¶ÁÈ¡ swagger JSONÓÚ",
"Finished Loading Resource Information. Rendering Swagger UI": "ÒѼÓÔØ×ÊÔ´ÐÅÏ¢¡£ÕýÔÚäÖȾ Swagger UI",
"Unable to read api": "ÎÞ·¨¶ÁÈ¡ api",
"from path": "´Ó·¾¶",
"server returned": "·þÎñÆ÷·µ»Ø"
});
$(function ()
{
window.SwaggerTranslator.translate();
window.SwaggerTranslator.setControllerSummary();
});