Skip to content

Commit

Permalink
Lokalise : add parameters (#66)
Browse files Browse the repository at this point in the history
* Add parameters

* Gradle options
  • Loading branch information
michgauz authored Oct 15, 2024
1 parent de17fa5 commit fc1565b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
systemProp.org.gradle.internal.publish.checksums.insecure=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -61,13 +62,17 @@ object Lokalise {
resource: String,
format: String,
langList: List<String>,
convertPlaceholders: Boolean = true,
exportEmptyAs: String = EmptyExport.SKIP.name.lowercase(),
): LokaliseDownloadResponse {
val project_ = project ?: KintaEnv.getOrFail(KintaEnv.Var.LOKALISE_PROJECT)

val payload = LkDownloadPayload(
filter_langs = langList,
filter_filenames = listOf(resource),
format = format,
convert_placeholders = convertPlaceholders,
export_empty_as = exportEmptyAs
)

return requestDownload(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ data class LkDownloadPayload(
val filter_langs: List<String>,
val filter_filenames: List<String>,
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
Expand All @@ -33,4 +34,6 @@ data class LkUploadPayload(
val filename: String,
val lang_iso: String,
val replace_modified: Boolean = true,
)
)

enum class EmptyExport { BASE, EMPTY, NULL, SKIP }

0 comments on commit fc1565b

Please sign in to comment.