diff --git a/app/src/main/java/com/bnyro/translate/api/or/OneRing.kt b/app/src/main/java/com/bnyro/translate/api/or/OneRing.kt
new file mode 100644
index 000000000..36cda21f0
--- /dev/null
+++ b/app/src/main/java/com/bnyro/translate/api/or/OneRing.kt
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2024 You Apps
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.bnyro.translate.api.or
+
+import com.bnyro.translate.api.or.obj.OneRingResponse
+import retrofit2.http.GET
+import retrofit2.http.Query
+
+interface OneRing {
+ @GET("translate")
+ suspend fun translate(
+ @Query("text") text: String,
+ @Query("from_lang") from: String,
+ @Query("to") to: String,
+ @Query("translator_plugin") plugin: String,
+ @Query("api_key") apiKey: String?
+ ): OneRingResponse
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/bnyro/translate/api/or/OneRingEngine.kt b/app/src/main/java/com/bnyro/translate/api/or/OneRingEngine.kt
new file mode 100644
index 000000000..7a004d52c
--- /dev/null
+++ b/app/src/main/java/com/bnyro/translate/api/or/OneRingEngine.kt
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2024 You Apps
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.bnyro.translate.api.or
+
+import com.bnyro.translate.const.ApiKeyState
+import com.bnyro.translate.db.obj.Language
+import com.bnyro.translate.obj.Translation
+import com.bnyro.translate.util.RetrofitHelper
+import com.bnyro.translate.util.TranslationEngine
+import java.util.*
+
+class OneRingEngine: TranslationEngine(
+ name = "OneRing",
+ apiKeyState = ApiKeyState.OPTIONAL,
+ urlModifiable = true,
+ defaultUrl = "https://your.instance.domain",
+ autoLanguageCode = "",
+ supportedEngines = listOf(
+ "no_translate2",
+ "no_translate",
+ "fb_nllb_ctranslate2",
+ "bloomz",
+ "vsegpt_chat",
+ "fb_nllb_translate",
+ "opus_mt",
+ "google_translate",
+ "deepl",
+ "deepl_translate",
+ "use_mid_lang",
+ "fb_mbart50",
+ "openai_chat",
+ "libre_translate",
+ "koboldapi_translate",
+ "lingvanex",
+ "multi_sources"
+ )
+) {
+ private lateinit var api: OneRing
+
+ override fun createOrRecreate(): TranslationEngine = apply {
+ api = RetrofitHelper.createApi(this)
+ }
+
+ override suspend fun getLanguages(): List {
+ return Locale.getAvailableLocales().map {
+ Language(it.isO3Language, it.getDisplayName(Locale.getDefault()))
+ }
+ .distinctBy { it.code }
+ .sortedBy { it.name }
+ }
+
+ override suspend fun translate(query: String, source: String, target: String): Translation {
+ val response = api.translate(
+ text = query,
+ from = source,
+ to = target,
+ apiKey = getApiKey(),
+ plugin = getSelectedEngine()
+ )
+
+ return Translation(response.result)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/bnyro/translate/api/or/obj/OneRingResponse.kt b/app/src/main/java/com/bnyro/translate/api/or/obj/OneRingResponse.kt
new file mode 100644
index 000000000..bbb1c8978
--- /dev/null
+++ b/app/src/main/java/com/bnyro/translate/api/or/obj/OneRingResponse.kt
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2024 You Apps
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.bnyro.translate.api.or.obj
+
+import kotlinx.serialization.Serializable
+
+@Serializable
+data class OneRingResponse(
+ val result: String,
+ val cache: Boolean
+)
diff --git a/app/src/main/java/com/bnyro/translate/const/TranslationEngines.kt b/app/src/main/java/com/bnyro/translate/const/TranslationEngines.kt
index 4a106d5eb..5765e25d1 100644
--- a/app/src/main/java/com/bnyro/translate/const/TranslationEngines.kt
+++ b/app/src/main/java/com/bnyro/translate/const/TranslationEngines.kt
@@ -24,6 +24,7 @@ import com.bnyro.translate.api.lt.LTEngine
import com.bnyro.translate.api.lv.LVEngine
import com.bnyro.translate.api.mh.MhEngine
import com.bnyro.translate.api.mm.MMEngine
+import com.bnyro.translate.api.or.OneRingEngine
import com.bnyro.translate.api.reverso.ReversoEngine
import com.bnyro.translate.api.st.STEngine
import com.bnyro.translate.api.wm.WmEngine
@@ -39,7 +40,8 @@ object TranslationEngines {
MhEngine(),
WmEngine(),
GlEngine(),
- ApEngine()
+ ApEngine(),
+ OneRingEngine()
).map {
it.createOrRecreate()
}
diff --git a/app/src/main/java/com/bnyro/translate/ui/views/EnginePref.kt b/app/src/main/java/com/bnyro/translate/ui/views/EnginePref.kt
index 925f543a9..f6eecb9d3 100644
--- a/app/src/main/java/com/bnyro/translate/ui/views/EnginePref.kt
+++ b/app/src/main/java/com/bnyro/translate/ui/views/EnginePref.kt
@@ -142,7 +142,7 @@ fun EnginePref() {
LazyColumn {
items(engine.supportedEngines) { availableEngine ->
SelectableItem(
- text = availableEngine.capitalize()
+ text = availableEngine.replace("_", " ").capitalize()
) {
Preferences.put(engine.selEnginePrefKey, availableEngine)
engine.createOrRecreate()