The message bundle file in the UI layer
Not Yet Updated for v5.0
The documentation on this page has NOT yet been updated to describe what's changed in the v5.0 release of CollectionSpace.
This document introduces the message bundle file in CollectionSpace's User Interface (UI) layer.
It also describes how you can change text appearing on many of CollectionSpace's pages by editing the contents of an overlay message bundle file, within the tenant folder for your museum.
Contents
About the message bundle file
The message bundle file in CollectionSpace's UI layer contains multiple lines of text. Each line contains a different text label whose value you can change, which will in turn change the text displayed in a specific place or places on CollectionSpace's web pages.
Within the source code tree for CollectionSpace's UI layer, in a folder named ui
, you can find the default message bundle file in src/main/webapp/defaults/bundle/core-messages.properties
. This file contains an extensive set of text labels, which are inserted into designated places within HTML templates when CollectionSpace's web pages are displayed in a browser.
You can override the values of any of those default text labels, or add new ones to supplement them, by editing an overlay message bundle file, bundle/core-messages.properties-overlay
, inside the tenant folder for your museum. (See Finding your tenant folder.)
If that bundle
folder or the core-messages.properties-overlay
file don't already exist in your tenant folder, you can create either or both, as needed. You can initially create the core-messages.properties-overlay
as an empty file, using your favorite text editor.
Format of each line in the message bundle file
The format of each line in the message bundle file consists of a property and a text label, separated by a colon (":") and a space character:
property: text label
The format of that property
, in turn, consists of page name (for a web page, dialog, etc.) followed by an item name specifying some specific text item (such as a field label or header) that will be displayed on that page's HTML template. These are separated by a hyphen ("-"): pagename-itemname
For instance, the label that appears next to the Current Owner
field on the Intake
procedure page is configured via the following line in the default message bundle file:
By copying that line to your tenant's overlay message bundle file, and editing it there, you can change the value of that text label as it will appear on one or more HTML pages in CollectionSpace.
If you want to keep some (or even nearly all) of the default text labels "as is," simply don't include their text labels in your tenant's core-messages.properties-overlay
file. Your tenant's file can be "sparse," nearly empty, containing only the changes you want to make from the defaults.
To delete (aka empty or blank out) a text label, add the relevant property to your tenant's core-messages.properties-overlay
file, but give it an empty value (i.e. nothing after the colon (':') separator), like this:
Identifying which text label to change in the message bundle file
To identify which text label you need to change in your overlay message bundle file in your tenant folder, to change some text displayed in a specific place or places on CollectionSpace's web pages:
- Start by scanning the section of the message bundle file that contains text labels for the page (or dialog, etc.) on which you want to change some text, to see if you can readily spot the right label to change. For instance:
- Text labels beginning with
acquisition-
pertain to the Acquisition record page. - Text labels beginning with
login-
pertain to the login ("Sign In") page.
- Text labels beginning with
Often, by merely scanning those labels, you can find the appropriate text label to change. If that doesn't help, try one of the following techniques:
- Log into a CollectionSpace system.
- Open your browser's web developer tool.
- Right click on a piece of text on any of CollectionSpace's pages, and select the
Inspect Element
choice, or any similar choice, from the menu. (In some developer tools, you can also use a "magnifying glass" or "inspector" tool for this purpose, and just directly click on the item you wish to inspect.) That will display the HTML markup surrounding that text. In that markup, you may be able to identify a relevantclass=""
attribute, whose text should look a whole lot like that of the text label you want to change. Examples:- An item of text on the Acquisition page, whose
class=""
attribute iscsc-acquisition-acquisitionNote-label
, is associated with the text labelacquisition-acquisitionNoteLabel
in the default message bundle file. - An item of text on the login ("Sign In") page, whose
class=""
attribute iscsc-login-rologin
, is associated with the text labellogin-rologin
in the default message bundle file.
- An item of text on the Acquisition page, whose
For instance, using Firefox's Tools->Web Developer...->Inspector tool:
OR
- Inside the folder for the UI source code tree, open the appropriate HTML template file in a text editor, and search for the relevant
class=""
attribute that appears to match the text that you want to change. Most of the locations in CollectionSpace's HTML templates, that text is inserted from text labels in message bundle files, will have aclass=""
attribute beginning withcsc
.- You can find these HTML templates inside the
ui
folder that contains the UI layer source code tree, the withinsrc/main/webapp/defaults/html
folder and its sub-folders.
- You can find these HTML templates inside the
Text labels for fields
There's a specific pattern that can help you find and change the text label that is displayed next to a field. (You should also follow this pattern if you've added a new field, and want to create a brand new text label for it.)
In CollectionSpace's HTML templates, the tag for the label next to a field will have a class=""
attribute beginning with csc
, of the form:
csc-{recordid}-{fieldid}-label
In a message bundle file, the corresponding text label for that field should then typically be of the form:
{recordid}-{fieldid}Label: value for that label goes here
with the csc-
prefix removed from the beginning and, in the fieldid
, with all hyphens removed and words run together in camelCase. (Following those rules, -label
also gets converted to Label
at the end.)
An example might help make this clear: in the HTML template file for the Acquisition record, AcquisitionTemplate.html
, the Acquisition Note field has two tags: one for its text label - the name that appears above the field - and the other for the field itself:
<div class="info-pair"> <div class="header"> <!-- This is the tag for the label that appears above the field --> <div class="label csc-acquisition-acquisitionNote-label"></div> </div> <div class="content"> <!-- This is the tag for the field itself --> <textarea rows="4" cols="30" class="input-textarea csc-acquisition-acquisition-note" /> </div> </div>
In the message bundle file, the text label that corresponds to the first of those tags, <div class="label csc-acquisition-acquisitionNote-label">
, is:
# Corresponds to the class csc-acquisition-acquisitionNote-label in the HTML template acquisition-acquisitionNoteLabel: Acquisition Note
Changing a text label in a message bundle file
This step-by-step example helps explain how to change text labels:
To change the text that appears next to the Current Owner
field on the Intake
procedure page to simply Owner
, you will copy the appropriate line from the default message bundle file into the overlay message bundle file for your own tenant (museum), and then change its value:
- In a text editor, open the default message bundle file,
src/main/webapp/defaults/bundle/core-messages.properties
- Copy the following line from that file to the Clipboard, containing the text label that supplies that text:
intake-currentOwnerLabel: Current Owner
- In a text editor, open the message bundle file for your tenant (museum),
src/main/webapp/tenants/{your tenant folder}/bundle/core-messages.properties-overlay
. (You can create that file - and thebundle
folder that contains it - if either or both don't already exist.) - Paste in the line from the Clipboard into the
core-messages.properties-overlay
file. - Modify the value of that text label to
Owner
:intake-currentOwnerLabel: Owner
- Save the modified file.
Copying your changes to the CollectionSpace server
(Or instead see Configuring CollectionSpace's User Interface (UI) Layer - An Overview.)