Skip to content

feat: LibreTranslate Integration #6263

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

Closed
wants to merge 5 commits into from

Conversation

MukjepScarlet
Copy link
Contributor

@MukjepScarlet MukjepScarlet commented Jun 10, 2025

closes #6262

  • API + tests
  • command: manual translation text
  • command: send translated chat and IRC message
  • auto translate chat and IRC messages
  • auto translate subtitles
  • manual click to translate chat line

If you have any other idea about this feature, I can add it here.

Note: file translation might be not implemented.

Comment on lines +56 to +63
suspend fun translate(
text: String,
sourceLanguage: String,
targetLanguage: String,
format: String = "text",
alternatives: Int = 0,
apiKey: String? = null,
): TranslationResponse = post(

Check warning

Code scanning / detekt

The more parameters a function has the more complex it is. Long parameter lists are often used to control complex algorithms and violate the Single Responsibility Principle. Prefer functions with short parameter lists. Warning library

The function translate(text: String, sourceLanguage: String, targetLanguage: String, format: String, alternatives: Int, apiKey: String?) has too many parameters. The current threshold is set to 6.
val language = languages.find { it.code == lang }
if (language == null) {
targetLanguage = ""
notification("Invalid Language", "Language '$lang' is invalid.", NotificationEvent.Severity.ERROR)

Check warning

Code scanning / detekt

Line detected, which is longer than the defined maximum line length in the code style. Warning

Line detected, which is longer than the defined maximum line length in the code style.
aliases = arrayOf("Translate", "Translator")
) {

private val apiBaseUrl by text("ApiBaseUrl", default = LIBRE_TRANSLATE_BASE_URL)

Check warning

Code scanning / detekt

Property is unused and should be removed. Warning

Private property apiBaseUrl is unused.
@MukjepScarlet
Copy link
Contributor Author

I will close this because we need to deploy the docker image if we want to use it without API key (although it's very easy)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Auto Translate module
1 participant