更新飞行页面和标题汉化方式
This commit is contained in:
parent
beae66100e
commit
a9dde19476
@ -28,6 +28,7 @@
|
|||||||
'Education': '教育',
|
'Education': '教育',
|
||||||
'Gym': '健身房',
|
'Gym': '健身房',
|
||||||
'Biology Modules': '生物学课程',
|
'Biology Modules': '生物学课程',
|
||||||
|
'Traveling':'飞行中',
|
||||||
};
|
};
|
||||||
const titleLinksDict = {
|
const titleLinksDict = {
|
||||||
'Personal stats': '个人统计信息',
|
'Personal stats': '个人统计信息',
|
||||||
@ -39,6 +40,13 @@
|
|||||||
'Back to Estate Agents': '返回地产中介',
|
'Back to Estate Agents': '返回地产中介',
|
||||||
'Tutorial': '教程',
|
'Tutorial': '教程',
|
||||||
'Back to Education': '返回',
|
'Back to Education': '返回',
|
||||||
|
'Recruit Citizens': '招募玩家',
|
||||||
|
'Events': '通知',
|
||||||
|
'Travel Home': "回国",
|
||||||
|
'Rehabilitation': "戒毒康复",
|
||||||
|
'People': "用户列表",
|
||||||
|
'Computer': '电脑',
|
||||||
|
'Market': '市场',
|
||||||
};
|
};
|
||||||
const sidebarDict = { // todo 从json加载
|
const sidebarDict = { // todo 从json加载
|
||||||
'Money': '现金',
|
'Money': '现金',
|
||||||
@ -82,7 +90,7 @@
|
|||||||
'Friends': '好友',
|
'Friends': '好友',
|
||||||
'Enemies': '敌人',
|
'Enemies': '敌人',
|
||||||
'Information': '信息',
|
'Information': '信息',
|
||||||
'Areas': '区域',
|
//'Areas': '区域',
|
||||||
'Lists': '列表',
|
'Lists': '列表',
|
||||||
'messages': '信息',
|
'messages': '信息',
|
||||||
'events': '通知',
|
'events': '通知',
|
||||||
@ -230,30 +238,20 @@
|
|||||||
'Upkeep:': '维护费:',
|
'Upkeep:': '维护费:',
|
||||||
'Staff:': '雇员费用:',
|
'Staff:': '雇员费用:',
|
||||||
};
|
};
|
||||||
const travelingDict = { // todo jsonify
|
const travelingDict = {
|
||||||
'Recruit Citizens': '招募玩家',
|
'Remaining Flight Time -': '剩余时间 - ',
|
||||||
'Events': '事件',
|
|
||||||
'Torn to London.': '正在飞往英国伦敦(London)。',
|
'Torn to London.': '正在飞往英国伦敦(London)。',
|
||||||
'London to Torn.': '正从英国伦敦(London)回城。', // todo 所有目的地
|
'London to Torn.': '正从英国伦敦(London)回城。',
|
||||||
'\nRemaining Flight Time -\n': ' 剩余时间 - ',
|
|
||||||
'Travel Home': "回国",
|
|
||||||
'Rehabilitation': "戒毒康复",
|
|
||||||
'People': "用户列表",
|
|
||||||
'Torn to Zurich.': '正在飞往瑞士苏黎世(Zurich)。',
|
'Torn to Zurich.': '正在飞往瑞士苏黎世(Zurich)。',
|
||||||
'Zurich to Torn.': '正从瑞士苏黎世(Zurich)回城。',
|
'Zurich to Torn.': '正从瑞士苏黎世(Zurich)回城。',
|
||||||
};
|
};
|
||||||
// 界面tips todo 全收集全翻译
|
// 界面tips todo 全收集、翻译
|
||||||
const tipsDict = {
|
const tipsDict = {
|
||||||
'\nAccording to the Economist Intelligence Unit\'s Quality of Life Index, Switzerland is the second best place in the world to be born, after Denmark. Torn ranked 224th, despite there being only 194 recognised nations in the world.\t': "根据经济学人信息部提供的生活质量指数,瑞士是世界上第二个最适合出生的地方,仅次于丹麦。尽管世界上只有194个公认的国家,但托恩却排名第224位。",
|
'According to the Economist Intelligence Unit\'s Quality of Life Index, Switzerland is the second best place in the world to be born, after Denmark. Torn ranked 224th, despite there being only 194 recognised nations in the world.': "根据经济学人信息部提供的生活质量指数,瑞士是世界上第二个最适合出生的地方,仅次于丹麦。尽管世界上只有194个公认的国家,但托恩却排名第224位。",
|
||||||
|
'The opportunities for employment in Torn are wide and varied, from jobs in the zoo and the meat warehouse through to fantastic openings at the strip club - a description rarely used to refer to those who work there.': "托恩的就业机会广泛而多样,从动物园和肉类仓库的工作,到脱衣舞俱乐部的奇妙开场--这是一个很少用来形容在那里工作的人的描述。",
|
||||||
'\nThe opportunities for employment in Torn are wide and varied, from jobs in the zoo and the meat warehouse through to fantastic openings at the strip club - a description rarely used to refer to those who work there.\t':
|
'One of the main requirements for a wedding to take place in Torn is the procurement of a ring. You may either purchase one from the Jewellery Store, or you can choose the more romantic option of stealing one, which requires far more effort if you think about it.': "在托恩举行婚礼的主要要求之一就是购买一枚戒指。你可以从珠宝店购买,也可以选择在偷窃戒指中选择一种很浪漫的方式,但是你冷静下来想想的话,这也是需要付出更大代价的。",
|
||||||
"托恩的就业机会广泛而多样,从动物园和肉类仓库的工作,到脱衣舞俱乐部的奇妙开场--这是一个很少用来形容在那里工作的人的描述。",
|
"Despite having no discernible court system Torn still employs several thousand people within its Judicial Services department. Nobody knows what the hell these people do all day, but if we had to guess, we'd say Solitaire.": "尽管没有明显的法院系统,托恩仍然在其司法服务部门雇用了几千人。没有人知道这些人整天都在做什么,但如果我们必须猜测,我们会说是接龙。",
|
||||||
|
"At one point a Dual Wield Melee course was available at Torn City College for a fee of $50,000,000, but this was discontinued when Torn's citizens realized they were effectively paying to learn how to hold two things at once.": "托恩城市学院一度开设了双持近战课程,收费50,000,000美元,但当托恩的市民意识到他们实际上是在花钱学习如何同时持有两样东西时,这个课程就停止了。"
|
||||||
'\nOne of the main requirements for a wedding to take place in Torn is the procurement of a ring. You may either purchase one from the Jewellery Store, or you can choose the more romantic option of stealing one, which requires far more effort if you think about it.\t': "在托恩举行婚礼的主要要求之一就是购买一枚戒指。你可以从珠宝店购买,也可以选择在偷窃戒指中选择一种很浪漫的方式,但是你冷静下来想想的话,这也是需要付出更大代价的。",
|
|
||||||
|
|
||||||
"\nDespite having no discernible court system Torn still employs several thousand people within its Judicial Services department. Nobody knows what the hell these people do all day, but if we had to guess, we'd say Solitaire.\t": "尽管没有明显的法院系统,托恩仍然在其司法服务部门雇用了几千人。没有人知道这些人整天都在做什么,但如果我们必须猜测,我们会说是接龙。",
|
|
||||||
|
|
||||||
"\nAt one point a Dual Wield Melee course was available at Torn City College for a fee of $50,000,000, but this was discontinued when Torn's citizens realized they were effectively paying to learn how to hold two things at once.\t": "托恩城市学院一度开设了双持近战课程,收费50,000,000美元,但当托恩的市民意识到他们实际上是在花钱学习如何同时持有两样东西时,这个课程就停止了。"
|
|
||||||
};
|
};
|
||||||
const cityDict = {//todo
|
const cityDict = {//todo
|
||||||
'Map': '地图',
|
'Map': '地图',
|
||||||
@ -331,47 +329,38 @@
|
|||||||
* 飞行页面
|
* 飞行页面
|
||||||
*/
|
*/
|
||||||
if (window.location.href.indexOf('index.php') >= 0 &&
|
if (window.location.href.indexOf('index.php') >= 0 &&
|
||||||
$('.travelling h4').length !== 0) {
|
$('div.travelling h4').length !== 0) {
|
||||||
|
const travelOB = new MutationObserver(travelOBInit);
|
||||||
|
|
||||||
|
function travelOBInit() {
|
||||||
|
travelOB.disconnect();
|
||||||
|
travelTrans();
|
||||||
|
travelOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
|
||||||
|
}
|
||||||
|
|
||||||
|
function travelTrans() {
|
||||||
titleTrans();
|
titleTrans();
|
||||||
|
contentTitleLinksTrans();
|
||||||
|
|
||||||
//如果在飞行页面
|
// 气泡
|
||||||
if ($('span.remaining-time').length !== 0) {
|
if (travelingDict[$('div.inner-popup').text().trim()])
|
||||||
$('#skip-to-content')[0].firstChild.nodeValue = '飞行中';
|
$('div.inner-popup').text(travelingDict[$('div.inner-popup').text().trim()]);
|
||||||
|
|
||||||
// 气泡 需要判断是否存在 因为torntools默认关闭云和飞机 冰蛙也会关闭
|
|
||||||
if ($('div.inner-popup').length !== 0 && tipsDict[$('div.inner-popup')[0].textContent]) {
|
|
||||||
$('div.inner-popup')[0].textContent = tipsDict[$('div.inner-popup')[0].textContent];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remaining Flight Time -
|
// Remaining Flight Time -
|
||||||
if (travelingDict[$('span.remaining-time')[0].firstChild.nodeValue]) {
|
$('div.destination-title span').contents().each((i, e) => {
|
||||||
$('span.remaining-time')[0].firstChild.nodeValue = travelingDict[$('span.remaining-time')[0].firstChild.nodeValue];
|
if (e.childNodes.length !== 0) return;
|
||||||
}
|
if (!e.nodeValue) return;
|
||||||
|
if (travelingDict[e.nodeValue.trim()])
|
||||||
$("#recruit-citizens")[0].firstChild.nodeValue = travelingDict[$("#recruit-citizens")[0].firstChild.nodeValue];
|
e.nodeValue = travelingDict[e.nodeValue.trim()];
|
||||||
}
|
|
||||||
|
|
||||||
//Events
|
|
||||||
$("#events")[0].firstChild.nodeValue = travelingDict[$("#events")[0].firstChild.nodeValue]
|
|
||||||
|
|
||||||
if ($("#travel-home").length !== 0) {
|
|
||||||
$("#travel-home")[0].firstChild.nodeValue = travelingDict[$("#travel-home")[0].firstChild.nodeValue];
|
|
||||||
$("#rehab")[0].firstChild.nodeValue = travelingDict[$("#rehab")[0].firstChild.nodeValue];//todo 在瑞士就加rehab
|
|
||||||
$("#people")[0].firstChild.nodeValue = travelingDict[$("#people")[0].firstChild.nodeValue];
|
|
||||||
}
|
|
||||||
|
|
||||||
const remainingTime = new MutationObserver(mutations => {
|
|
||||||
if (!travelingDict[$('span.description')[0].firstChild.nodeValue]) return;
|
|
||||||
remainingTime.disconnect();
|
|
||||||
/**
|
|
||||||
* Torn to {dest}.
|
|
||||||
* <span class="description">Torn to Zurich.</span>
|
|
||||||
*/
|
|
||||||
$('span.description')[0].firstChild.nodeValue = travelingDict[$('span.description')[0].firstChild.nodeValue];
|
|
||||||
remainingTime.observe($('span.remaining-time')[0], {childList: true, subtree: true});
|
|
||||||
});
|
});
|
||||||
remainingTime.observe($('span.remaining-time')[0], {childList: true, subtree: true});
|
// torntools扩展插件落地时间
|
||||||
|
if($('div.tt-landing-time span.description').text().split(' ')[0]==='Landing'){
|
||||||
|
const landingTime=$('div.tt-landing-time span.description').text().slice(11,19);
|
||||||
|
$('div.tt-landing-time span.description').text('于 '+landingTime+' 降落');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
travelTrans();
|
||||||
|
travelOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -697,8 +686,7 @@
|
|||||||
if (e.nodeValue === null) return;
|
if (e.nodeValue === null) return;
|
||||||
if (eduDict[e.nodeValue.trim()]) {
|
if (eduDict[e.nodeValue.trim()]) {
|
||||||
e.nodeValue = eduDict[e.nodeValue.trim()];
|
e.nodeValue = eduDict[e.nodeValue.trim()];
|
||||||
}
|
} else if (e.nodeValue.indexOf('seconds') >= 0) {
|
||||||
else if(e.nodeValue.indexOf('seconds')>=0){
|
|
||||||
e.nodeValue = e.nodeValue
|
e.nodeValue = e.nodeValue
|
||||||
.replace(' days, ', '天')
|
.replace(' days, ', '天')
|
||||||
.replace(' hours, ', '时')
|
.replace(' hours, ', '时')
|
||||||
@ -1537,9 +1525,10 @@
|
|||||||
* 页标题翻译
|
* 页标题翻译
|
||||||
*/
|
*/
|
||||||
function titleTrans() {
|
function titleTrans() {
|
||||||
if ($('h4#skip-to-content').length === 1)
|
const title = titleDict[$('h4#skip-to-content').text().trim()];
|
||||||
if (titleDict[$('h4#skip-to-content').text().trim()])
|
//if ($('h4#skip-to-content').length === 1)
|
||||||
$('h4#skip-to-content').text(titleDict[$('h4#skip-to-content').text().trim()]);
|
if (title && $('h4#skip-to-content').css('display')!=='none')
|
||||||
|
$('h4#skip-to-content').css('display', 'none').after(`<span style='float:left'><h4>` + title + `</h4></span>`);
|
||||||
}
|
}
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user