This commit is contained in:
test123456654321 2024-10-25 16:56:29 +08:00
parent 5344ab40f0
commit 7ef2f9f904
50 changed files with 211 additions and 371 deletions

View File

@ -63,21 +63,18 @@ When multiple translation sources are activated, you can choose to embed a speci
Omitted
**5. Insert Spaces Between Overlapping Characters**
For some old Japanese game engines like SiglusEngine, they cannot correctly handle the width of Chinese characters and display them according to the width of English characters, causing overlapping of Chinese characters in embedded display. You can try adjusting this setting to solve this problem.
**6. Limit the Number of Characters per Line**
**5. Limit the Number of Characters per Line**
Sometimes some games have a limited number of characters per line, and content exceeding the length will be displayed outside the text box on the right and cannot be displayed. You can manually wrap the line to avoid this situation through this setting.
![img](https://image.lunatranslator.org/zh/embed/limitlength.png)
**7. Modify Game Font**
**6. Modify Game Font**
Omitted
**8. Embedded Safety Check**
**7. Embedded Safety Check**
For games like Renpy, the extracted text often includes characters of syntax elements such as `{` `}` `[` `]`. If the translation source does not handle these contents correctly, it will break the syntax and cause the game to crash. Therefore, the software defaults to **skipping translation** of certain character combinations that may cause the game by regex matching. If you are not worried about game crashes, you can cancel this setting, or manually replace some finer-grained regex matches to reduce unnecessary skipping.

View File

@ -62,21 +62,18 @@
Пропущено
**5. Вставить пробелы между перекрывающимися символами**
Для некоторых старых японских игровых движков, таких как SiglusEngine, неправильно обрабатывается ширина китайских символов, и они отображаются с шириной английских символов, что приводит к перекрытию символов во встроенном китайском тексте. Можно попробовать настроить эту опцию, чтобы решить эту проблему.
**6. Ограничить количество символов в строке**
**5. Ограничить количество символов в строке**
Иногда в некоторых играх количество символов в строке ограничено, и содержимое, превышающее длину, будет отображаться за пределами правой части текстового поля и не будет отображаться. Эту проблему можно решить, вручную разбив строки с помощью этой настройки.
![img](https://image.lunatranslator.org/zh/embed/limitlength.png)
**7. Изменить шрифт игры**
**6. Изменить шрифт игры**
Пропущено
**8. Проверка безопасности встроенного перевода**
**7. Проверка безопасности встроенного перевода**
Для игр, таких как Renpy, извлеченный текст часто включает символы `{` `}` `[` `]` и другие элементы синтаксиса. Если переводчик неправильно обрабатывает эти элементы и разрушает синтаксис, это может привести к сбою игры. Поэтому программа по умолчанию пропускает перевод некоторых комбинаций символов, которые могут привести к сбою игры, с помощью регулярных выражений. Если вы не боитесь сбоя игры, можете отключить эту настройку или вручную заменить некоторые более детализированные регулярные выражения, чтобы уменьшить ненужный пропуск.

View File

@ -62,21 +62,18 @@
**5. 在重叠显示的字间插入空格**
对于SiglusEngine等部分古早日本游戏引擎无法正确处理中文字符的宽度会把中文字符按照英文字符的宽度来显示导致内嵌的中文出现字符之间重叠。可以尝试调整这一设置来解决这一问题。
**6. 限制每行字数**
**5. 限制每行字数**
有时某些游戏每行能显示的字符数是有限的,超出长度的内容会显示到文本框右边的更外边而无法显示。可以通过这一设置来手动分行来避免这一情况。
![img](https://image.lunatranslator.org/zh/embed/limitlength.png)
**7. 修改游戏字体**
**6. 修改游戏字体**
**8. 内嵌安全性检查**
**7. 内嵌安全性检查**
对于Renpy等游戏提取的文本经常会包括`{` `}` `[` `]`等语法元素的字符,如果翻译源没有正确处理这些内容导致破坏了语法,会导致游戏崩溃。因此软件默认会通过正则匹配来**跳过翻译**某些可能会导致游戏的字符组合。如果不担心游戏崩溃,可以取消这一设置,或者手动更换一些更细粒度的正则匹配来减少不必要的跳过。

View File

@ -84,6 +84,12 @@ def getnotofflines(key):
return __
def checkxx(key):
if not translate_exits(key):
return False
return globalconfig["fanyi"][key].get("is_gpt_like", False)
def makeproxytab(self, basel):
grid1 = [
@ -110,6 +116,7 @@ def makeproxytab(self, basel):
mianfei = getall(l=mianfei, item="fanyi", name="./Lunatranslator/translator/%s.py")
shoufei = getall(l=shoufei, item="fanyi", name=translate_exits)
lixians = getall(l=lixians, item="fanyi", name=checkxx)
ocrs = getall(
l=getnotofflines("ocr"),
item="ocr",
@ -147,6 +154,7 @@ def makeproxytab(self, basel):
"语音合成",
"辞书",
"元数据",
"离线翻译",
"自动更新",
],
[
@ -156,6 +164,7 @@ def makeproxytab(self, basel):
functools.partial(makescrollgrid, readers),
functools.partial(makescrollgrid, cishus),
functools.partial(makescrollgrid, meta),
functools.partial(makescrollgrid, lixians),
functools.partial(makescrollgrid, github),
],
delay=True,

View File

@ -329,16 +329,6 @@ def gethookembedgrid(self):
"将汉字转换成繁体/日式汉字",
D_getsimpleswitch(globalconfig["embedded"], "trans_kanji"),
],
[
"在重叠显示的字间插入空格",
"",
D_getsimplecombobox(
["不插入空格", "每个字后插入空格", "仅在无法编码的字后插入"],
globalconfig["embedded"],
"insertspace_policy",
callback=lambda _: gobject.baseobject.textsource.flashembedsettings(),
),
],
[
"限制每行字数",
D_getsimpleswitch(globalconfig["embedded"], "limittextlength_use"),

View File

@ -2,7 +2,7 @@ from qtsymbols import *
import json, time, functools, os, base64, uuid
from urllib.parse import quote
from traceback import print_exc
import qtawesome, requests, gobject, windows
import qtawesome, requests, gobject, windows, winsharedutils
import myutils.ankiconnect as anki
from myutils.hwnd import grabwindow
from myutils.config import globalconfig, _TR, static_data
@ -38,6 +38,7 @@ from gui.dynalang import (
LFormLayout,
LLabel,
LMainWindow,
LAction,
)
@ -763,11 +764,13 @@ from cishu.cishubase import DictTree
DictNodeRole = Qt.ItemDataRole.UserRole + 1
DeterminedhasChildren = DictNodeRole + 1
isWordNode = DeterminedhasChildren + 1
isLabeleddWord = isWordNode + 1
class DynamicTreeModel(QStandardItemModel):
def __init__(self):
def __init__(self, ref):
super().__init__()
self.ref = ref
def hasChildren(self, index):
if self.data(index, isWordNode):
@ -790,6 +793,7 @@ class DynamicTreeModel(QStandardItemModel):
childs = node.childrens()
self.setData(index, len(childs) > 0, DeterminedhasChildren)
thisitem = self.itemFromIndex(index)
maketuples = tuple((tuple(_) for _ in globalconfig["wordlabel"]))
for c in childs:
if isinstance(c, str):
t = c
@ -802,28 +806,123 @@ class DynamicTreeModel(QStandardItemModel):
item.setData(c, DictNodeRole)
else:
item.setData(True, isWordNode)
if (thisitem.text(), t) in maketuples:
item.setData(True, isLabeleddWord)
item.setData(
QBrush(Qt.GlobalColor.cyan), Qt.ItemDataRole.BackgroundRole
)
thisitem.appendRow([item])
self.ref(index)
def onDoubleClicked(self, index: QModelIndex):
if not self.data(index, isWordNode):
return
gobject.baseobject.searchwordW.search_word.emit(self.itemFromIndex(index).text(), False)
gobject.baseobject.searchwordW.search_word.emit(
self.itemFromIndex(index).text(), False
)
class kpQTreeView(QTreeView):
enterpressed = pyqtSignal(QModelIndex)
def keyPressEvent(self, e: QKeyEvent):
if e.key() == Qt.Key.Key_Return or e.key() == Qt.Key.Key_Enter:
self.enterpressed.emit(self.currentIndex())
else:
super().keyPressEvent(e)
class showdiction(LMainWindow):
def __init__(self, parent):
def setwordfilter(self, index=None):
w = self.word.text()
if index is None:
item = self.model.invisibleRootItem()
index = self.model.indexFromItem(self.model.invisibleRootItem())
else:
item = self.model.itemFromIndex(index)
for i in range(item.rowCount()):
_item = item.child(i)
isw = _item.data(isWordNode)
if isw is None:
isw = False
self.tree.setRowHidden(i, index, isw and (w not in _item.text()))
self.setwordfilter(self.model.indexFromItem(_item))
def showmenu(self, _):
idx = self.tree.currentIndex()
if not idx.isValid():
return
isw = idx.data(isWordNode)
item = self.model.itemFromIndex(idx)
menu = QMenu(self)
copy = LAction("复制")
search = LAction("查词")
label = LAction("标记")
delabel = LAction("去除标记")
menu.addAction(copy)
if isw:
menu.addAction(search)
if idx.data(isLabeleddWord):
menu.addAction(delabel)
else:
menu.addAction(label)
action = menu.exec(QCursor.pos())
if action == search:
self.model.onDoubleClicked(idx)
elif copy == action:
winsharedutils.clipboard_set(item.text())
elif action == label:
item.setData(True, isLabeleddWord)
item.setData(QBrush(Qt.GlobalColor.cyan), Qt.ItemDataRole.BackgroundRole)
globalconfig["wordlabel"].append(
(self.model.itemFromIndex(self.model.parent(idx)).text(), item.text())
)
elif action == delabel:
item.setData(False, isLabeleddWord)
item.setData(None, Qt.ItemDataRole.BackgroundRole)
try:
globalconfig["wordlabel"].remove(
(
self.model.itemFromIndex(self.model.parent(idx)).text(),
item.text(),
)
)
except:
pass
def __init__(self, parent: QWidget):
super(showdiction, self).__init__(parent)
wordfilter = QHBoxLayout()
word = QLineEdit()
self.word = word
word.returnPressed.connect(self.setwordfilter)
wordfilter.addWidget(word)
butn = getIconButton(self.setwordfilter, "fa.filter")
wordfilter.addWidget(butn)
self.resize(400, parent.height())
self.setWindowTitle("查看")
self.tree = QTreeView(self)
self.tree = kpQTreeView(self)
self.tree.setHeaderHidden(True)
self.tree.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
self.setCentralWidget(self.tree)
__c = QWidget()
__lay = QVBoxLayout()
__c.setLayout(__lay)
__lay.setSpacing(0)
__lay.setContentsMargins(0, 0, 0, 0)
__lay.addLayout(wordfilter)
__lay.addWidget(self.tree)
self.setCentralWidget(__c)
self.model = DynamicTreeModel()
self.model = DynamicTreeModel(self.setwordfilter)
self.tree.setModel(self.model)
self.tree.expanded.connect(self.model.loadChildren)
root = self.model.invisibleRootItem()
self.tree.doubleClicked.connect(self.model.onDoubleClicked)
self.tree.enterpressed.connect(self.model.onDoubleClicked)
self.tree.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
self.tree.customContextMenuRequested.connect(self.showmenu)
good = False
for k in globalconfig["cishuvisrank"]:
cishu = gobject.baseobject.cishus[k]

View File

@ -14,7 +14,6 @@ def list_models(typename, regist):
"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0].strip()
},
proxies=getproxy(("ocr", typename)),
timeout=10,
)
try:
return sorted([_["id"] for _ in resp.json()["data"]])

View File

@ -10,7 +10,6 @@ def list_models(typename, regist):
urlpathjoin(regist["BASE_URL"]().strip(), "v1beta/models"),
params={"key": regist["key"]().split("|")[0].strip()},
proxies=getproxy(("ocr", typename)),
timeout=10,
)
try:
models = resp.json()["models"]

View File

@ -187,9 +187,7 @@ class OCR(baseocr):
hashed = hmac.new(key, raw, sha1)
b64output = base64.encodebytes(hashed.digest()).decode("utf-8")
req_para.update({"Signature": b64output})
r = self.proxysession.get(
url="https://ocr.tencentcloudapi.com/", params=req_para, timeout=10
)
r = self.proxysession.get("https://ocr.tencentcloudapi.com/", params=req_para)
try:
boxs = [

View File

@ -1,7 +1,7 @@
try:
from PyQt5 import QtSvg
from PyQt5.QtWidgets import QFrame,QListView,QCheckBox,QAbstractItemView,QTextEdit,QTableView,QHeaderView,QColorDialog,QSpinBox,QDoubleSpinBox,QComboBox,QDialogButtonBox,QMainWindow,QMessageBox,QDialog,QGridLayout,QTextBrowser,QGraphicsDropShadowEffect,QWidget,QSizePolicy,QScrollArea,QApplication,QPushButton,QSystemTrayIcon,QPlainTextEdit,QAction,QMenu,QFileDialog,QKeySequenceEdit,QLabel,QSpacerItem,QWidgetItem,QLayout,QTextBrowser,QLineEdit,QFormLayout,QSizePolicy,QTabWidget,QTabBar,QSplitter,QListWidget,QListWidgetItem,QHBoxLayout,QVBoxLayout,QSizeGrip,QFontComboBox,QProgressBar,QRadioButton,QButtonGroup,QSlider,QToolTip,QGroupBox,QGraphicsOpacityEffect,QStackedWidget,QStyledItemDelegate,QStyleOptionViewItem,QFontDialog,QTreeView
from PyQt5.QtGui import QIconEngine,QIntValidator,QStandardItem,QStandardItemModel,QImageWriter,QIcon,QTextCharFormat,QTextBlockFormat,QResizeEvent,QTextCursor,QFontMetricsF,QMouseEvent,QImage,QPainter,QRegion,QCloseEvent,QFontDatabase,QKeySequence,QPixmap,QCursor,QColor,QFont,QPen,QPainterPath,QBrush,QFontMetrics,QShowEvent,QWheelEvent,QPaintEvent,QTextLayout, QTextOption,QDragEnterEvent, QDropEvent,QTransform
from PyQt5.QtGui import QIconEngine,QIntValidator,QStandardItem,QStandardItemModel,QImageWriter,QIcon,QTextCharFormat,QTextBlockFormat,QResizeEvent,QTextCursor,QFontMetricsF,QMouseEvent,QImage,QPainter,QRegion,QCloseEvent,QFontDatabase,QKeySequence,QPixmap,QCursor,QColor,QFont,QPen,QPainterPath,QBrush,QFontMetrics,QShowEvent,QWheelEvent,QPaintEvent,QTextLayout, QTextOption,QDragEnterEvent, QDropEvent,QTransform,QKeyEvent
from PyQt5.QtCore import QObject,pyqtSignal,Qt,QSize,QByteArray,QBuffer,QPointF,QPoint,QRect,QEvent,QModelIndex,QTimer,QRectF,QVariantAnimation,QUrl,QPropertyAnimation,QLocale,QSignalBlocker
isqt5 = True
class LineHeightTypes:
@ -12,7 +12,7 @@ except:
#print_exc()
from PyQt6 import QtSvg
from PyQt6.QtWidgets import QFrame,QListView,QCheckBox,QAbstractItemView,QTextEdit,QTableView,QHeaderView,QColorDialog,QSpinBox,QDoubleSpinBox,QComboBox,QDialogButtonBox,QMainWindow,QMessageBox,QDialog,QGridLayout,QTextBrowser,QGraphicsDropShadowEffect,QWidget,QSizePolicy,QScrollArea,QApplication,QPushButton,QSystemTrayIcon,QPlainTextEdit,QMenu,QFileDialog,QKeySequenceEdit,QLabel,QSpacerItem,QWidgetItem,QLayout,QTextBrowser,QLineEdit,QFormLayout,QSizePolicy,QTabWidget,QTabBar,QSplitter,QListWidget,QListWidgetItem,QHBoxLayout,QVBoxLayout,QSizeGrip,QFontComboBox,QProgressBar,QRadioButton,QButtonGroup,QSlider,QToolTip,QGroupBox,QGraphicsOpacityEffect,QStackedWidget,QTreeView
from PyQt6.QtGui import QIconEngine,QIntValidator,QAction,QStandardItem,QStandardItemModel,QImageWriter,QIcon,QTextCharFormat,QTextBlockFormat,QResizeEvent,QTextCursor,QFontMetricsF,QMouseEvent,QImage,QPainter,QRegion,QCloseEvent,QFontDatabase,QKeySequence,QPixmap,QCursor,QColor,QFont,QPen,QPainterPath,QBrush,QFontMetrics,QShowEvent,QWheelEvent,QPaintEvent,QTextLayout, QTextOption
from PyQt6.QtGui import QIconEngine,QIntValidator,QAction,QStandardItem,QStandardItemModel,QImageWriter,QIcon,QTextCharFormat,QTextBlockFormat,QResizeEvent,QTextCursor,QFontMetricsF,QMouseEvent,QImage,QPainter,QRegion,QCloseEvent,QFontDatabase,QKeySequence,QPixmap,QCursor,QColor,QFont,QPen,QPainterPath,QBrush,QFontMetrics,QShowEvent,QWheelEvent,QPaintEvent,QTextLayout, QTextOption,QKeyEvent
from PyQt6.QtCore import QObject,pyqtSignal,Qt,QSize,QByteArray,QBuffer,QPointF,QPoint,QRect,QEvent,QModelIndex,QTimer,QRectF,QVariantAnimation,QUrl,QPropertyAnimation,QLocale
isqt5 = False

View File

@ -108,7 +108,7 @@ class ResponseBase:
m = re.search(r"charset=([\w-]+)", content_type)
charset = m.group(1) if m else "utf-8"
return charset
@property
def maybejson(self):
try:
@ -290,6 +290,8 @@ class Requester_common:
headers["Content-Type"] = contenttype
proxy = proxies.get(scheme, None) if proxies else None
proxy = None if proxy == "" else proxy
if timeout is None:
timeout = 10
if timeout:
if isinstance(timeout, (float, int)):
timeout = int(timeout * 1000) # convert to milliseconds

View File

@ -215,7 +215,6 @@ class texthook(basetext):
c_bool,
c_wchar_p,
c_uint32,
c_uint32,
c_bool,
)
self.Luna_checkisusingembed = LunaHost.Luna_checkisusingembed
@ -492,7 +491,6 @@ class texthook(basetext):
if globalconfig["embedded"]["changefont"]
else ""
),
globalconfig["embedded"]["insertspace_policy"],
globalconfig["embedded"]["keeprawtext"],
True,
)

View File

@ -80,17 +80,6 @@ class ModernMt(Tse):
self.output_zh = "zh-CN"
self.input_limit = int(5e3)
def get_language_map(self, lang_url, ss, headers, timeout, proxies, **kwargs):
lang_html = ss.get(
lang_url, headers=headers, timeout=timeout, proxies=proxies
).text
d_lang_map = eval(
eval(re.compile("""('{(.*?)}')""").search(lang_html).group())
) # JSON.parse('{"sq":
lang_list = sorted(d_lang_map)
return {}.fromkeys(lang_list, lang_list)
def modernMt_api(
self,
query_text: str,
@ -98,31 +87,9 @@ class ModernMt(Tse):
to_language: str = "en",
**kwargs
):
"""
https://www.modernmt.com/translate
:param query_text: str, must.
:param from_language: str, default 'auto'.
:param to_language: str, default 'en'.
:param **kwargs:
:param timeout: float, default None.
:param proxies: dict, default None.
:param sleep_seconds: float, default 0.
:param is_detail_result: boolean, default False.
:param if_ignore_limit_of_length: boolean, default False.
:param limit_of_length: int, default 5000.
:param if_ignore_empty_query: boolean, default False.
:param update_session_after_freq: int, default 1000.
:param update_session_after_seconds: float, default 1500.
:param if_show_time_stat: boolean, default False.
:param show_time_stat_precision: int, default 4.
:param if_print_warning: bool, default True.
:return: str or dict
"""
timeout = kwargs.get("timeout", None)
proxies = kwargs.get("proxies", None)
sleep_seconds = kwargs.get("sleep_seconds", 0)
if_print_warning = kwargs.get("if_print_warning", True)
is_detail_result = kwargs.get("is_detail_result", False)
update_session_after_freq = kwargs.get(
"update_session_after_freq", self.default_session_freq
@ -145,7 +112,6 @@ class ModernMt(Tse):
_ = self.session.get(
self.host_url,
headers=self.host_headers,
timeout=timeout,
proxies=proxies,
)
@ -167,7 +133,6 @@ class ModernMt(Tse):
self.api_url,
json=form_data,
headers=self.api_headers,
timeout=timeout,
proxies=proxies,
)
r.raise_for_status()

View File

@ -87,26 +87,7 @@ class TranslateCom(Tse):
to_language: str = "en",
**kwargs
):
"""
https://www.translate.com/machine-translation
:param query_text: str, must.
:param from_language: str, default 'auto'.
:param to_language: str, default 'en'.
:param **kwargs:
:param timeout: float, default None.
:param proxies: dict, default None.
:param sleep_seconds: float, default `random.random()`.
:param is_detail_result: boolean, default False.
:param if_ignore_limit_of_length: boolean, default False.
:param limit_of_length: int, default 5000.
:param if_ignore_empty_query: boolean, default False.
:param update_session_after_seconds: float, default 1500.
:param if_show_time_stat: boolean, default False.
:param show_time_stat_precision: int, default 4.
:return: str or dict
"""
timeout = kwargs.get("timeout", None)
proxies = kwargs.get("proxies", None)
is_detail_result = kwargs.get("is_detail_result", False)
sleep_seconds = kwargs.get("sleep_seconds", random.random())
@ -127,13 +108,11 @@ class TranslateCom(Tse):
_ = self.session.get(
self.host_url,
headers=self.host_headers,
timeout=timeout,
proxies=proxies,
)
lang_r = self.session.get(
self.language_url,
headers=self.host_headers,
timeout=timeout,
proxies=proxies,
)
self.language_description = lang_r.json()
@ -144,7 +123,6 @@ class TranslateCom(Tse):
self.lang_detect_url,
data=detect_form,
headers=self.api_headers,
timeout=timeout,
proxies=proxies,
)
from_language = r_detect.json()["language"]
@ -159,7 +137,6 @@ class TranslateCom(Tse):
self.api_url,
data=form_data,
headers=self.api_headers,
timeout=timeout,
proxies=proxies,
)
r.raise_for_status()

View File

@ -87,49 +87,19 @@ class BaiduV1(Tse):
to_language: str = "en",
**kwargs
):
"""
https://fanyi.baidu.com
:param query_text: str, must.
:param from_language: str, default 'auto'.
:param to_language: str, default 'en'.
:param **kwargs:
:param timeout: float, default None.
:param proxies: dict, default None.
:param sleep_seconds: float, default 0.
:param is_detail_result: boolean, default False.
:param if_ignore_limit_of_length: boolean, default False.
:param limit_of_length: int, default 5000.
:param if_ignore_empty_query: boolean, default False.
:param update_session_after_freq: int, default 1000.
:param update_session_after_seconds: float, default 1500.
:param if_show_time_stat: boolean, default False.
:param show_time_stat_precision: int, default 4.
:param if_print_warning: bool, default True.
:return: str or dict
"""
timeout = kwargs.get("timeout", None)
proxies = kwargs.get("proxies", None)
sleep_seconds = kwargs.get("sleep_seconds", 0)
update_session_after_freq = kwargs.get(
"update_session_after_freq", self.default_session_freq
)
update_session_after_seconds = kwargs.get(
"update_session_after_seconds", self.default_session_seconds
)
if not (self.session):
self.session = requests.Session()
_ = self.session.get(
self.host_url,
headers=self.host_headers,
timeout=timeout,
proxies=proxies,
) # must twice, send cookies.
host_html = self.session.get(
self.host_url,
headers=self.host_headers,
timeout=timeout,
proxies=proxies,
).text
# self.language_map = self.get_language_map(host_html, from_language=from_language, to_language=to_language)
@ -144,7 +114,6 @@ class BaiduV1(Tse):
self.api_url,
data=form_data,
headers=self.api_headers,
timeout=timeout,
proxies=proxies,
)
r.raise_for_status()

View File

@ -81,7 +81,7 @@ class basetrans(commonbase):
using_gpt_dict = False
def level2init(self):
if self.transtype == "offline":
if (self.transtype == "offline") and (not self.is_gpt_like):
globalconfig["fanyi"][self.typename]["useproxy"] = False
self.multiapikeycurrentidx = -1
self.queue = PriorityQueue()

View File

@ -105,28 +105,6 @@ class Bing(Tse):
to_language: str = "en",
**kwargs
):
"""
https://bing.com/Translator, https://cn.bing.com/Translator.
:param query_text: str, must.
:param from_language: str, default 'auto'.
:param to_language: str, default 'en'.
:param **kwargs:
:param timeout: float, default None.
:param proxies: dict, default None.
:param sleep_seconds: float, default 0.
:param is_detail_result: boolean, default False.
:param if_ignore_limit_of_length: boolean, default False.
:param limit_of_length: int, default 5000.
:param if_ignore_empty_query: boolean, default False.
:param update_session_after_freq: int, default 1000.
:param update_session_after_seconds: float, default 1500.
:param if_show_time_stat: boolean, default False.
:param show_time_stat_precision: int, default 4.
:param if_print_warning: bool, default True.
:param if_use_cn_host: boolean, default None.
:return: str or dict
"""
use_cn_condition = (
kwargs.get("if_use_cn_host", None) or self.server_region == "CN"
)
@ -135,10 +113,8 @@ class Bing(Tse):
self.host_headers = self.get_headers(self.host_url, if_api=False)
self.api_headers = self.get_headers(self.host_url, if_api=True)
timeout = kwargs.get("timeout", None)
proxies = kwargs.get("proxies", None)
sleep_seconds = kwargs.get("sleep_seconds", 0)
if_print_warning = kwargs.get("if_print_warning", True)
is_detail_result = kwargs.get("is_detail_result", False)
update_session_after_freq = kwargs.get(
"update_session_after_freq", self.default_session_freq
@ -163,7 +139,6 @@ class Bing(Tse):
host_html = self.session.get(
self.host_url,
headers=self.host_headers,
timeout=timeout,
proxies=proxies,
).text
self.tk = self.get_tk(host_html)
@ -185,7 +160,6 @@ class Bing(Tse):
api_url,
headers=self.host_headers,
data=form_data,
timeout=timeout,
proxies=proxies,
)
r.raise_for_status()

View File

@ -130,7 +130,6 @@ def list_models(typename, regist):
"X-Client-Name": "my-cool-project",
},
proxies=getproxy(("fanyi", typename)),
timeout=10,
).json()
try:
models = js["models"]

View File

@ -94,7 +94,6 @@ def list_models(typename, regist):
urlpathjoin(regist["BASE_URL"]().strip(), "v1beta/models"),
params={"key": regist["SECRET_KEY"]().split("|")[0].strip()},
proxies=getproxy(("fanyi", typename)),
timeout=10,
).json()
try:
models = js["models"]

View File

@ -14,7 +14,6 @@ def list_models(typename, regist):
"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0].strip()
},
proxies=getproxy(("fanyi", typename)),
timeout=10,
)
try:
return sorted([_["id"] for _ in resp.json()["data"]])
@ -73,7 +72,9 @@ class gptcommon(basetrans):
def commonparseresponse(self, query, response: requests.ResponseBase, usingstream):
if usingstream:
message = ""
if not response.headers["Content-Type"].startswith("text/event-stream"):
if (
not response.headers["Content-Type"].startswith("text/event-stream")
) and (response.status_code != 200):
# application/json
# text/html
raise Exception(response.maybejson)

View File

@ -96,25 +96,6 @@ class Itranslate(Tse):
to_language: str = "en",
**kwargs
):
"""
https://itranslate.com/webapp
:param query_text: str, must.
:param from_language: str, default 'auto'.
:param to_language: str, default 'en'.
:param **kwargs:
:param timeout: float, default None.
:param proxies: dict, default None.
:param sleep_seconds: float, default `random.random()`.
:param is_detail_result: boolean, default False.
:param if_ignore_limit_of_length: boolean, default False.
:param limit_of_length: int, default 5000.
:param if_ignore_empty_query: boolean, default False.
:param update_session_after_seconds: float, default 1500.
:param if_show_time_stat: boolean, default False.
:param show_time_stat_precision: int, default 4.
:return: str or dict
"""
if not (self.session):
self.session = requests.Session()
mainjsurl = self.session.get(

View File

@ -102,28 +102,6 @@ class QQTranSmart(Tse):
to_language: str = "en",
**kwargs
):
"""
https://transmart.qq.com
:param query_text: str, must.
:param from_language: str, default 'auto'.
:param to_language: str, default 'en'.
:param **kwargs:
:param timeout: float, default None.
:param proxies: dict, default None.
:param sleep_seconds: float, default 0.
:param is_detail_result: boolean, default False.
:param if_ignore_limit_of_length: boolean, default False.
:param limit_of_length: int, default 5000.
:param if_ignore_empty_query: boolean, default False.
:param update_session_after_freq: int, default 1000.
:param update_session_after_seconds: float, default 1500.
:param if_show_time_stat: boolean, default False.
:param show_time_stat_precision: int, default 4.
:param if_print_warning: bool, default True.
:return: str or dict
"""
timeout = kwargs.get("timeout", None)
proxies = kwargs.get("proxies", None)
sleep_seconds = kwargs.get("sleep_seconds", 0)
if_print_warning = kwargs.get("if_print_warning", True)
@ -149,7 +127,6 @@ class QQTranSmart(Tse):
host_html = self.session.get(
self.host_url,
headers=self.host_headers,
timeout=timeout,
proxies=proxies,
).text
@ -175,7 +152,6 @@ class QQTranSmart(Tse):
self.api_url,
json=split_form_data,
headers=self.api_headers,
timeout=timeout,
proxies=proxies,
).json()
text_list = self.split_sentence(split_data)
@ -197,7 +173,6 @@ class QQTranSmart(Tse):
self.api_url,
json=api_form_data,
headers=self.api_headers,
timeout=timeout,
proxies=proxies,
)
r.raise_for_status()

View File

@ -85,26 +85,6 @@ class Reverso(Tse):
to_language: str = "en",
**kwargs
):
"""
https://www.reverso.net/text-translation
:param query_text: str, must.
:param from_language: str, default 'zh', unsupported 'auto'.
:param to_language: str, default 'en'.
:param **kwargs:
:param timeout: float, default None.
:param proxies: dict, default None.
:param sleep_seconds: float, default `random.random()`.
:param is_detail_result: boolean, default False.
:param if_ignore_limit_of_length: boolean, default False.
:param limit_of_length: int, default 5000.
:param if_ignore_empty_query: boolean, default False.
:param update_session_after_seconds: float, default 1500.
:param if_show_time_stat: boolean, default False.
:param show_time_stat_precision: int, default 4.
:return: str or dict
"""
timeout = kwargs.get("timeout", None)
proxies = kwargs.get("proxies", None)
is_detail_result = kwargs.get("is_detail_result", False)
sleep_seconds = kwargs.get("sleep_seconds", random.random())
@ -125,7 +105,6 @@ class Reverso(Tse):
host_html = self.session.get(
self.host_url,
headers=self.host_headers,
timeout=timeout,
proxies=proxies,
).text
@ -145,7 +124,6 @@ class Reverso(Tse):
self.api_url,
json=form_data,
headers=self.api_headers,
timeout=timeout,
proxies=proxies,
)
r.raise_for_status()
@ -155,8 +133,6 @@ class Reverso(Tse):
return data if is_detail_result else "".join(data["translation"])
from traceback import print_exc
from translator.basetranslator import basetrans

View File

@ -85,26 +85,6 @@ class Reverso(Tse):
to_language: str = "en",
**kwargs
):
"""
https://www.reverso.net/text-translation
:param query_text: str, must.
:param from_language: str, default 'zh', unsupported 'auto'.
:param to_language: str, default 'en'.
:param **kwargs:
:param timeout: float, default None.
:param proxies: dict, default None.
:param sleep_seconds: float, default `random.random()`.
:param is_detail_result: boolean, default False.
:param if_ignore_limit_of_length: boolean, default False.
:param limit_of_length: int, default 5000.
:param if_ignore_empty_query: boolean, default False.
:param update_session_after_seconds: float, default 1500.
:param if_show_time_stat: boolean, default False.
:param show_time_stat_precision: int, default 4.
:return: str or dict
"""
timeout = kwargs.get("timeout", None)
proxies = kwargs.get("proxies", None)
is_detail_result = kwargs.get("is_detail_result", False)
sleep_seconds = kwargs.get("sleep_seconds", random.random())
@ -125,7 +105,6 @@ class Reverso(Tse):
host_html = self.session.get(
self.host_url,
headers=self.host_headers,
timeout=timeout,
proxies=proxies,
).text
@ -145,7 +124,6 @@ class Reverso(Tse):
self.api_url,
json=form_data,
headers=self.api_headers,
timeout=timeout,
proxies=proxies,
)
r.raise_for_status()
@ -155,8 +133,6 @@ class Reverso(Tse):
return data if is_detail_result else "".join(data["translation"])
from traceback import print_exc
from translator.basetranslator import basetrans

View File

@ -16,7 +16,6 @@ class TS(basetrans):
def __init__(self, typename):
super().__init__(typename)
self.context = []
self.session = requests.Session()
def get_client(self, api_url):
if api_url[-4:] == "/v1/":
@ -150,7 +149,7 @@ class TS(basetrans):
stream=False,
)
try:
output = self.session.post(
output = self.proxysession.post(
urlpathjoin(self.api_url, "chat/completions"), json=data
)
@ -184,14 +183,17 @@ class TS(basetrans):
stream=True,
)
try:
output = self.session.post(
output = self.proxysession.post(
urlpathjoin(self.api_url, "chat/completions"),
json=data,
stream=True,
)
except requests.RequestException:
raise ValueError(f"连接到Sakura API超时{self.api_url}")
if not output.headers["Content-Type"].startswith("text/event-stream"):
if (not output.headers["Content-Type"].startswith("text/event-stream")) and (
output.status_code != 200
):
raise Exception(output.maybejson)
for chunk in output.iter_lines():
response_data: str = chunk.decode("utf-8").strip()

View File

@ -61,7 +61,7 @@ class TS(basetrans):
data["Signature"] = sign_str(secret_key, s, hashlib.sha1)
# 此处会实际调用,成功后可能产生计费
r = self.proxysession.get("https://" + endpoint, params=data, timeout=3)
r = self.proxysession.get("https://" + endpoint, params=data)
# print(r.json())
return r

View File

@ -398,7 +398,6 @@ class gTTS:
tokenizer_cases.other_punctuation,
]
).run,
timeout=None,
):
self.ref = ref
# Debug
@ -440,7 +439,6 @@ class gTTS:
self.pre_processor_funcs = pre_processor_funcs
self.tokenizer_func = tokenizer_func
self.timeout = timeout
def _tokenize(self, text):
# Pre-clean

View File

@ -1161,7 +1161,7 @@
},
"update": {
"lunatranslator": {
"useproxy": false,
"useproxy": true,
"name": "lunatranslator.org"
},
"github": {
@ -1964,14 +1964,16 @@
"type": "offline",
"color": "blue",
"name": "Sakura大模型",
"is_gpt_like": true
"is_gpt_like": true,
"useproxy": false
},
"chatgpt-offline": {
"use": false,
"type": "offline",
"color": "blue",
"name": "ChatGPT_兼容接口",
"is_gpt_like": true
"is_gpt_like": true,
"useproxy": false
},
"realtime_edit": {
"use": false,
@ -2042,5 +2044,6 @@
"proxies": null,
"viewlistpos": 0,
"textoutput_origin": true,
"textoutput_trans": false
"textoutput_trans": false,
"wordlabel": []
}

View File

@ -19,7 +19,6 @@
"显示设置": "إعدادات العرض",
"允许缩放最大化或全屏的窗口": "يسمح تكبير أو ملء الشاشة نافذة",
"其他设置": "إعدادات أخرى",
"仅在无法编码的字后插入": "إدراج فقط بعد كلمة غير مشفرة",
"中东欧(CP1250)": "أوروبا الوسطى والشرقية ( CP1250 )",
"处理": "معالجة",
"有道2": "هناك طريق",
@ -231,7 +230,6 @@
"设置代码页": "مجموعة كود الصفحة",
"自定义python处理": "العرف بيثون تجهيز",
"图像稳定性阈值": "صورة عتبة الاستقرار",
"不插入空格": "لا إدراج الفضاء",
"替换为": "استبدال",
"过滤换行符": "تصفية سطر جديد",
"删除": "حذف .",
@ -301,7 +299,6 @@
"伊織弓鶴": "العراق النسيج القوس رافعة",
"移除": "إزالة",
"性能": "الأداء",
"每个字后插入空格": "إدراج مسافات بعد كل كلمة",
"双线性": "ثنائي",
"颜色": "الألوان",
"取消": "ألغى",
@ -361,7 +358,6 @@
"失败": "هزم",
"中东欧": "أوروبا الوسطى والشرقية",
"ついなちゃん(関西弁)": "じゃじゃ ( كانساي بنتن )",
"在重叠显示的字间插入空格": "إدراج مسافات بين تداخل الكلمات المعروضة",
"代名詞": "ضمير",
"形容詞": "صفة",
"起始地址(hex)": "عنوان البداية ( عرافة )",
@ -811,5 +807,7 @@
"百度智能云": "بايدو سحابة ذكية",
"支持gpt词典": "( دعم قاموس GPT )",
"日志": "سجل .",
"查看": "عرض ."
"查看": "عرض .",
"标记": "علامة",
"去除标记": "إزالة علامة"
}

View File

@ -264,10 +264,6 @@
"资源下载": "資源下載",
"工具按钮大小": "工具按鈕大小",
"保留原文": "保留原文",
"不插入空格": "不插入空格",
"每个字后插入空格": "每個字後插入空格",
"仅在无法编码的字后插入": "僅在無法編碼的字後插入",
"在重叠显示的字间插入空格": "在重疊顯示的字間插入空格",
"修改游戏字体": "修改遊戲字體",
"修改字体字符集": "修改字體字元集",
"自动": "自動",
@ -811,5 +807,7 @@
"百度智能云": "百度智慧雲",
"支持gpt词典": "(支援 GPT 詞典)",
"日志": "日誌",
"查看": "查看"
"查看": "查看",
"标记": "標記",
"去除标记": "去除標記"
}

View File

@ -183,7 +183,6 @@
"文本处理": "zpracování textu",
"工具按钮大小": "Velikost tlačítka nástroje",
"添加编码": "Přidat kód",
"仅在无法编码的字后插入": "Vložit pouze za slova, která nelze kódovat",
"刷新延迟(ms)": "Zpoždění obnovy (ms)",
"彩云": "irizující mrak",
"允许缩放最大化或全屏的窗口": "Povolit maximální přiblížení nebo okna na celé obrazovce",
@ -192,7 +191,6 @@
"捕获模式": "Režim zachycení",
"程序名": "Název programu",
"任务栏中显示": "Zobrazit na hlavním panelu",
"不插入空格": "Nevkládat mezery",
"通用文字识别(标准版)": "Univerzální rozpoznávání textu (Standard Edition)",
"过滤「」以外的字符": "Filtrovat jiné znaky než ''",
"过滤非shiftjis": "Filtrovat non shiftjis",
@ -212,7 +210,6 @@
"文本预处理": "Předzpracování textu",
"调整执行顺序": "Upravit pořadí provedení",
"资源下载": "Stahování zdrojů",
"每个字后插入空格": "Vložit mezeru za každé slovo",
"結月ゆかり/结月缘": "Jieyue Yuri/Jieyue Osud",
"窗口置顶": "Horní okno",
"颜色": "barva",
@ -272,7 +269,6 @@
"json文件": "Soubor JSON",
"剪贴板": "schránka",
"系统未安装": "Systém není nainstalován",
"在重叠显示的字间插入空格": "Vložit mezery mezi překrývajícími se zobrazenými slovy",
"显示/隐藏翻译窗口": "Zobrazit/skrýt okno překladu",
"感動詞": "Dojemná slova",
"西里尔": "Cyrile",
@ -811,5 +807,7 @@
"百度智能云": "Cloud AI Baidu",
"支持gpt词典": "(Podporuje GPT slovník)",
"日志": "deník",
"查看": "viz"
"查看": "viz",
"标记": "značka",
"去除标记": "Odstranit značení"
}

View File

@ -183,7 +183,6 @@
"文本处理": "Textverarbeitung",
"工具按钮大小": "Größe der Werkzeugtaste",
"添加编码": "Code hinzufügen",
"仅在无法编码的字后插入": "Nur nach Wörtern einfügen, die nicht kodiert werden können",
"刷新延迟(ms)": "Aktualisierungsverzögerung (ms)",
"彩云": "irisierende Wolke",
"允许缩放最大化或全屏的窗口": "Maximaler Zoom oder Vollbildfenster zulassen",
@ -192,7 +191,6 @@
"捕获模式": "Aufnahmemodus",
"程序名": "Programmname",
"任务栏中显示": "Anzeige in Taskleiste",
"不插入空格": "Keine Leerzeichen einfügen",
"通用文字识别(标准版)": "Universal Text Recognition (Standard Edition)",
"过滤「」以外的字符": "Andere Zeichen als ''filtern",
"过滤非shiftjis": "Nicht shiftjis filtern",
@ -212,7 +210,6 @@
"文本预处理": "Textvorverarbeitung",
"调整执行顺序": "Passen Sie die Ausführungsreihenfolge an",
"资源下载": "Ressourcen herunterladen",
"每个字后插入空格": "Leerzeichen nach jedem Wort einfügen",
"結月ゆかり/结月缘": "Jieyue Yuri/Jieyue Schicksal",
"窗口置顶": "Fenster oben",
"颜色": "Farbe",
@ -272,7 +269,6 @@
"json文件": "JSON-Datei",
"剪贴板": "Zwischenablage",
"系统未安装": "System nicht installiert",
"在重叠显示的字间插入空格": "Leerzeichen zwischen überlappenden angezeigten Wörtern einfügen",
"显示/隐藏翻译窗口": "Übersetzungsfenster ein-/ausblenden",
"感動詞": "Berührende Worte",
"西里尔": "Cyril",
@ -811,5 +807,7 @@
"百度智能云": "Baidu AI Cloud",
"支持gpt词典": "(Unterstützt GPT Wörterbuch)",
"日志": "Journal",
"查看": "siehe"
"查看": "siehe",
"标记": "Zeichen",
"去除标记": "Markierung entfernen"
}

View File

@ -264,10 +264,6 @@
"资源下载": "Resource Download",
"工具按钮大小": "Tool Button Size",
"保留原文": "Keep Original Text",
"不插入空格": "Don't Insert Spaces",
"每个字后插入空格": "Insert Space After Each Character",
"仅在无法编码的字后插入": "Insert Only After Unencodable Characters",
"在重叠显示的字间插入空格": "Insert Spaces Between Overlapping Characters",
"修改游戏字体": "Modify Game Font",
"修改字体字符集": "Modify Font Character Set",
"自动": "Automatic",
@ -811,5 +807,7 @@
"百度智能云": "Baidu AI Cloud",
"支持gpt词典": "(Supports GPT dictionary)",
"日志": "journal",
"查看": "see"
"查看": "see",
"标记": "sign",
"去除标记": "Remove marking"
}

View File

@ -264,10 +264,6 @@
"资源下载": "Descarga de recursos",
"工具按钮大小": "Tamaño del botón de la herramienta",
"保留原文": "Conservar el texto original",
"不插入空格": "Sin insertar espacios",
"每个字后插入空格": "Insertar espacios después de cada palabra",
"仅在无法编码的字后插入": "Insertar solo después de palabras que no se pueden codificar",
"在重叠显示的字间插入空格": "Insertar espacios entre palabras que se superponen",
"修改游戏字体": "Modificar la fuente del juego",
"修改字体字符集": "Modificar el juego de caracteres de la fuente",
"自动": "Automático",
@ -811,5 +807,7 @@
"百度智能云": "Baidu SMART Cloud",
"支持gpt词典": "(admite diccionarios gpt)",
"日志": "Diario",
"查看": "Ver"
"查看": "Ver",
"标记": "Marcado",
"去除标记": "Eliminar la marca"
}

View File

@ -264,10 +264,6 @@
"资源下载": "Ressources télécharger",
"工具按钮大小": "Outils taille du bouton",
"保留原文": "Conserver le texte original",
"不插入空格": "Pas d'espace inséré",
"每个字后插入空格": "Insérer un espace après chaque mot",
"仅在无法编码的字后插入": "Insérer seulement après un mot qui ne peut pas être codé",
"在重叠显示的字间插入空格": "Insérer un espace entre les mots qui se chevauchent affichage",
"修改游戏字体": "Modifier la police du jeu",
"修改字体字符集": "Modifier le jeu de caractères de police",
"自动": "Automatique",
@ -811,5 +807,7 @@
"百度智能云": "Baidu intelligent Cloud",
"支持gpt词典": "(support du dictionnaire GPT)",
"日志": "Logs",
"查看": "Voir"
"查看": "Voir",
"标记": "Marquage",
"去除标记": "Enlever les marques"
}

View File

@ -258,10 +258,6 @@
"资源下载": "Scarica risorse",
"工具按钮大小": "Dimensione pulsante strumento",
"保留原文": "Mantieni il testo originale",
"不插入空格": "Non inserire spazi",
"每个字后插入空格": "Inserire uno spazio dopo ogni parola",
"仅在无法编码的字后插入": "Inserisci solo dopo parole che non possono essere codificate",
"在重叠显示的字间插入空格": "Inserisci spazi tra parole sovrapposte",
"修改游戏字体": "Modifica carattere del gioco",
"修改字体字符集": "Modifica set di caratteri caratteri",
"自动": "automatico",
@ -811,5 +807,7 @@
"百度智能云": "Baidu AI Cloud",
"支持gpt词典": "(Supporta il dizionario GPT)",
"日志": "diario",
"查看": "vedi"
"查看": "vedi",
"标记": "segno",
"去除标记": "Rimuovi la marcatura"
}

View File

@ -264,10 +264,6 @@
"资源下载": "リソースのダウンロード",
"工具按钮大小": "ツールボタンのサイズ",
"保留原文": "原文を保持する",
"不插入空格": "スペースを挿入しない",
"每个字后插入空格": "各単語の後にスペースを挿入",
"仅在无法编码的字后插入": "エンコードできないワードの後にのみ挿入",
"在重叠显示的字间插入空格": "重複して表示されたワード間にスペースを挿入する",
"修改游戏字体": "ゲームフォントの変更",
"修改字体字符集": "フォント文字セットの変更",
"自动": "自動",
@ -811,5 +807,7 @@
"百度智能云": "百度知能クラウド",
"支持gpt词典": "gpt辞書対応",
"日志": "ログ#ログ#",
"查看": "表示#ヒョウジ#"
"查看": "表示#ヒョウジ#",
"标记": "マークアップ",
"去除标记": "タグを削除"
}

View File

@ -264,10 +264,6 @@
"资源下载": "리소스 다운로드",
"工具按钮大小": "도구 버튼 크기",
"保留原文": "원문을 보존하다",
"不插入空格": "공백 삽입 안 함",
"每个字后插入空格": "각 단어 뒤에 공백 삽입",
"仅在无法编码的字后插入": "인코딩할 수 없는 단어만 삽입",
"在重叠显示的字间插入空格": "겹쳐진 단어 사이에 공백 삽입하기",
"修改游戏字体": "게임 글꼴 수정",
"修改字体字符集": "글꼴 문자 세트 수정",
"自动": "자동",
@ -811,5 +807,7 @@
"百度智能云": "바이두 스마트 클라우드",
"支持gpt词典": "(gpt 사전 지원)",
"日志": "로그",
"查看": "보기"
"查看": "보기",
"标记": "태그",
"去除标记": "태그 제거"
}

View File

@ -183,7 +183,6 @@
"文本处理": "tekstverwerking",
"工具按钮大小": "Gereedschapsknopgrootte",
"添加编码": "Code toevoegen",
"仅在无法编码的字后插入": "Alleen invoegen na woorden die niet kunnen worden gecodeerd",
"刷新延迟(ms)": "Verslag vernieuwen (ms)",
"彩云": "iriserende wolk",
"允许缩放最大化或全屏的窗口": "Maximaal zoomen of volledig scherm vensters toestaan",
@ -192,7 +191,6 @@
"捕获模式": "Opnamemodus",
"程序名": "Programmanaam",
"任务栏中显示": "Weergeven in taakbalk",
"不插入空格": "Geen spaties invoegen",
"通用文字识别(标准版)": "Universele tekstherkenning (Standard Edition)",
"过滤「」以外的字符": "Andere tekens dan ''filteren",
"过滤非shiftjis": "Niet shiftjis filteren",
@ -212,7 +210,6 @@
"文本预处理": "Tekstvoorbewerking",
"调整执行顺序": "Pas de uitvoeringsvolgorde aan",
"资源下载": "Bron downloaden",
"每个字后插入空格": "Een spatie invoegen na elk woord",
"結月ゆかり/结月缘": "Jieyue Yuri/Jieyue Fate",
"窗口置顶": "Vensterbovenkant",
"颜色": "kleur",
@ -272,7 +269,6 @@
"json文件": "JSON-bestand",
"剪贴板": "klembord",
"系统未安装": "Systeem niet geïnstalleerd",
"在重叠显示的字间插入空格": "Spaties invoegen tussen overlappende weergegeven woorden",
"显示/隐藏翻译窗口": "Vertalingsvenster tonen/verbergen",
"感動詞": "Aantrekkelijke woorden",
"西里尔": "Cyril",
@ -811,5 +807,7 @@
"百度智能云": "Baidu AI Cloud",
"支持gpt词典": "(Ondersteunt GPT woordenboek)",
"日志": "dagboek",
"查看": "zie"
"查看": "zie",
"标记": "teken",
"去除标记": "Markering verwijderen"
}

View File

@ -264,10 +264,6 @@
"资源下载": "Pobieranie zasobów",
"工具按钮大小": "Rozmiar przycisku narzędzia",
"保留原文": "Zachowaj oryginalny tekst",
"不插入空格": "Nie wstawiaj spacji",
"每个字后插入空格": "Wstaw spację po każdym słowie",
"仅在无法编码的字后插入": "Wstaw tylko po słowach, których nie można zakodować",
"在重叠显示的字间插入空格": "Wstawianie spacji między nakładającymi się słowami",
"修改游戏字体": "Zmień czcionkę gry",
"修改字体字符集": "Zmień zestaw znaków czcionki",
"自动": "automatyczny",
@ -811,5 +807,7 @@
"百度智能云": "Chmura AI Baidu",
"支持gpt词典": "(Obsługuje słownik GPT)",
"日志": "dziennik",
"查看": "zobacz"
"查看": "zobacz",
"标记": "znak",
"去除标记": "Usuń oznaczenie"
}

View File

@ -183,7 +183,6 @@
"文本处理": "processamento de texto",
"工具按钮大小": "Tamanho do botão da ferramenta",
"添加编码": "Adicionar código",
"仅在无法编码的字后插入": "Inserir somente após palavras que não podem ser codificadas",
"刷新延迟(ms)": "Atraso da actualização (ms)",
"彩云": "nuvem iridescente",
"允许缩放最大化或全屏的窗口": "Permitir o zoom máximo ou janelas de ecrã inteiro",
@ -192,7 +191,6 @@
"捕获模式": "Modo de captura",
"程序名": "Nome do Programa",
"任务栏中显示": "Mostrar na barra de tarefas",
"不插入空格": "Não inserir espaços",
"通用文字识别(标准版)": "Reconhecimento Universal de Texto (Edição Normal)",
"过滤「」以外的字符": "Filtrar caracteres diferentes de ''",
"过滤非shiftjis": "Filtrar não shiftjis",
@ -212,7 +210,6 @@
"文本预处理": "Pré-processamento de texto",
"调整执行顺序": "Ajustar a ordem de execução",
"资源下载": "Transferência do Recurso",
"每个字后插入空格": "Inserir um espaço após cada palavra",
"結月ゆかり/结月缘": "Jieyue Yuri/Jieyue Destino",
"窗口置顶": "Parte superior da janela",
"颜色": "cor",
@ -272,7 +269,6 @@
"json文件": "Ficheiro JSON",
"剪贴板": "área de transferência",
"系统未安装": "Sistema não instalado",
"在重叠显示的字间插入空格": "Inserir espaços entre as palavras exibidas sobrepostas",
"显示/隐藏翻译窗口": "Mostrar/ Esconder a Janela de Tradução",
"感動詞": "Palavras comoventes",
"西里尔": "Cyril",
@ -811,5 +807,7 @@
"百度智能云": "Nuvem AI Baidu",
"支持gpt词典": "(Suporta dicionário GPT)",
"日志": "diário",
"查看": "ver"
"查看": "ver",
"标记": "signo",
"去除标记": "Remover a marcação"
}

View File

@ -264,10 +264,6 @@
"资源下载": "Скачать ресурс",
"工具按钮大小": "Размер кнопки",
"保留原文": "Сохранение первоначального текста",
"不插入空格": "Не вставлять пробелы",
"每个字后插入空格": "Вставить пробел после каждого слова",
"仅在无法编码的字后插入": "Вставить только после слов, которые не могут быть закодированы",
"在重叠显示的字间插入空格": "Вставить пробелы между словами",
"修改游戏字体": "Изменить шрифт игры",
"修改字体字符集": "Изменить набор шрифтов",
"自动": "Автоматический",
@ -811,5 +807,7 @@
"百度智能云": "Сто умных облаков",
"支持gpt词典": "(Поддержка словаря GPT)",
"日志": "Журнал",
"查看": "Посмотреть"
"查看": "Посмотреть",
"标记": "Маркировка",
"去除标记": "Удалить метку"
}

View File

@ -183,7 +183,6 @@
"文本处理": "Textbehandling",
"工具按钮大小": "Verktygsknappstorlek",
"添加编码": "Lägg till kod",
"仅在无法编码的字后插入": "Infoga endast efter ord som inte kan kodas",
"刷新延迟(ms)": "Uppdateringsfördröjning (ms)",
"彩云": "bländande moln",
"允许缩放最大化或全屏的窗口": "Tillåt maximal zoom eller helskärmsfönster",
@ -192,7 +191,6 @@
"捕获模式": "Inspelningsläge",
"程序名": "Programnamn",
"任务栏中显示": "Visa i aktivitetsfältet",
"不插入空格": "Infoga inte mellanslag",
"通用文字识别(标准版)": "Universell textigenkänning (standardutgåva)",
"过滤「」以外的字符": "Filtrera andra tecken än ''",
"过滤非shiftjis": "Filtrera ej skiftjis",
@ -212,7 +210,6 @@
"文本预处理": "Förbehandling av text",
"调整执行顺序": "Justera exekutionsordern",
"资源下载": "Resursnedladdning",
"每个字后插入空格": "Infoga ett mellanslag efter varje ord",
"結月ゆかり/结月缘": "Jieyue Yuri/Jieyue Fate",
"窗口置顶": "Fönstertopp",
"颜色": "färg",
@ -272,7 +269,6 @@
"json文件": "JSON- fil",
"剪贴板": "Urklipp",
"系统未安装": "System ej installerat",
"在重叠显示的字间插入空格": "Infoga blanksteg mellan överlappande visade ord",
"显示/隐藏翻译窗口": "Visa/dölj översättningsfönster",
"感動詞": "Rörande ord",
"西里尔": "Cyril",
@ -811,5 +807,7 @@
"百度智能云": "Baidu AI- molnName",
"支持gpt词典": "(Stöder GPT-ordlista)",
"日志": "journal",
"查看": "se"
"查看": "se",
"标记": "tecken",
"去除标记": "Ta bort märkning"
}

View File

@ -181,7 +181,6 @@
"文本处理": "การประมวลผลข้อความ",
"工具按钮大小": "ขนาดปุ่มเครื่องมือ",
"添加编码": "เพิ่มการเข้ารหัส",
"仅在无法编码的字后插入": "แทรกเฉพาะหลังจากคำที่ไม่สามารถเข้ารหัสได้",
"刷新延迟(ms)": "รีเฟรชความล่าช้า (ms)",
"彩云": "เมฆสี",
"允许缩放最大化或全屏的窗口": "หน้าต่างที่อนุญาตให้ปรับขนาดได้สูงสุดหรือเต็มหน้าจอ",
@ -190,7 +189,6 @@
"捕获模式": "โหมดจับภาพ",
"程序名": "ชื่อโปรแกรม",
"任务栏中显示": "แสดงในแถบงาน",
"不插入空格": "ไม่มีการแทรกช่องว่าง",
"通用文字识别(标准版)": "การจดจำคำทั่วไป (เวอร์ชันมาตรฐาน)",
"过滤「」以外的字符": "กรองตัวอักษรอื่นที่ไม่ใช่「」",
"过滤非shiftjis": "กรองที่ไม่ใช่ shiftjis",
@ -209,7 +207,6 @@
"文本预处理": "การปรับสภาพข้อความ",
"调整执行顺序": "ปรับลำดับการดำเนินการ",
"资源下载": "ดาวน์โหลดทรัพยากร",
"每个字后插入空格": "แทรกช่องว่างหลังจากแต่ละคำ",
"結月ゆかり/结月缘": "เนะจันทร์ คะริ / เนะจันทร์",
"窗口置顶": "หน้าต่างอยู่ด้านบน",
"默认搜索": "ค้นหาปริยาย",
@ -271,7 +268,6 @@
"json文件": "ไฟล์ json",
"剪贴板": "คลิปบอร์ด",
"系统未安装": "ระบบยังไม่ได้ติดตั้ง",
"在重叠显示的字间插入空格": "แทรกช่องว่างระหว่างคำที่แสดงทับซ้อนกัน",
"显示/隐藏翻译窗口": "แสดง/ซ่อนหน้าต่างการแปล",
"感動詞": "สัมผัสคำ",
"西里尔": "ไซริล",
@ -811,5 +807,7 @@
"百度智能云": "Baidu สมาร์ทคลาวด์",
"支持gpt词典": "(รองรับพจนานุกรม gpt)",
"日志": "บันทึกประจำวัน",
"查看": "ดู"
"查看": "ดู",
"标记": "เครื่องหมาย",
"去除标记": "ลบเครื่องหมาย"
}

View File

@ -264,10 +264,6 @@
"资源下载": "Kaynak indirmesi",
"工具按钮大小": "Araç düğmesi ölçüsi",
"保留原文": "Orijinal tut",
"不插入空格": "Boşlukları girme",
"每个字后插入空格": "Her kelimeden sonra uzay ekle",
"仅在无法编码的字后插入": "Sadece kodlamaz kelimelerden sonra ekle",
"在重叠显示的字间插入空格": "Kıpırdaman kelimeler arasındaki yer ekle",
"修改游戏字体": "Oyun yazıtipini değiştir",
"修改字体字符集": "Yazıtipi karakter setini değiştir",
"自动": "otomatik",
@ -811,5 +807,7 @@
"百度智能云": "Baidu AI Bulud",
"支持gpt词典": "(GPT sözlük destekliyor)",
"日志": "Günlük",
"查看": "Gördün mü?"
"查看": "Gördün mü?",
"标记": "imza",
"去除标记": "İşaret Çıkar"
}

View File

@ -258,10 +258,6 @@
"资源下载": "Звантаження ресурсів",
"工具按钮大小": "Розмір кнопок інструментів",
"保留原文": "Зберегти початковий текст",
"不插入空格": "Не вставляти пробіли",
"每个字后插入空格": "Вставити простір після кожного слова",
"仅在无法编码的字后插入": "Вставити лише після слов, які не можна кодувати",
"在重叠显示的字间插入空格": "Insert spaces between overlapping words",
"修改游戏字体": "Змінити шрифт гри",
"修改字体字符集": "Змінити набір символів шрифту",
"自动": "автоматичний",
@ -811,5 +807,7 @@
"百度智能云": "Хмари Baidu AIweather condition",
"支持gpt词典": "(Підтримує словник GPT)",
"日志": "журнал",
"查看": "див."
"查看": "див.",
"标记": "знак",
"去除标记": "Вилучити позначення"
}

View File

@ -264,10 +264,6 @@
"资源下载": "Tải xuống tài nguyên",
"工具按钮大小": "Kích thước nút công cụ",
"保留原文": "Giữ nguyên bản gốc",
"不插入空格": "Không chèn khoảng trắng",
"每个字后插入空格": "Chèn khoảng trắng sau mỗi từ",
"仅在无法编码的字后插入": "Chèn chỉ sau những từ không thể mã hóa",
"在重叠显示的字间插入空格": "Chèn khoảng trắng giữa các từ được hiển thị chồng chéo",
"修改游戏字体": "Thay đổi phông chữ trò chơi",
"修改字体字符集": "Sửa đổi bộ ký tự phông chữ",
"自动": "Tự động",
@ -811,5 +807,7 @@
"百度智能云": "100 đám mây thông minh",
"支持gpt词典": "(Hỗ trợ GPT Dictionary)",
"日志": "Đăng nhập",
"查看": "Xem thêm"
"查看": "Xem thêm",
"标记": "Đánh dấu",
"去除标记": "Xóa đánh dấu"
}

View File

@ -183,7 +183,6 @@
"文本处理": "",
"工具按钮大小": "",
"添加编码": "",
"仅在无法编码的字后插入": "",
"刷新延迟(ms)": "",
"彩云": "",
"允许缩放最大化或全屏的窗口": "",
@ -192,7 +191,6 @@
"捕获模式": "",
"程序名": "",
"任务栏中显示": "",
"不插入空格": "",
"通用文字识别(标准版)": "",
"过滤「」以外的字符": "",
"过滤非shiftjis": "",
@ -212,7 +210,6 @@
"文本预处理": "",
"调整执行顺序": "",
"资源下载": "",
"每个字后插入空格": "",
"結月ゆかり/结月缘": "",
"窗口置顶": "",
"颜色": "",
@ -273,7 +270,6 @@
"json文件": "",
"剪贴板": "",
"系统未安装": "",
"在重叠显示的字间插入空格": "",
"显示/隐藏翻译窗口": "",
"感動詞": "",
"西里尔": "",
@ -811,5 +807,7 @@
"百度智能云": "",
"支持gpt词典": "",
"日志": "",
"查看": ""
"查看": "",
"标记": "",
"去除标记": ""
}

View File

@ -28,7 +28,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/version)
include(generate_product_version)
set(VERSION_MAJOR 5)
set(VERSION_MINOR 46)
set(VERSION_MINOR 47)
set(VERSION_PATCH 0)
add_library(pch pch.cpp)

View File

@ -89,7 +89,7 @@ std::map<std::string, std::string> translation;
std::unordered_set<DWORD> connectedpids;
void (*Luna_Start)(ProcessEvent Connect, ProcessEvent Disconnect, void *, void *, void *, void *, HookInsertHandler hookinsert, EmbedCallback embed, void *);
void (*Luna_Inject)(DWORD pid, LPCWSTR basepath);
void (*Luna_EmbedSettings)(DWORD pid, UINT32 waittime, UINT8 fontCharSet, bool fontCharSetEnabled, wchar_t *fontFamily, UINT32 spaceadjustpolicy, UINT32 keeprawtext, bool fastskipignore);
void (*Luna_EmbedSettings)(DWORD pid, UINT32 waittime, UINT8 fontCharSet, bool fontCharSetEnabled, wchar_t *fontFamily, UINT32 keeprawtext, bool fastskipignore);
void (*Luna_useembed)(DWORD pid, uint64_t address, uint64_t ctx1, uint64_t ctx2, bool use);
bool (*Luna_checkisusingembed)(DWORD pid, uint64_t address, uint64_t ctx1, uint64_t ctx2);
void (*Luna_embedcallback)(DWORD pid, LPCWSTR text, LPCWSTR trans);
@ -117,7 +117,7 @@ public:
Luna_Start(
[](DWORD pid)
{
Luna_EmbedSettings(pid, 1000 * config["embedsettings"]["timeout_translate"], 2, false, config["embedsettings"]["changefont"] ? (StringToWideString(config["embedsettings"]["changefont_font"]).data()) : L"", config["embedsettings"]["insertspace_policy"], config["embedsettings"]["keeprawtext"], false);
Luna_EmbedSettings(pid, 1000 * config["embedsettings"]["timeout_translate"], 2, false, config["embedsettings"]["changefont"] ? (StringToWideString(config["embedsettings"]["changefont_font"]).data()) : L"", config["embedsettings"]["keeprawtext"], false);
connectedpids.insert(pid);
},
[](DWORD pid)