From fc1565b22634453147fa9ace5c02ab2cc3c98863 Mon Sep 17 00:00:00 2001 From: Michel Gauzins Date: Tue, 15 Oct 2024 19:00:56 +0200 Subject: [PATCH] Lokalise : add parameters (#66) * Add parameters * Gradle options --- gradle.properties | 1 - .../dailymotion/kinta/integration/lokalise/Lokalise.kt | 5 +++++ .../kinta/integration/lokalise/internal/model/Model.kt | 9 ++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 4bcbfc3ac2f..b456f3cc055 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1 @@ systemProp.org.gradle.internal.publish.checksums.insecure=true -org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m diff --git a/kinta-lib/src/main/kotlin/com/dailymotion/kinta/integration/lokalise/Lokalise.kt b/kinta-lib/src/main/kotlin/com/dailymotion/kinta/integration/lokalise/Lokalise.kt index 8467f69c53c..a0033e43120 100644 --- a/kinta-lib/src/main/kotlin/com/dailymotion/kinta/integration/lokalise/Lokalise.kt +++ b/kinta-lib/src/main/kotlin/com/dailymotion/kinta/integration/lokalise/Lokalise.kt @@ -4,6 +4,7 @@ import com.dailymotion.kinta.KintaEnv import com.dailymotion.kinta.Logger import com.dailymotion.kinta.globalJson import com.dailymotion.kinta.helper.UnzipUtils +import com.dailymotion.kinta.integration.lokalise.internal.model.EmptyExport import com.dailymotion.kinta.integration.lokalise.internal.model.LkDownloadPayload import com.dailymotion.kinta.integration.lokalise.internal.model.LkLangResponse import com.dailymotion.kinta.integration.lokalise.internal.model.LkUploadPayload @@ -61,6 +62,8 @@ object Lokalise { resource: String, format: String, langList: List, + convertPlaceholders: Boolean = true, + exportEmptyAs: String = EmptyExport.SKIP.name.lowercase(), ): LokaliseDownloadResponse { val project_ = project ?: KintaEnv.getOrFail(KintaEnv.Var.LOKALISE_PROJECT) @@ -68,6 +71,8 @@ object Lokalise { filter_langs = langList, filter_filenames = listOf(resource), format = format, + convert_placeholders = convertPlaceholders, + export_empty_as = exportEmptyAs ) return requestDownload( diff --git a/kinta-lib/src/main/kotlin/com/dailymotion/kinta/integration/lokalise/internal/model/Model.kt b/kinta-lib/src/main/kotlin/com/dailymotion/kinta/integration/lokalise/internal/model/Model.kt index a002b361423..86642d21aff 100644 --- a/kinta-lib/src/main/kotlin/com/dailymotion/kinta/integration/lokalise/internal/model/Model.kt +++ b/kinta-lib/src/main/kotlin/com/dailymotion/kinta/integration/lokalise/internal/model/Model.kt @@ -22,9 +22,10 @@ data class LkDownloadPayload( val filter_langs: List, val filter_filenames: List, val format: String, - val indentation: String = "tab", + val export_empty_as: String, + val convert_placeholders: Boolean, val directory_prefix: String = "%LANG_ISO%", - val export_empty_as: String = "skip", + val indentation: String = "tab", ) @Serializable @@ -33,4 +34,6 @@ data class LkUploadPayload( val filename: String, val lang_iso: String, val replace_modified: Boolean = true, -) \ No newline at end of file +) + +enum class EmptyExport { BASE, EMPTY, NULL, SKIP } \ No newline at end of file