Skip to content

Commit 5290d48

Browse files
committed
1.5.7: Option to switch to ICU Message Format v2.
1 parent d16f92a commit 5290d48

File tree

9 files changed

+34
-6
lines changed

9 files changed

+34
-6
lines changed

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/kotlinc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

changes/1.5.7.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Gradle Plugins 1.5.7
2+
3+
This version includes a change to the KordEx plugin, specifically the translation class generator.
4+
5+
## KordEx Plugin
6+
7+
- Update the translation class generator.
8+
- The translation class generator now alphabetically sorts the generated keys and objects, for easier browsing.
9+
- Add a new `messageFormatVersion` property to the `i18n` builder.
10+
- If you want to use [ICU Message Format version 2](https://unicode-org.github.io/icu/userguide/format_parse/messages/mf2.html) (still in development preview), set this to `2`. This will require the latest build of KordEx version `2.3.1-SNAPSHOT` or later.
11+
- This option defaults to `1`, and this setting won't break the generated code — thus keeping compatibility with `2.3.0-SNAPSHOT` and later.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ kotlin.incremental=true
33
org.gradle.jvmargs=-XX:MaxMetaspaceSize=1024m
44
org.gradle.parallel=true
55

6-
projectVersion=1.5.6
6+
projectVersion=1.5.7

kordex/build.gradle.kts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ dependencies {
4949
implementation("com.jcabi:jcabi-manifests:2.1.0")
5050
implementation("com.squareup:kotlinpoet:1.18.1")
5151
implementation("com.github.zafarkhaja:java-semver:0.10.2")
52-
implementation("dev.kordex.i18n:i18n-generator:1.0.5")
52+
53+
implementation("dev.kordex.i18n:i18n-generator:1.0.6")
54+
5355
implementation("io.github.pdvrieze.xmlutil:core-jvm:0.86.3")
5456
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.6.3")
5557

kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/helpers/I18nHelper.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ package dev.kordex.gradle.plugins.kordex.helpers
88

99
import dev.kordex.gradle.plugins.kordex.InternalAPI
1010
import dev.kordex.gradle.plugins.kordex.i18n.KordExI18nSettings
11+
import dev.kordex.i18n.generator.MESSAGE_FORMAT_VERSIONS
1112
import dev.kordex.i18n.generator.TranslationsClass
1213
import org.gradle.api.Project
1314
import org.gradle.api.tasks.SourceSetContainer
@@ -66,6 +67,7 @@ object I18nHelper {
6667
classPackage = extension.classPackage.get(),
6768
publicVisibility = extension.publicVisibility.get(),
6869
splitToCamelCase = extension.camelCaseNames.get(),
70+
messageFormatVersion = extension.messageFormatVersion.get(),
6971
)
7072

7173
translationsClass.writeTo(outputDirectory)
@@ -107,5 +109,12 @@ object I18nHelper {
107109
error("Required property $key has not been set.")
108110
}
109111
}
112+
113+
if (extension.messageFormatVersion.get() !in MESSAGE_FORMAT_VERSIONS) {
114+
error(
115+
"Invalid message format version ${extension.messageFormatVersion} - " +
116+
"must be one of ${MESSAGE_FORMAT_VERSIONS.joinToString()}"
117+
)
118+
}
110119
}
111120
}

kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/i18n/KordExI18nSettings.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class KordExI18nSettings(props: PropertyFactory) {
2323
val configureSourceSet: Property<Boolean> = props.boolean(true)
2424
val outputDirectory: Property<File> = props.single()
2525

26+
val messageFormatVersion: Property<Int> = props.single<Int>().convention(1)
2627
val publicVisibility: Property<Boolean> = props.boolean(true)
2728

2829
@Deprecated(

testModule/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ kordEx {
2121
module("extra-pluralkit")
2222
module("func-mappings")
2323

24-
kordExVersion = "2.3.0-SNAPSHOT"
24+
kordExVersion = "2.3.1-SNAPSHOT"
2525
kordVersion = "latest"
2626

2727
bot {
@@ -32,7 +32,7 @@ kordEx {
3232
classPackage = "template.i18n"
3333
translationBundle = "template.strings"
3434
publicVisibility = false
35-
camelCaseNames = false
35+
messageFormatVersion = 2
3636
}
3737
}
3838

testModule/settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pluginManagement {
22
plugins {
3-
val pluginVersion = "1.5.6"
3+
val pluginVersion = "1.5.7"
44

55
kotlin("jvm") version "2.0.21"
66

0 commit comments

Comments
 (0)