Module localization. How to rename actions in a module
In this article we will examine the module localization process, so that all module actions are translated into a more user-friendly format, looking neat and intuitively understandable. This article is a supplement to the material — how to create your first module
This article was prepared based on the old version of the interface. Despite possible visual changes, the functionality and sequence of actions remain relevant.
1. Brief module structure
Description of module structure and its files:
A module in BrowserAutomationStudio is a set of files, each of which is responsible for a specific part of its operation. These files are stored in the module folder and provide its functionality, appearance and interaction with the BAS interface.
- manifest.json — this file is responsible for general module settings, its localization. Various other files responsible for built-in code in the module are also connected to it.
Action files (created functions) — these are files that contain the main logic of each specific action in the module.
Each action consists of 3 files:
- action_name_code.js — file with code that is added to the script when using a specific action
- action_name_select.js — file responsible for the connection between the interface and executed actions, including variable checks and other functional aspects
- action_name_interface.js — file that defines the action interface, i.e. its appearance and settings in the constructor
For a more in-depth analysis of module structure and files, you can read the guide at the link below, we move on to the next section of the article. Detailed analysis of module structure
Let's examine the localization process using the «EmulatorModule» module as an example
2. Renaming actions and parameters in the module
In the module created as part of another article, the actions do not y et have correct names, which indicates that work on it is not yet complete
Module parameter and action localization: step-by-step instructions (8 steps)
1. Navigate to the module folder:
- In the top menu of BrowserAutomationStudio click «Module Manager»
- Find and click on the name of your module (in the example EmulatorModule)
- Click the «Open folder containing module» button
2. Module folder: contains all files responsible for module operation: its settings, logic, interface and auxiliary components
3. Open the manifest.json file
To open .json
files, it’s convenient to use the Visual Studio Code
4. In the manifest.json
file of your module, find the «actions» array — it contains a list of all actions used by the module
5. Find the «description» object in the manifest.json file and change the value to set the desired action name in the module
For example, in the EmulatorModule module there are two actions to which we will assign new, more understandable names:
6. Save the manifest.json
file using the Ctrl + S keyboard shortcut. After this, the changes will take effect — the actions in the module will be displayed with new names in the BrowserAutomationStudio interface
7. The next step is renaming the parameters used in the module actions. For this we move to other module files:
- EmulatorModule_screenshot_and_save_screenshot_to_png_interface.js
- EmulatorModule_Load_site_await_emulation_interface.js
The «description» field contains descriptions of the module parameters
8. Done 🎉. Go to your project with module actions and check the result
3. Module result — «EmulatorModule»
We have successfully renamed our actions as well as parameters, now the module looks more understandable and pleasant for you or your users
Source materials for practice:
Thank you for your attention
In this article we examined the module localization process in BrowserAutomationStudio: how to translate actions and parameters, as well as configure them to improve usability. You learned how to work with the module file structure, edit descriptions and adapt the interface to user tasks, making the module more understandable and convenient to work with
You can share your module, as dozens of other authors have done ❤️
Module section on the forum — RU | EN
Additional study materials:
1. Step-by-step guide to creating a module in BrowserAutomationStudio
2. Functions in BrowserAutomationStudio