-
Notifications
You must be signed in to change notification settings - Fork 9
feat(translate): Add automatic message translation to player language #335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SolverNA
wants to merge
51
commits into
Flectone:master
Choose a base branch
from
SolverNA:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
ccccadc
feat(translate): add automatic message translation to player language
SolverNA 01ae38d
feat(translate): add MyMemory API cache and async translation
SolverNA c054317
fix(translate): fix 5 bugs in auto-translation system
SolverNA 37592a1
refactor(translate): remove dead uuid field and hide button for singl…
SolverNA 50b1e17
fix(translate): Fix replacing formatted messages with plain text
SolverNA acf460d
feat(translate): Added detailed logging for the autotranslation pipel…
SolverNA fedfc9c
refactor: extract ChatHistoryService from DeleteModule
SolverNA c8d8a14
revert: restore author's modules to pre-translate state
SolverNA d33156f
feat(translate): self-contained auto-translate with own chat history
SolverNA 49bafeb
fix(translate): restore TRANSLATION_CACHE setting in default config.yml
SolverNA 2648a90
fix(translate): decode MyMemory response with Gson — fixes Cyrillic s…
SolverNA b1fa77f
fix(translate): preserve formatting on translation replay + decode Cy…
SolverNA 12e7af9
feat(translate): Google Translate as default provider, MyMemory opt-i…
SolverNA 755a23c
feat(translate): full chat capture in history + detailed toggle logging
SolverNA 0c20ebf
feat(translate): provider chain with fallback + dedupe duplicate disp…
SolverNA 583454e
feat(translate): cache fallback in replay + toggle-triggered chain re…
SolverNA e32aa2b
refactor(translate): global shared chat history with viewer sets
SolverNA cfcf6a9
fix(translate): per-locale Component variants + iam_token YAML field
SolverNA ccd9b04
revert: roll back Yandex IAM token support
SolverNA ae36876
chore(translate): gate verbose translate logs behind flectonepulse.debug
SolverNA ce38ca2
feat(translate): auto/manual mode flag — keep author's classic path a…
SolverNA 7acefc2
fix(translate): sync cache lookup at MessageSendEvent removes cache-h…
SolverNA 3560034
fix(translate): skip replay on cache hit, fixes 'ghost' duplicate lines
SolverNA 0275a13
fix(translate): apply cached translation to dedup-skipped messages too
SolverNA 003323c
chore(translate): verbose [History.*] logs for save/sendUpdate/addTag…
SolverNA f21b6ba
fix(translate): skip empty-component receive events from history
SolverNA 9be1192
fix(translate): cache the SENT component for dedup, not the original
SolverNA 819b969
fix(translate): save every chat SendEvent to history — including dedu…
SolverNA db0a6f5
fix(translate): merge translatedMessage on save() UPDATE path
SolverNA d3ccba2
feat(translate): очистка истории чата при выходе игрока (clearHistory…
SolverNA 9ec0c9d
Merge upstream/master: адаптация translate-системы под новые API (Soc…
SolverNA 0fc307a
refactor(translate): убрать debug-логирование (сохранён апстримный DE…
SolverNA 991617f
refactor(translate): уменьшить TTL кэша переводов с 24ч до 1ч
SolverNA 0296ce9
refactor(translate): вынести URL переводчиков в константы
SolverNA c440d50
refactor(translate): парсить ответы переводчиков через gson вместо ру…
SolverNA 2376200
feat(translate): сохранять регион языка (zh-CN/zh-TW/pt-BR/pt-PT) при…
SolverNA e7dd313
refactor(translate): использовать единый WebUtil.USER_AGENT вместо ха…
SolverNA 4932bed
refactor(translate): убрать избыточный javadoc и комментарии
SolverNA fe18dac
refactor(translate): убрать инлайн FQN java.util в пользу импортов
SolverNA d49bc4e
feat(bubble): добавить в модель Bubble полный текст сообщения, локаль…
SolverNA 29b6798
feat(bubble): добавить переключатель bubble.translate в конфиг (по ум…
SolverNA e766272
feat(bubble): прогрев кэша перевода по локалям зрителей и переиспольз…
SolverNA c71589c
feat(bubble): сделать текст сущности пузырька изменяемым для in-place…
SolverNA ec82792
feat(bubble): пер-зрительский авто-перевод пузырьков с re-split перев…
SolverNA 2705cb6
fix(bubble): исправить перевёрнутый порядок чанков в стеке пузырька над
SolverNA e3f1643
feat(translate): добавить пер-получательский async-перевод для приват…
SolverNA 390ccee
fix(translate): подключить копию получателя ЛС к автопереводу на холо…
SolverNA 7bdeb7f
feat(translate): единый тумблер auto (чат+ЛС) и отдельный translate.b…
SolverNA a82f450
feat(translate): кросс-узловая замена текста сообщения с advance на н…
SolverNA 5622f4f
feat(translate): пер-получательский авто-перевод ЛС через историю и п…
SolverNA 79eeab3
feat(translate): добавить кнопку «показать оригинал» для копии получа…
SolverNA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
.../src/main/java/net/flectone/pulse/module/command/toggleoriginal/ToggleOriginalModule.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| package net.flectone.pulse.module.command.toggleoriginal; | ||
|
|
||
| import com.google.inject.Inject; | ||
| import com.google.inject.Singleton; | ||
| import lombok.RequiredArgsConstructor; | ||
| import net.flectone.pulse.config.Command; | ||
| import net.flectone.pulse.config.Localization; | ||
| import net.flectone.pulse.config.Permission; | ||
| import net.flectone.pulse.model.entity.FPlayer; | ||
| import net.flectone.pulse.module.ModuleCommand; | ||
| import net.flectone.pulse.module.message.format.translate.TranslateModule; | ||
| import net.flectone.pulse.platform.controller.ModuleController; | ||
| import net.flectone.pulse.platform.provider.CommandParserProvider; | ||
| import net.flectone.pulse.platform.registry.CommandRegistry; | ||
| import net.flectone.pulse.service.SocialService; | ||
| import net.flectone.pulse.util.constant.ModuleName; | ||
| import net.flectone.pulse.util.constant.SettingText; | ||
| import net.flectone.pulse.util.file.FileFacade; | ||
| import org.incendo.cloud.context.CommandContext; | ||
|
|
||
| import java.util.UUID; | ||
|
|
||
| // /toggleoriginal <message-uuid> — flips a chat message between translated and original. | ||
| // Reuses the Deletemessage command config (cooldown/aliases/permission) since there's no | ||
| // dedicated config record for this command. | ||
| @Singleton | ||
| @RequiredArgsConstructor(onConstructor = @__(@Inject)) | ||
| public class ToggleOriginalModule implements ModuleCommand<Localization.Command.Deletemessage> { | ||
|
|
||
| private final FileFacade fileFacade; | ||
| private final CommandParserProvider commandParserProvider; | ||
| private final TranslateModule translateModule; | ||
| private final ModuleController moduleController; | ||
| private final CommandRegistry commandRegistry; | ||
| private final SocialService socialService; | ||
|
|
||
| @Override | ||
| public void onEnable() { | ||
| commandRegistry.registerCommand(manager -> manager | ||
| .commandBuilder("toggleoriginal") | ||
| .required("message", commandParserProvider.singleMessageParser()) | ||
| .handler(this) | ||
| ); | ||
| } | ||
|
|
||
| @Override | ||
| public void onDisable() { | ||
| } | ||
|
|
||
| @Override | ||
| public void execute(FPlayer fPlayer, CommandContext<FPlayer> commandContext) { | ||
| if (moduleController.isDisabledFor(this, fPlayer)) return; | ||
|
|
||
| String messageUuidString = commandContext.get("message"); | ||
|
|
||
| try { | ||
| UUID messageUuid = UUID.fromString(messageUuidString); | ||
| translateModule.toggleOriginal(fPlayer, messageUuid); | ||
| } catch (IllegalArgumentException _) { | ||
| // Invalid UUID, ignore | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public ModuleName name() { | ||
| return ModuleName.COMMAND_TOGGLEORIGINAL; | ||
| } | ||
|
|
||
| @Override | ||
| public Command.Deletemessage config() { | ||
| return fileFacade.command().deletemessage(); | ||
| } | ||
|
|
||
| @Override | ||
| public Permission.Command.Deletemessage permission() { | ||
| return fileFacade.permission().command().deletemessage(); | ||
| } | ||
|
|
||
| @Override | ||
| public Localization.Command.Deletemessage localization(FPlayer fPlayer) { | ||
| return fileFacade.localization(socialService.getSetting(fPlayer, SettingText.LOCALE)).command().deletemessage(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.