Introduction
This document describes the steps to create a plugin to change the labels in UI and error messages. This guide is intended for developers or technical IT staff.
Steps
- Download the sample plugin.
- Extract the downloaded plugin zip into a directory. Lets say $PLUGIN_HOME to exploded directory.
- Change UI labels :- We need to add key and value of the labels into
en.js
file. It will override the default labels specified in OpenSpecimen. Follow below steps- Open the file
$PLUGIN_HOME/src/main/webapp/app/i18n/en.js
- Suppose we want to change below labels to
"Collection Protocols" to "Studies"
"Create Collection Protocol" to "Create Study"
"Title" to "Study Name"
Add below JSON into opened
en.js
file. For keys of the values search inen.js
file of the OS code with existing name.{ "cp": { "list": "Studies", "create_cp_title": "Create Study", "title": "Study Name" } }
- Open the file
- Change server error messages :- We need to change the messages specified in messages.properties file. It will override the default messages specified in OpenSpecimen.
- 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." => "Study with same title {0} already exists."
Add below property in opened
messages.properties
file. For keys of the messages search inmessages.properties
file of the OS code with existing message.cp_dup_title=Study with same title {0} already exists.
- Open the file
- To create the plugin jar, execute the below commands from
$PLUGIN_HOME
directory :gradle clean; gradle build
- The plugin jar will get created at
${PLUGIN_HOME}/build/libs/os-messages-1.0.0.jar
- Copy create jar and paste into plugins directory
- Restart the tomcat.