标签翻译器
评分: +86+–x

这是一个标签翻译器。在下面的“输入”文本框里塞进一段以空格分隔(手动添加或是从标签编辑框内复制得来)或以半角逗号+空格分隔(", ",从历史记录中复制而来)的英文标签列表……

autonomous ectoentropic euclid featured horror hostile murder-monster mystery observational scp sculpture the-sculpture

然后点击写着“翻译”的按钮……
就能在“输出”文本框里得到可以用在翻译上的标签列表。

自主 euclid 恐怖 敌意 杀人怪物 悬疑 观察影响 scp 雕塑 雕像-最初之作

不适用于翻译文章或者尚未拥有/尚未登记中文版本的标签则被放在另一个文本框中。

featured


该工具部分参照自前人开发的翻译器:
http://topia.wdfiles.com/local--code/trans-tags/1
http://topia.wdfiles.com/local--code/trans-tags-ver2/1
http://maxwellism.wdfiles.com/local--code/translate-tags/1

该工具所使用的标签列表为人工整理,不可避免地会存在缺漏或错误。假如你在使用过程中发现了上述错误乃至于其他问题,请于评论区留言,或私信Valeriya_C074Valeriya_C074。


快速访问:请点击此处
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <style>
        textarea {
            width: 100%;
            height: 70px;
        }
    </style>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.11/clipboard.min.js"></script>
    <script src="https://scpsandboxcn.wdfiles.com/local--code/tag-translator-v4/2"></script>
    <script>
    function TagSplit(TagString){
    var SplitedTag = new Array;
    let SingleTagS = 0;
    let SingleTagE = 0;
    for (var i = 0; i < TagString.length; i++) {
        if (/[ ]|[,]|[\n]/.test(TagString[i]) == true) {
            SingleTagE = i;
            if (SingleTagS < SingleTagE) {
                SplitedTag.push(TagString.substring(SingleTagS, SingleTagE));
            }
            SingleTagS = i + 1;
        }
    }
    return SplitedTag;
}
 
function IgnoreMultiSpace(array1) {
    var JointResult = "";
    for (let times = 0; times <= array1.length - 1; times++) {
        if (array1[times] != undefined) {
            JointResult = JointResult + array1[times] + " ";
        }
        else {
 
        }
    }
    JointResult = JointResult.substring(0, JointResult.length - 1);
    return JointResult;
}
 
function GetKeyByValue(obj, value) {
  return Object.keys(obj).find(key => obj[key] === value);
}
 
function TagConv() {
    new ClipboardJS('.btn');
 
    var InputTags = document.getElementById("taginput").value.toLowerCase().replace(/[\'\"\\\/\b\f\r\t]/g, "")+" ";
    var ListTagInput = TagSplit(InputTags);
    var ListTagFin = new Array(ListTagInput.length).fill(undefined);
    var ListTagExce = new Array(ListTagInput.length).fill(undefined);
    var mode = document.getElementById('modeselection').value;
    switch(mode){
        case "1":
            for (let i = 0, exceptionTag = 0; i <= ListTagInput.length; i++) {
                if (ListTagInput[i] in FullTagList == true) {
                ListTagFin[i] = FullTagList[ListTagInput[i]];
                }
            else {
                ListTagExce[exceptionTag] = ListTagInput[i];
                exceptionTag++;
 
                }
            }
            break;
        case "2":
            for (let i = 0, exceptionTag = 0; i <= ListTagInput.length; i++) {
                if (Object.values(FullTagList).includes(ListTagInput[i]) == true) {
                ListTagFin[i] = GetKeyByValue(FullTagList, ListTagInput[i]);
                }
            else {
                ListTagExce[exceptionTag] = ListTagInput[i];
                exceptionTag++;
                }
            }
            break;
    }
 
    var OutputTags = IgnoreMultiSpace(ListTagFin);
    var ExceptTags = IgnoreMultiSpace(ListTagExce);
    document.getElementById("tagoutput").innerHTML = OutputTags;
    document.getElementById("tagexcept").innerHTML = ExceptTags;
    return 0;
}
    </script>
</head>
<body>
    <div>
        <select id="modeselection">
            <option value="1">EN-CN</option>
            <option value="2">CN-EN</option>
        </select>
        <p>
            输入:
        </p>
        <textarea id="taginput"></textarea>
        <p></p>
        <p>
            输出:
        </p>
        <textarea id="tagoutput" readonly></textarea>
        <p>
            不需/暂无翻译:
        </p>
        <textarea id="tagexcept" readonly></textarea>
    </div>
    <div>
        <button onclick="TagConv()">翻译</button>
        <button class="btn" data-clipboard-target="#tagoutput">复制输出框中内容</button>
    </div>
</body>
</html>
除非特别注明,本页内容采用以下授权方式: Creative Commons Attribution-ShareAlike 3.0 License