Skip to content

Commit db3ec70

Browse files
committed
I missed some things
1 parent f5161ed commit db3ec70

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
unitytranslate_version = 0.2.1
1+
unitytranslate_version = 0.2.2
22

33
# This isn't actually used in the download process, however it's used for the sake of caching the downloaded files.
44
# https://github.com/OpenNMT/CTranslate2/blob/master/python/ctranslate2/version.py

library/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dependencies {
2121
publishing {
2222
publications {
2323
register("maven", MavenPublication::class) {
24-
groupId = "xyz.bluspring"
24+
groupId = "xyz.bluspring.unitytranslate"
2525
artifactId = "UnityTranslateLib"
2626
version = "${rootProject.property("unitytranslate_version")}"
2727
from(components.getByName("java"))

library/src/main/kotlin/xyz/bluspring/unitytranslate/library/UnityTranslateLib.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,17 @@ class UnityTranslateLib(val path: Path) {
4141
return translator
4242
}
4343

44-
suspend fun getTranslator(fromCode: String, toCode: String): Translator {
45-
return getTranslator("${fromCode}_${toCode}")
44+
suspend fun getTranslator(fromCode: String, toCode: String, usesCuda: Boolean = false): Translator {
45+
return getTranslator("${fromCode}_${toCode}" + if (usesCuda) "+cuda" else "", usesCuda)
4646
}
4747

48-
suspend fun getTranslator(code: String): Translator {
49-
if (!translators.containsKey(code))
50-
translators[code] = createTranslator(code)
48+
suspend fun getTranslator(code: String, usesCuda: Boolean = false): Translator {
49+
val formattedCode = code + if (usesCuda) "+cuda" else ""
5150

52-
return translators[code]!!
51+
if (!translators.containsKey(formattedCode))
52+
translators[formattedCode] = createTranslator(code, usesCuda)
53+
54+
return translators[formattedCode]!!
5355
}
5456

5557
@ApiStatus.Internal

native/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ publishing {
251251

252252
publications {
253253
register("maven", MavenPublication::class) {
254-
groupId = "xyz.bluspring"
254+
groupId = "xyz.bluspring.unitytranslatelib"
255255
artifactId = "UnityTranslateLib-natives-${target.systemName}-${target.architecture}"
256256
version = "${rootProject.property("unitytranslate_version")}"
257257
from(components.getByName("java"))

0 commit comments

Comments
 (0)