...
...
...
...
...
...
...
...
...
...
...
...
...
...
Introduction
This document describes the steps to create a plugin to change the UI labels in UI and API error messages shown on OpenSpecimen. This guide is intended for developers or technical IT staff.
...
Download plugin
Download or clone the sample plugin from git.
...
Henceforth the
...
exploded plugin
...
directory
...
(i.e:
custom-resources
) is referred as $PLUGIN_HOME
...
.
Resources files
All labels and messages are stored in locale based resource files. There are two resource files:
en.js
: The default English resource file for user interface labels and messages (e.g. fields displayed in a page).messages.properties
: The default English resource file for messages generated by the backend (e.g. an unique constraint violation error).
Changing UI labels
You can create your own en.js
file in your plugin and override the resources you need to change.
To do that, follow below steps
- Open the file
$PLUGIN_HOME/src/main/webapp/app/i18n/en.js
- Suppose we want to change below labelslabels
"Collection Protocols"
=>to "Studies"
"Create Collection Protocol"
=>to "Create Study"
"Title"
=>to "Study Name"
Add
Add below JSON
...
in en.js
file. To know what key values to be overridden, please search en.js
...
of core app by UI labels.
Code Block | ||
---|---|---|
| ||
{
"cp": {
"list": "Studies",
"create_cp_title": "Create Study",
"title": "Study Name"
}
} |
Change
...
API error messages
- Open the file
$PLUGIN_HOME/src/main/resources/errors/messages.properties
- Suppose we want to change below error message
"Collection Protocol with same title {0} already exists."
=>to "Study with same title {0} already exists."
Add below property
...
in messages.properties
file. To know what key values to be overridden, please search messages.properties
...
of core app by messages.
Code Block |
---|
cp_dup_title=Study with same title {0} already exists. |
Creating the plugin
- To create the plugin jarJAR, execute the below commands from
$PLUGIN_HOME
directory :gradle clean; gradle build
- The plugin jar JAR will get created at
${PLUGIN_HOME}/build/libs/os-messages-1.0.0.jar
- Copy create jar and paste into the plugin JAR to OS plugins directory.
- Restart the tomcatTomcat app server.