diff --git a/topics/basics/basic_action_system.md b/topics/basics/basic_action_system.md index 8a5bbfdb5..bb70fa3ca 100644 --- a/topics/basics/basic_action_system.md +++ b/topics/basics/basic_action_system.md @@ -196,64 +196,6 @@ There are two main ways to register an action: either by [registering it in the Registering actions in [plugin.xml](plugin_configuration_file.md) is demonstrated in the following reference examples, which document all elements and attributes used in the [``](plugin_configuration_file.md#idea-plugin__actions) section and describe each element's meaning. -#### Localizing Actions and Groups - -> Hard-coding presentation in the `AnAction` constructor is discouraged, use inspection Plugin DevKit | Code | Eager creation of action presentation (2023.3) to highlight such problems. - -Action and group localization use [resource bundles](internationalization.md#message-bundles) containing property files named \$NAME\$Bundle.properties, each file consisting of `key=value` pairs. -The [`action_basics`](%gh-sdk-samples-master%/action_basics) plugin demonstrates using a resource bundle to localize the group and action entries added to the Editor Popup Menu. - -When localizing actions and groups, the `text` and `description` attributes are not declared in plugin.xml. -Instead, those attribute values vary depending on the locale and get declared in a resource bundle. - -The name and location of the resource bundle must be declared in the plugin.xml file. -In the case of `action_basics`, only a default localization resource bundle (/resources/messages/BasicActionsBundle.properties) is provided: - -```xml -messages.BasicActionsBundle -``` - -_2020.1_
-If necessary, a dedicated resource bundle to use for actions and groups can be defined on [``](plugin_configuration_file.md#idea-plugin__actions): - -```xml - - - -``` - -See [Extending DefaultActionGroup](grouping_action.md#extending-defaultactiongroup) for a tutorial of localizing Actions and Groups. - - - - - -For Actions, the key in property files incorporates the action ID in this specific structure: -* `action..text=Translated Action Text` -* `action..description=Translated Action Description` - -_2020.1_
-If `` is used for an action ID, the key includes the `place` attribute: -* `action...text=Place-dependent Translated Action Text` - -
- - - -For Groups, the key in the property files incorporates the group ID in this specific structure: -* `group..text=Translated Group Text` -* `group..description=Translated Group Description` - -_2020.3_
-If `` is used for a group ID, the key includes the `place` attribute: -* `group...text=Place-dependent Translated Group Text` - -
- -
- - #### Action Declaration Reference The places where actions can appear are defined by constants in [`ActionPlaces`](%gh-ic%/platform/ide-core/src/com/intellij/openapi/actionSystem/ActionPlaces.java). @@ -262,7 +204,6 @@ Group IDs for the IntelliJ Platform are defined in [`PlatformActions.xml`](%gh-i This and additional information can also be found by using the [Code Completion](https://www.jetbrains.com/help/idea/auto-completing-code.html#invoke-basic-completion), [Quick Definition](https://www.jetbrains.com/help/idea/viewing-reference-information.html#view-definition-symbols), and [Quick Documentation](https://www.jetbrains.com/help/idea/viewing-reference-information.html#inline-quick-documentation) features. > To look up existing Action ID (for example, for use in `relative-to-action`), [UI Inspector](internal_ui_inspector.md) can be used. -> > See the [``](plugin_configuration_file.md#idea-plugin__actions) element and its children documentation for details. > @@ -368,6 +309,63 @@ This and additional information can also be found by using the [Code Completion] ``` +#### Localizing Actions and Groups + +> Hard-coding presentation in the `AnAction` constructor is discouraged, use inspection Plugin DevKit | Code | Eager creation of action presentation (2023.3) to highlight such problems. + +Action and group localization use [resource bundles](internationalization.md#message-bundles) containing property files named \$NAME\$Bundle.properties, each file consisting of `key=value` pairs. +The [`action_basics`](%gh-sdk-samples-master%/action_basics) plugin demonstrates using a resource bundle to localize the group and action entries added to the Editor Popup Menu. + +When localizing actions and groups, the `text` and `description` attributes are not declared in plugin.xml. +Instead, those attribute values vary depending on the locale and get declared in a resource bundle. + +The name and location of the resource bundle must be declared in the plugin.xml file. +In the case of `action_basics`, only a default localization resource bundle (/resources/messages/BasicActionsBundle.properties) is provided: + +```xml +messages.BasicActionsBundle +``` + +_2020.1_
+If necessary, a dedicated resource bundle to use for actions and groups can be defined on [``](plugin_configuration_file.md#idea-plugin__actions): + +```xml + + + +``` + +See [Extending DefaultActionGroup](grouping_action.md#extending-defaultactiongroup) for a tutorial of localizing Actions and Groups. + + + + + +For Actions, the key in property files incorporates the action ID in this specific structure: +* `action..text=Translated Action Text` +* `action..description=Translated Action Description` + +_2020.1_
+If `` is used for an action ID, the key includes the `place` attribute: +* `action...text=Place-dependent Translated Action Text` + +
+ + + +For Groups, the key in the property files incorporates the group ID in this specific structure: +* `group..text=Translated Group Text` +* `group..description=Translated Group Description` + +_2020.3_
+If `` is used for a group ID, the key includes the `place` attribute: +* `group...text=Place-dependent Translated Group Text` + +
+ +
+ ### Registering Actions from Code Two steps are required to register an action from code: @@ -375,6 +373,7 @@ Two steps are required to register an action from code: * Second, the action needs to be added to one or more groups. To get an instance of an action group by ID, it is necessary to call `ActionManager.getAction()` and cast the returned value to [`DefaultActionGroup`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/actionSystem/DefaultActionGroup.java). + ## Building a Toolbar/Popup Menu from Actions {id="buildingToolbarPopupMenu"}