Skip to content

Commit

Permalink
Support multiple translation files with kword (#230)
Browse files Browse the repository at this point in the history
* Support multiple translation files

* changelogs

* api dump
  • Loading branch information
CharlesMcD authored Jan 16, 2025
1 parent 64a395b commit 41ad0e5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Breaking Changes

- [kword] Gradle plugin DSL changed. All properties are now lazy.
`translationFile` was replaced with `translationFiles` to support multiple translation files.

Instead of

```kotlin
Expand All @@ -20,7 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
Do this

```kotlin
translationFile.set(file("src/commonMain/resources/translations/translation.en.json"))
translationFiles.setFrom(file("src/commonMain/resources/translations/translation.en.json"))
enumClassName.set("com.mirego.sample.KWordTranslation")
generatedDir.set(file("src/commonMain/generated"))
```
Expand Down
1 change: 0 additions & 1 deletion trikot-kword/kword-plugin/api/kword-plugin.api
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public abstract class com/mirego/kword/KWordExtension {
public fun <init> ()V
public abstract fun getEnumClassName ()Lorg/gradle/api/provider/Property;
public abstract fun getGeneratedDir ()Lorg/gradle/api/file/DirectoryProperty;
public abstract fun getTranslationFile ()Lorg/gradle/api/file/RegularFileProperty;
public abstract fun getTranslationFiles ()Lorg/gradle/api/file/ConfigurableFileCollection;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ package com.mirego.kword

import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property

abstract class KWordExtension {
abstract val translationFile: RegularFileProperty

abstract val translationFiles: ConfigurableFileCollection

abstract val enumClassName: Property<String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ class KWordPlugin : Plugin<Project> {
it.group = TASKS_GROUP
it.description = "Generate keys enum based on json translation file."
it.enumClassName.set(extension.enumClassName)
it.translationFiles.setFrom(
extension.translationFiles + extension.translationFile
)
it.translationFiles.setFrom(extension.translationFiles)
it.generatedDir.set(extension.generatedDir)
}
}
Expand Down

0 comments on commit 41ad0e5

Please sign in to comment.