Skip to content

Commit 5f7559f

Browse files
authored
Merge pull request #463 from domaframework/document/i18n-plugin-xml
Localization for `plugin.xml` and Warning Fixes
2 parents 4b86eb7 + 83016d6 commit 5f7559f

File tree

6 files changed

+129
-71
lines changed

6 files changed

+129
-71
lines changed

build.gradle.kts

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ plugins {
2626
grammarKit {
2727
tasks {
2828
generateLexer {
29-
group = "grammer-kit"
29+
group = "grammar-kit"
3030
sourceFile = file("src/main/java/org/domaframework/doma/intellij/Sql.flex")
3131
targetOutputDir = file("src/main/gen/org/domaframework/doma/intellij")
3232
purgeOldFiles = true
3333
}
3434
generateParser {
35-
group = "grammer-kit"
35+
group = "grammar-kit"
3636
sourceFile = file("src/main/java/org/domaframework/doma/intellij/Sql.bnf")
3737
targetRootOutputDir = file("src/main/gen")
3838
pathToParser = "/org/domaframework/doma/intellij/SqlParser.java"
@@ -182,7 +182,7 @@ tasks {
182182
}
183183
}
184184

185-
tasks.register("encodeBase64") {
185+
tasks.register<Task>("encodeBase64") {
186186
doLast {
187187
val currentDir = File("./certificate")
188188
val files = currentDir.listFiles() ?: return@doLast
@@ -203,7 +203,7 @@ tasks.register("encodeBase64") {
203203
}
204204
}
205205

206-
tasks.register("updateChangelog") {
206+
tasks.register<Task>("updateChangelog") {
207207
group = "changelog"
208208
description = "Update CHANGELOG.md based on merged PRs since last release"
209209

@@ -218,7 +218,7 @@ tasks.register("updateChangelog") {
218218
@JsonIgnoreProperties(ignoreUnknown = true)
219219
data class PullRequestItem(
220220
val title: String = "",
221-
@JsonProperty("html_url")
221+
@param:JsonProperty("html_url")
222222
val url: String = "",
223223
val number: Long = 0,
224224
var labelItems: List<String> = emptyList(),
@@ -445,7 +445,7 @@ tasks.register("updateChangelog") {
445445
}
446446
}
447447

448-
tasks.register("checkExistChangelogPullRequest") {
448+
tasks.register<Task>("checkExistChangelogPullRequest") {
449449
group = "changelog"
450450
description = "Check if a PR with the same name has already been created"
451451

@@ -492,24 +492,24 @@ tasks.register("checkExistChangelogPullRequest") {
492492

493493
intellijPlatformTesting {
494494
runIde {
495-
register("runIdeForUiTests") {
496-
task {
497-
jvmArgumentProviders +=
498-
CommandLineArgumentProvider {
499-
listOf(
500-
"-Drobot-server.port=8082",
501-
"-Dide.mac.message.dialogs.as.sheets=false",
502-
"-Djb.privacy.policy.text=<!--999.999-->",
503-
"-Djb.consents.confirmation.enabled=false",
504-
"-Didea.log.registry.conflicts.silent=true",
505-
)
506-
}
507-
}
508-
509-
plugins {
510-
robotServerPlugin()
511-
}
512-
}
495+
// register("runIdeForUiTests") {
496+
// task {
497+
// jvmArgumentProviders +=
498+
// CommandLineArgumentProvider {
499+
// listOf(
500+
// "-Drobot-server.port=8082",
501+
// "-Dide.mac.message.dialogs.as.sheets=false",
502+
// "-Djb.privacy.policy.text=<!--999.999-->",
503+
// "-Djb.consents.confirmation.enabled=false",
504+
// "-Didea.log.registry.conflicts.silent=true",
505+
// )
506+
// }
507+
// }
508+
//
509+
// plugins {
510+
// robotServerPlugin()
511+
// }
512+
// }
513513
}
514514
}
515515

@@ -601,7 +601,6 @@ fun replaceVersionInLogSetting(ver: String) {
601601
}
602602

603603
fun replaceVersion(ver: String) {
604-
checkNotNull(ver)
605604
replaceVersionInPluginUtil(ver)
606605
replaceVersionGradleProperty(ver)
607606
replaceVersionInLogSetting(ver)
@@ -610,7 +609,7 @@ fun replaceVersion(ver: String) {
610609

611610
val encoding: String by project
612611

613-
tasks.register("replaceNewVersion") {
612+
tasks.register<Task>("replaceNewVersion") {
614613
val releaseVersion =
615614
if (project.hasProperty("newVersion")) {
616615
project.property("newVersion") as String
@@ -639,7 +638,7 @@ tasks.register("replaceNewVersion") {
639638
}
640639
}
641640

642-
tasks.register("replaceDraftVersion") {
641+
tasks.register<Task>("replaceDraftVersion") {
643642
val draftVersion =
644643
if (project.hasProperty("draftVersion")) {
645644
project.property("draftVersion") as String
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright Doma Tools Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.domaframework.doma.intellij.bundle
17+
18+
import com.intellij.DynamicBundle
19+
import org.jetbrains.annotations.NonNls
20+
import org.jetbrains.annotations.PropertyKey
21+
22+
@NonNls
23+
private const val BUNDLE = "messages.DomaToolsSettingBundle"
24+
25+
object SettingMessageBundle : DynamicBundle(BUNDLE) {
26+
@JvmStatic
27+
fun message(
28+
@PropertyKey(resourceBundle = BUNDLE) key: String,
29+
vararg params: Any,
30+
) = getMessage(key, *params)
31+
32+
@Suppress("unused")
33+
@JvmStatic
34+
fun messagePointer(
35+
@PropertyKey(resourceBundle = BUNDLE) key: String,
36+
vararg params: Any,
37+
) = getLazyMessage(key, *params)
38+
}

src/main/kotlin/org/domaframework/doma/intellij/setting/DomaToolsConfigurable.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package org.domaframework.doma.intellij.setting
1717

1818
import com.intellij.openapi.options.Configurable
1919
import com.intellij.openapi.options.ConfigurationException
20+
import org.domaframework.doma.intellij.bundle.SettingMessageBundle
2021
import org.domaframework.doma.intellij.setting.state.DomaToolsFormatEnableSettings
2122
import javax.swing.JComponent
2223

@@ -25,12 +26,12 @@ class DomaToolsConfigurable : Configurable {
2526

2627
private var formatSettings: DomaToolsFormatEnableSettings = DomaToolsFormatEnableSettings.getInstance()
2728

28-
override fun getDisplayName(): String = "Doma Tools"
29+
override fun getDisplayName(): String = SettingMessageBundle.message("applicationConfigurable.DomaToolsConfigurable.displayName")
2930

3031
override fun createComponent(): JComponent? = mySettingsComponent?.panel
3132

3233
override fun isModified(): Boolean {
33-
val enableFormatModified = formatSettings.isModified(mySettingsComponent) != false
34+
val enableFormatModified = formatSettings.isModified(mySettingsComponent)
3435
return enableFormatModified
3536
}
3637

src/main/resources/META-INF/plugin.xml

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
<resource-bundle>messages.DomaToolsBundle</resource-bundle>
1616
<resource-bundle>messages.LLMInstallerBundle</resource-bundle>
17+
<!-- Write it last to make it recognized as the default resource bundle -->
18+
<resource-bundle>messages.DomaToolsSettingBundle</resource-bundle>
1719

1820
<projectListeners>
1921
<listener
@@ -27,9 +29,12 @@
2729

2830
<applicationService
2931
serviceImplementation="org.domaframework.doma.intellij.setting.state.DomaToolsFormatEnableSettings"/>
30-
<applicationConfigurable groupId="org.domaframework.doma"
31-
instance="org.domaframework.doma.intellij.setting.DomaToolsConfigurable"
32-
displayName="Doma Tools" />
32+
<applicationConfigurable
33+
bundle="messages.DomaToolsSettingBundle"
34+
id="org.domaframework.doma.intellij.setting.DomaToolsConfigurable"
35+
groupId="org.domaframework.doma"
36+
key="doma.tools"
37+
instance="org.domaframework.doma.intellij.setting.DomaToolsConfigurable" />
3338

3439
<!-- Reference -->
3540
<psi.referenceContributor
@@ -95,35 +100,40 @@
95100

96101
<!-- Intention Actions -->
97102
<intentionAction>
98-
<language>JAVA</language>
99-
<className>org.domaframework.doma.intellij.action.dao.ConvertSqlAnnotationToFileAction</className>
100-
<category>Doma tools</category>
101-
<skipBeforeAfter>true</skipBeforeAfter>
103+
<language>JAVA</language>
104+
<bundleName>messages.DomaToolsSettingBundle</bundleName>
105+
<className>org.domaframework.doma.intellij.action.dao.ConvertSqlAnnotationToFileAction</className>
106+
<categoryKey>doma.tools</categoryKey>
107+
<skipBeforeAfter>true</skipBeforeAfter>
102108
</intentionAction>
103109
<intentionAction>
104-
<language>DomaSql</language>
105-
<className>org.domaframework.doma.intellij.action.sql.ConvertSqlFileToAnnotationFromSqlAction</className>
106-
<category>Doma tools</category>
107-
<skipBeforeAfter>true</skipBeforeAfter>
110+
<language>DomaSql</language>
111+
<bundleName>messages.DomaToolsSettingBundle</bundleName>
112+
<className>org.domaframework.doma.intellij.action.sql.ConvertSqlFileToAnnotationFromSqlAction</className>
113+
<categoryKey>doma.tools</categoryKey>
114+
<skipBeforeAfter>true</skipBeforeAfter>
115+
</intentionAction>
116+
<intentionAction>
117+
<language>JAVA</language>
118+
<bundleName>messages.DomaToolsSettingBundle</bundleName>
119+
<className>org.domaframework.doma.intellij.action.dao.ConvertSqlFileToAnnotationFromDaoAction</className>
120+
<categoryKey>doma.tools</categoryKey>
121+
<skipBeforeAfter>true</skipBeforeAfter>
122+
</intentionAction>
123+
<intentionAction>
124+
<language>JAVA</language>
125+
<bundleName>messages.DomaToolsSettingBundle</bundleName>
126+
<className>org.domaframework.doma.intellij.action.dao.BulkConvertSqlAnnotationToFileAction</className>
127+
<categoryKey>doma.tools</categoryKey>
128+
<skipBeforeAfter>true</skipBeforeAfter>
129+
</intentionAction>
130+
<intentionAction>
131+
<language>JAVA</language>
132+
<bundleName>messages.DomaToolsSettingBundle</bundleName>
133+
<className>org.domaframework.doma.intellij.action.dao.BulkConvertSqlFileToAnnotationAction</className>
134+
<categoryKey>doma.tools</categoryKey>
135+
<skipBeforeAfter>true</skipBeforeAfter>
108136
</intentionAction>
109-
<intentionAction>
110-
<language>JAVA</language>
111-
<className>org.domaframework.doma.intellij.action.dao.ConvertSqlFileToAnnotationFromDaoAction</className>
112-
<category>Doma tools</category>
113-
<skipBeforeAfter>true</skipBeforeAfter>
114-
</intentionAction>
115-
<intentionAction>
116-
<language>JAVA</language>
117-
<className>org.domaframework.doma.intellij.action.dao.BulkConvertSqlAnnotationToFileAction</className>
118-
<category>Doma tools</category>
119-
<skipBeforeAfter>true</skipBeforeAfter>
120-
</intentionAction>
121-
<intentionAction>
122-
<language>JAVA</language>
123-
<className>org.domaframework.doma.intellij.action.dao.BulkConvertSqlFileToAnnotationAction</className>
124-
<category>Doma tools</category>
125-
<skipBeforeAfter>true</skipBeforeAfter>
126-
</intentionAction>
127137
</extensions>
128138

129139
<extensions defaultExtensionNs="org.intellij.intelliLang">
@@ -135,33 +145,25 @@
135145
</extensions>
136146

137147
<!-- Action -->
138-
<actions>
148+
<actions resource-bundle="messages.DomaToolsSettingBundle">
139149
<group
140150
id="org.domaframework.doma.intellij.DomaToolGroupActions"
141-
text="Doma Tools"
142151
popup="true"
143152
icon="AllIcons.Nodes.AbstractClass">
144153
<add-to-group
145154
group-id="EditorPopupMenu"
146-
anchor="last"
147-
/>
155+
anchor="last"/>
148156
<action
149157
id="org.domaframework.doma.intellij.action.JumpToSQLFromDao"
150-
class="org.domaframework.doma.intellij.action.dao.JumpToSQLFromDaoAction"
151-
text="Jump to SQL"
152-
description="Jump from DAO file to SQL file">
158+
class="org.domaframework.doma.intellij.action.dao.JumpToSQLFromDaoAction">
153159
<keyboard-shortcut keymap="$default" first-keystroke="alt D"/>
154160
</action>
155161
<action id="org.domaframework.doma.intellij.JumpToDaoFromSQL"
156-
class="org.domaframework.doma.intellij.action.sql.JumpToDaoFromSQLAction"
157-
text="Jump to DAO"
158-
description="Jump from SQL file to DAO method definition">
162+
class="org.domaframework.doma.intellij.action.sql.JumpToDaoFromSQLAction">
159163
<keyboard-shortcut keymap="$default" first-keystroke="alt D"/>
160164
</action>
161165
<action id="org.domaframework.doma.intellij.GenerateSqlAction"
162-
class="org.domaframework.doma.intellij.action.dao.GenerateSqlAction"
163-
text="Generate SQL"
164-
description="Generate SQL file from DAO method">
166+
class="org.domaframework.doma.intellij.action.dao.GenerateSqlAction">
165167
<keyboard-shortcut keymap="$default" first-keystroke="control alt G"/>
166168
</action>
167169
</group>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
action.org.domaframework.doma.intellij.JumpToDaoFromSQL.text=Jump to DAO
2+
action.org.domaframework.doma.intellij.JumpToDaoFromSQL.description=Jump from SQL file to DAO method definition
3+
action.org.domaframework.doma.intellij.action.JumpToSQLFromDao.text=Jump to SQL
4+
action.org.domaframework.doma.intellij.action.JumpToSQLFromDao.description=Jump from DAO file to SQL file
5+
action.org.domaframework.doma.intellij.GenerateSqlAction.text=Generate SQL
6+
action.org.domaframework.doma.intellij.GenerateSqlAction.description=Generate SQL file from DAO method
7+
group.org.domaframework.doma.intellij.DomaToolGroupActions.text=Doma Tools
8+
doma.tools=Doma tools
9+
applicationConfigurable.DomaToolsConfigurable.displayName=Doma Tools
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
action.org.domaframework.doma.intellij.JumpToDaoFromSQL.text=\u0044\u0041\u004F\u30E1\u30BD\u30C3\u30C9\u306B\u30B8\u30E3\u30F3\u30D7
2+
action.org.domaframework.doma.intellij.JumpToDaoFromSQL.description=\u0053\u0051\u004C\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u0044\u0041\u004F\u30E1\u30BD\u30C3\u30C9\u5B9A\u7FA9\u306B\u30B8\u30E3\u30F3\u30D7\u3057\u307E\u3059\u3002
3+
action.org.domaframework.doma.intellij.action.JumpToSQLFromDao.text=\u0053\u0051\u004C\u30D5\u30A1\u30A4\u30EB\u306B\u30B8\u30E3\u30F3\u30D7
4+
action.org.domaframework.doma.intellij.action.JumpToSQLFromDao.description=\u0044\u0041\u004F\u30E1\u30BD\u30C3\u30C9\u304B\u3089\u0053\u0051\u004C\u30D5\u30A1\u30A4\u30EB\u306B\u30B8\u30E3\u30F3\u30D7\u3057\u307E\u3059\u3002
5+
action.org.domaframework.doma.intellij.GenerateSqlAction.text=\u0053\u0051\u004C\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210
6+
action.org.domaframework.doma.intellij.GenerateSqlAction.description=\u0044\u0041\u004F\u30E1\u30BD\u30C3\u30C9\u306B\u7D10\u3065\u304F\u0053\u0051\u004C\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3057\u307E\u3059\u3002
7+
group.org.domaframework.doma.intellij.DomaToolGroupActions.text=Doma Tools
8+
doma.tools=Doma tools
9+
applicationConfigurable.DomaToolsConfigurable.displayName=Doma Tools

0 commit comments

Comments
 (0)