feat(translate): Add automatic message translation to player language#335
Open
SolverNA wants to merge 2 commits intoFlectone:masterfrom
Open
feat(translate): Add automatic message translation to player language#335SolverNA wants to merge 2 commits intoFlectone:masterfrom
SolverNA wants to merge 2 commits intoFlectone:masterfrom
Conversation
- Created TranslatedMessage model to store all message translations - Extended HistoryMessage to support original/translation toggle - Added /toggleoriginal command to switch between original and translation - Implemented automatic translation to all unique server locales (API request optimization) - Updated localizations: button now toggles original/translation instead of creating new message - Added PulseAutoTranslateListener to handle auto-translation in MessagePrepareEvent - Modified DeleteModule to work with translations and toggling Now each message is automatically translated to the receiver's language. Button on message allows switching between original and translation.
Member
|
Разве такой автоматический перевод не добавляет задержку в чат у сообщений? |
Author
|
Да сег сделаю асинхронный перевод |
- Created TranslationCacheService with MyMemory API integration - Added TRANSLATION_CACHE (24h, 50000 entries) for persistent translation storage - Integrated MyMemory API as fallback before main translation service - Converted translateToAllLocales to async with CompletableFuture for parallel translations - Added useMyMemory config option (default: true) - Added MYMEMORY service type to translation services - Updated configs for minecraft and hytale platforms Benefits: - No chat delay: original message sent immediately, translations load in background - MyMemory provides free cached translations (10k requests/day) - Parallel translation requests instead of sequential - Local cache reduces API calls for repeated phrases
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR implements automatic message translation based on player's client language settings. Messages are now automatically translated to each player's locale, with an option to toggle between original and
translation.
Changes
/toggleoriginalto switch between original and translated messageHow it works
Configuration
Requires
language.by-player: truein config.yml and translation API setup (Google/Yandex/DeepL).Testing
Tested with multiple players using different client languages. Translation and toggle functionality working as expected.
Note
Paper/Bukkit module has pre-existing compilation errors (missing Paper-specific classes). Core module compiles successfully. Fabric, BungeeCord, and Velocity versions work perfectly.