Skip to content

Commit bbfc2eb

Browse files
author
Vitaliy
authored
Merge pull request #208 from eduard13/149-issue-static-texts
Managing the static phrases to use the bundle messages
2 parents 2ea351e + 710cc25 commit bbfc2eb

28 files changed

+178
-65
lines changed

resources/magento2/common.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ common.module.dependencies=Module Dependencies
66
common.module.description=Module Description
77
common.ok=OK
88
common.cancel=Cancel
9+
common.error=Error
10+
common.module.target=Target Module
11+
common.area.target=Target Area
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1+
inspection.class.hierarchyImplementationCheck=Class must implement {0}
2+
inspection.class.hierarchyExtendingCheck=Class must extend {0}
13
inspection.plugin.duplicateInSameFile=The plugin name already used in this file. For more details see Inspection Description.
24
inspection.plugin.duplicateInOtherPlaces=The plugin name "{0}" for targeted "{1}" class is already used in the module "{2}" ({3} scope). For more details see Inspection Description.
35
inspection.graphql.resolver.mustImplement=Class must implements any of the following interfaces: \\Magento\\Framework\\GraphQl\\Query\\ResolverInterface, \\Magento\\Framework\\GraphQl\\Query\\Resolver\\BatchResolverInterface, \\Magento\\Framework\\GraphQl\\Query\\Resolver\\BatchServiceContractResolverInterface
46
inspection.graphql.resolver.fix.family=Implement Resolver interface
57
inspection.graphql.resolver.fix.title=Select one of the following interface
8+
inspection.plugin.error.nonPublicMethod=You can't declare a plugin for a not public method.
9+
inspection.plugin.error.finalClass=You can't declare a plugin for a final class.
10+
inspection.plugin.error.finalMethod=You can't declare a plugin for a final method.
11+
inspection.plugin.error.staticMethod=You can't declare a plugin for a static method.
12+
inspection.plugin.error.constructMethod=You can't declare a plugin for a __construct method.
13+
inspection.plugin.error.redundantParameter=Redundant parameter
14+
inspection.plugin.error.typeIncompatibility=Possible type incompatibility. Consider changing the parameter according to the target method.
15+
inspection.observer.duplicateInSameFile=The observer name already used in this file. For more details see Inspection Description.
16+
inspection.observer.duplicateInOtherPlaces=The observer name "{0}" for event "{1}" is already used in the module "{2}" ({3} scope). For more details see Inspection Description.
17+
inspection.cache.disabledCache=Cacheable false attribute on the default layout will disable cache site-wide

src/com/magento/idea/magento2plugin/actions/generation/PluginGenerateMethodHandlerBase.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import com.magento.idea.magento2plugin.actions.generation.util.CodeStyleSettings;
3535
import com.magento.idea.magento2plugin.actions.generation.util.CollectInsertedMethods;
3636
import com.magento.idea.magento2plugin.actions.generation.util.FillTextBufferWithPluginMethods;
37+
import com.magento.idea.magento2plugin.bundles.CommonBundle;
3738
import com.magento.idea.magento2plugin.bundles.ValidatorBundle;
3839
import com.magento.idea.magento2plugin.magento.files.Plugin;
3940
import com.magento.idea.magento2plugin.util.GetPhpClassByFQN;
@@ -49,6 +50,7 @@
4950
public abstract class PluginGenerateMethodHandlerBase implements LanguageCodeInsightActionHandler {
5051
private CollectInsertedMethods collectInsertedMethods;
5152
private ValidatorBundle validatorBundle;
53+
private CommonBundle commonBundle;
5254
public String type;
5355
public FillTextBufferWithPluginMethods fillTextBuffer;
5456

@@ -57,6 +59,7 @@ public PluginGenerateMethodHandlerBase(Plugin.PluginType type) {
5759
this.fillTextBuffer = FillTextBufferWithPluginMethods.getInstance();
5860
this.collectInsertedMethods = CollectInsertedMethods.getInstance();
5961
this.validatorBundle = new ValidatorBundle();
62+
this.commonBundle = new CommonBundle();
6063
}
6164

6265
public boolean isValidFor(Editor editor, PsiFile file) {
@@ -165,7 +168,7 @@ protected PhpNamedElementNode[] targetMethods(@NotNull PhpClass phpClass, Key<Ob
165168

166169
if (targetClass == null) {
167170
String errorMessage = validatorBundle.message("validator.class.targetClassNotFound");
168-
JOptionPane.showMessageDialog(null, errorMessage, "Error", JOptionPane.ERROR_MESSAGE);
171+
JOptionPane.showMessageDialog(null, errorMessage, commonBundle.message("common.error"), JOptionPane.ERROR_MESSAGE);
169172
continue;
170173
}
171174

src/com/magento/idea/magento2plugin/actions/generation/dialog/CreateAPluginDialog.form

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@
3838
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
3939
</constraints>
4040
<properties>
41-
<text value="OK"/>
41+
<text resource-bundle="magento2/common" key="common.ok"/>
4242
</properties>
4343
</component>
4444
<component id="5723f" class="javax.swing.JButton" binding="buttonCancel">
4545
<constraints>
4646
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
4747
</constraints>
4848
<properties>
49-
<text value="Cancel"/>
49+
<text resource-bundle="magento2/common" key="common.cancel"/>
5050
</properties>
5151
</component>
5252
</children>
@@ -154,7 +154,7 @@
154154
</constraints>
155155
<properties>
156156
<labelFor value="bd654"/>
157-
<text value="Target Module"/>
157+
<text resource-bundle="magento2/common" key="common.module.target"/>
158158
</properties>
159159
</component>
160160
<component id="b0d15" class="javax.swing.JComboBox" binding="pluginType">
@@ -191,7 +191,7 @@
191191
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
192192
</constraints>
193193
<properties>
194-
<text value="Target Area"/>
194+
<text resource-bundle="magento2/common" key="common.area.target"/>
195195
</properties>
196196
</component>
197197
</children>

src/com/magento/idea/magento2plugin/actions/generation/dialog/CreateAnObserverDialog.form

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@
3838
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
3939
</constraints>
4040
<properties>
41-
<text value="OK"/>
41+
<text resource-bundle="magento2/common" key="common.ok"/>
4242
</properties>
4343
</component>
4444
<component id="5723f" class="javax.swing.JButton" binding="buttonCancel">
4545
<constraints>
4646
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
4747
</constraints>
4848
<properties>
49-
<text value="Cancel"/>
49+
<text resource-bundle="magento2/common" key="common.cancel"/>
5050
</properties>
5151
</component>
5252
</children>
@@ -130,7 +130,7 @@
130130
</constraints>
131131
<properties>
132132
<labelFor value="bd654"/>
133-
<text value="Target Module"/>
133+
<text resource-bundle="magento2/common" key="common.module.target"/>
134134
</properties>
135135
</component>
136136
<component id="bd654" class="com.magento.idea.magento2plugin.ui.FilteredComboBox" binding="observerModule" custom-create="true">
@@ -150,7 +150,7 @@
150150
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
151151
</constraints>
152152
<properties>
153-
<text value="Target Area"/>
153+
<text resource-bundle="magento2/common" key="common.area.target"/>
154154
</properties>
155155
</component>
156156
</children>

src/com/magento/idea/magento2plugin/actions/generation/dialog/NewBlockDialog.form

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@
3838
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
3939
</constraints>
4040
<properties>
41-
<text value="OK"/>
41+
<text resource-bundle="magento2/common" key="common.ok"/>
4242
</properties>
4343
</component>
4444
<component id="5723f" class="javax.swing.JButton" binding="buttonCancel">
4545
<constraints>
4646
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
4747
</constraints>
4848
<properties>
49-
<text value="Cancel"/>
49+
<text resource-bundle="magento2/common" key="common.cancel"/>
5050
</properties>
5151
</component>
5252
</children>

src/com/magento/idea/magento2plugin/actions/generation/dialog/NewCronjobDialog.form

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
3434
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
3535
</constraints>
3636
<properties>
37-
<text value="OK"/>
37+
<text resource-bundle="magento2/common" key="common.ok"/>
3838
</properties>
3939
</component>
4040
<component id="5723f" class="javax.swing.JButton" binding="buttonCancel">
4141
<constraints>
4242
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
4343
</constraints>
4444
<properties>
45-
<text value="Cancel"/>
45+
<text resource-bundle="magento2/common" key="common.cancel"/>
4646
</properties>
4747
</component>
4848
</children>

src/com/magento/idea/magento2plugin/actions/generation/dialog/NewGraphQlResolverDialog.form

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@
108108
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
109109
</constraints>
110110
<properties>
111-
<text value="OK"/>
111+
<text resource-bundle="magento2/common" key="common.ok"/>
112112
</properties>
113113
</component>
114114
<component id="1b860" class="javax.swing.JButton" binding="buttonCancel">
115115
<constraints>
116116
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
117117
</constraints>
118118
<properties>
119-
<text value="Cancel"/>
119+
<text resource-bundle="magento2/common" key="common.cancel"/>
120120
</properties>
121121
</component>
122122
</children>

src/com/magento/idea/magento2plugin/actions/generation/dialog/NewViewModelDialog.form

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@
108108
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
109109
</constraints>
110110
<properties>
111-
<text value="OK"/>
111+
<text resource-bundle="magento2/common" key="common.ok"/>
112112
</properties>
113113
</component>
114114
<component id="1b860" class="javax.swing.JButton" binding="buttonCancel">
115115
<constraints>
116116
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
117117
</constraints>
118118
<properties>
119-
<text value="Cancel"/>
119+
<text resource-bundle="magento2/common" key="common.cancel"/>
120120
</properties>
121121
</component>
122122
</children>

src/com/magento/idea/magento2plugin/actions/generation/dialog/OverrideClassByAPreferenceDialog.form

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@
3737
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
3838
</constraints>
3939
<properties>
40-
<text value="OK"/>
40+
<text resource-bundle="magento2/common" key="common.ok"/>
4141
</properties>
4242
</component>
4343
<component id="5723f" class="javax.swing.JButton" binding="buttonCancel">
4444
<constraints>
4545
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
4646
</constraints>
4747
<properties>
48-
<text value="Cancel"/>
48+
<text resource-bundle="magento2/common" key="common.cancel"/>
4949
</properties>
5050
</component>
5151
</children>
@@ -127,7 +127,7 @@
127127
</constraints>
128128
<properties>
129129
<labelFor value="bd654"/>
130-
<text value="Target Module"/>
130+
<text resource-bundle="magento2/common" key="common.module.target"/>
131131
</properties>
132132
</component>
133133
<component id="bd654" class="com.magento.idea.magento2plugin.ui.FilteredComboBox" binding="preferenceModule" custom-create="true">
@@ -149,7 +149,7 @@
149149
</grid>
150150
</constraints>
151151
<properties>
152-
<text value="Target Area"/>
152+
<text resource-bundle="magento2/common" key="common.area.target"/>
153153
</properties>
154154
</component>
155155
</children>

0 commit comments

Comments
 (0)