mirror of
https://github.com/YuzuZensai/Crowdin-Localization-Tools.git
synced 2026-01-30 12:32:39 +00:00
✨ feat: Version 1.0.6
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"latest": "1.0.5"
|
"latest": "1.0.6"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Crowdin Localization Tools
|
// @name Crowdin Localization Tools
|
||||||
// @namespace https://yuzu.kirameki.cafe/
|
// @namespace https://yuzu.kirameki.cafe/
|
||||||
// @version 1.0.5
|
// @version 1.0.6
|
||||||
// @description A tool for translating Crowdin projects using a CSV file
|
// @description A tool for translating Crowdin projects using a CSV file
|
||||||
// @author Yuzu (YuzuZensai)
|
// @author Yuzu (YuzuZensai)
|
||||||
// @match https://crowdin.com/editor/*
|
// @match https://crowdin.com/editor/*
|
||||||
@@ -42,7 +42,7 @@ const CONFIG = {
|
|||||||
fuzzyThreshold: 0.7,
|
fuzzyThreshold: 0.7,
|
||||||
|
|
||||||
metadata: {
|
metadata: {
|
||||||
version: '1.0.5',
|
version: '1.0.6',
|
||||||
repository: 'https://github.com/YuzuZensai/Crowdin-Localization-Tools',
|
repository: 'https://github.com/YuzuZensai/Crowdin-Localization-Tools',
|
||||||
authorGithub: 'https://github.com/YuzuZensai'
|
authorGithub: 'https://github.com/YuzuZensai'
|
||||||
}
|
}
|
||||||
@@ -1063,43 +1063,64 @@ function TranslatorTool() {
|
|||||||
const bgColor = `rgba(26, 115, 232, ${match.score * 0.1})`;
|
const bgColor = `rgba(26, 115, 232, ${match.score * 0.1})`;
|
||||||
row.style.backgroundColor = bgColor;
|
row.style.backgroundColor = bgColor;
|
||||||
|
|
||||||
// Add cells
|
function createCopyableCell(text, isTarget = false) {
|
||||||
var sourceCell = document.createElement('td');
|
var cell = document.createElement('td');
|
||||||
sourceCell.textContent = match.entry.source;
|
cell.textContent = text;
|
||||||
sourceCell.style.padding = '8px';
|
cell.style.padding = '8px';
|
||||||
sourceCell.style.border = '1px solid #e0e0e0';
|
cell.style.border = '1px solid #e0e0e0';
|
||||||
sourceCell.style.wordBreak = 'break-word';
|
cell.style.wordBreak = 'break-word';
|
||||||
sourceCell.style.whiteSpace = 'normal';
|
cell.style.whiteSpace = 'normal';
|
||||||
sourceCell.style.verticalAlign = 'top';
|
cell.style.verticalAlign = 'top';
|
||||||
row.appendChild(sourceCell);
|
cell.style.cursor = 'pointer';
|
||||||
|
cell.style.userSelect = 'text';
|
||||||
|
cell.style.position = 'relative';
|
||||||
|
cell.title = 'Click to copy';
|
||||||
|
|
||||||
var targetCell = document.createElement('td');
|
// Hover effect
|
||||||
targetCell.textContent = match.entry.target;
|
cell.addEventListener('mouseover', function() {
|
||||||
targetCell.style.padding = '8px';
|
this.style.backgroundColor = 'rgba(26, 115, 232, 0.1)';
|
||||||
targetCell.style.border = '1px solid #e0e0e0';
|
});
|
||||||
targetCell.style.wordBreak = 'break-word';
|
|
||||||
targetCell.style.whiteSpace = 'normal';
|
|
||||||
targetCell.style.verticalAlign = 'top';
|
|
||||||
row.appendChild(targetCell);
|
|
||||||
|
|
||||||
var noteCell = document.createElement('td');
|
cell.addEventListener('mouseout', function() {
|
||||||
noteCell.textContent = match.entry.note;
|
this.style.backgroundColor = 'transparent';
|
||||||
noteCell.style.padding = '8px';
|
});
|
||||||
noteCell.style.border = '1px solid #e0e0e0';
|
|
||||||
noteCell.style.wordBreak = 'break-word';
|
cell.addEventListener('click', function(e) {
|
||||||
noteCell.style.whiteSpace = 'normal';
|
if (window.getSelection().toString()) {
|
||||||
noteCell.style.verticalAlign = 'top';
|
return;
|
||||||
row.appendChild(noteCell);
|
}
|
||||||
|
|
||||||
|
navigator.clipboard.writeText(text).then(() => {
|
||||||
|
var tooltip = document.createElement('div');
|
||||||
|
tooltip.textContent = 'Copied!';
|
||||||
|
tooltip.style.position = 'absolute';
|
||||||
|
tooltip.style.backgroundColor = '#333';
|
||||||
|
tooltip.style.color = 'white';
|
||||||
|
tooltip.style.padding = '4px 8px';
|
||||||
|
tooltip.style.borderRadius = '4px';
|
||||||
|
tooltip.style.fontSize = '12px';
|
||||||
|
tooltip.style.zIndex = '1000';
|
||||||
|
tooltip.style.top = '0';
|
||||||
|
tooltip.style.left = '50%';
|
||||||
|
tooltip.style.transform = 'translate(-50%, -100%)';
|
||||||
|
|
||||||
|
cell.appendChild(tooltip);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
tooltip.remove();
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
row.appendChild(createCopyableCell(match.entry.source));
|
||||||
|
row.appendChild(createCopyableCell(match.entry.target, true));
|
||||||
|
row.appendChild(createCopyableCell(match.entry.note));
|
||||||
|
|
||||||
if (match.matchedWord) {
|
if (match.matchedWord) {
|
||||||
var matchCell = document.createElement('td');
|
row.appendChild(createCopyableCell(`${match.matchedWord} (${scorePercentage}%)`));
|
||||||
matchCell.textContent = `${match.matchedWord} (${scorePercentage}%)`;
|
|
||||||
matchCell.style.padding = '8px';
|
|
||||||
matchCell.style.border = '1px solid #e0e0e0';
|
|
||||||
matchCell.style.wordBreak = 'break-word';
|
|
||||||
matchCell.style.whiteSpace = 'normal';
|
|
||||||
matchCell.style.verticalAlign = 'top';
|
|
||||||
row.appendChild(matchCell);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tbody.appendChild(row);
|
tbody.appendChild(row);
|
||||||
|
|||||||
Reference in New Issue
Block a user