适配机库升级包

This commit is contained in:
xkeyC 2023-10-14 23:47:15 +08:00
parent 974f196869
commit d5d02d933a
4 changed files with 46 additions and 16 deletions

View File

@ -144,7 +144,21 @@ function GetSCLocalizationTranslateString(txtSrc) {
} else if (SCLocalizationEnableSplitMode) {
if (sourceKey.includes(" - ")) {
let nodeValue = txtSrc
sourceKey.split(" - ").forEach(function (splitKey) {
let splitKey = sourceKey.split(" - ");
if (splitKey[0].toLowerCase() === "upgrade" && key.includes("to") && key.endsWith("edition")) {
// 升级包规则
let noVersionStr = key.replace("STANDARD EDITION".toLowerCase(), "").replace("upgrade", "").replace("WARBOND EDITION".toLowerCase(), "")
let shipNames = noVersionStr.split(" to ")
let finalString = "升级包 " + GetSCLocalizationTranslateString(shipNames[0]) + " 到 " + GetSCLocalizationTranslateString(shipNames[1]);
if (key.endsWith("WARBOND EDITION".toLowerCase())) {
finalString = finalString + " 战争债券版"
} else {
finalString = finalString + " 标准版"
}
txtSrc = finalString
} else {
// 机库通用规则
splitKey.forEach(function (splitKey) {
if (SCLocalizationReplaceLocalesMap[splitKey.toLowerCase()]) {
nodeValue = nodeValue.replace(splitKey, SCLocalizationReplaceLocalesMap[splitKey.toLowerCase()])
} else {
@ -152,6 +166,7 @@ function GetSCLocalizationTranslateString(txtSrc) {
}
});
txtSrc = nodeValue
}
} else if (key.endsWith("starter pack") || key.endsWith("starter package")) {
let shipName = key.replace("starter package", "").replace("starter pack", "").trim()
if (SCLocalizationReplaceLocalesMap[shipName.toLowerCase()]) {

View File

@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "星际公民盒子浏览器拓展",
"version": "0.0.3",
"version": "0.0.4",
"description": "为星际公民网站及工具站提供汉化",
"author": "xkeyC",
"icons": {

View File

@ -144,7 +144,21 @@ function GetSCLocalizationTranslateString(txtSrc) {
} else if (SCLocalizationEnableSplitMode) {
if (sourceKey.includes(" - ")) {
let nodeValue = txtSrc
sourceKey.split(" - ").forEach(function (splitKey) {
let splitKey = sourceKey.split(" - ");
if (splitKey[0].toLowerCase() === "upgrade" && key.includes("to") && key.endsWith("edition")) {
// 升级包规则
let noVersionStr = key.replace("STANDARD EDITION".toLowerCase(), "").replace("upgrade", "").replace("WARBOND EDITION".toLowerCase(), "")
let shipNames = noVersionStr.split(" to ")
let finalString = "升级包 " + GetSCLocalizationTranslateString(shipNames[0]) + " 到 " + GetSCLocalizationTranslateString(shipNames[1]);
if (key.endsWith("WARBOND EDITION".toLowerCase())) {
finalString = finalString + " 战争债券版"
} else {
finalString = finalString + " 标准版"
}
txtSrc = finalString
} else {
// 机库通用规则
splitKey.forEach(function (splitKey) {
if (SCLocalizationReplaceLocalesMap[splitKey.toLowerCase()]) {
nodeValue = nodeValue.replace(splitKey, SCLocalizationReplaceLocalesMap[splitKey.toLowerCase()])
} else {
@ -152,6 +166,7 @@ function GetSCLocalizationTranslateString(txtSrc) {
}
});
txtSrc = nodeValue
}
} else if (key.endsWith("starter pack") || key.endsWith("starter package")) {
let shipName = key.replace("starter package", "").replace("starter pack", "").trim()
if (SCLocalizationReplaceLocalesMap[shipName.toLowerCase()]) {

View File

@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "星际公民盒子浏览器拓展",
"version": "0.0.3",
"version": "0.0.4",
"description": "为星际公民网站及工具站提供汉化",
"author": "xkeyC",
"icons": {