Skip to content

Commit

Permalink
Add parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
michgauz committed Oct 15, 2024
1 parent de17fa5 commit 2b544fc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
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 2b544fc

Please sign in to comment.