Localizing Brightspot
You can customize Brightspot’s widgets and content edit forms so that editors see the UI in their preferred language. Localizing Brightspot is similar to that for other Java-based web applications.
To localize widgets:
- Clone or download a new copy of the Brightspot repository.
- Open your existing Brightspot project in a file manager.
From the cloned repository, recursively copy all files
*Default_xx.properties
in the directorydb/src/main/resources
to your Brightspot project directorysrc/main/
(so that the directoryresources/
appears undermain/
).- Retain the directory structure for the copied files.
- Example:
cp resources/com/psddev/cms/tool/widget/BulkUploadWidgetDefault_en.properties src/main/resources/com/psddev/cms/tool/widget/BulkUploadWidgetDefault_en.properties
NoteIn addition to the English-language property files*Default_en.properties
, the cloned repository may also provide property files for other languages such as Spanish (*Default_es.properties
). If your target language is included, go to step 6.If Brightspot does not provide the property files for your target language, rename each
*Default_en.properties
to*Default_xx.properties
.- The two letters before
.properties
must be a language code that Java recognizes. For a list of two-letter language codes, see List of ISO 639-1 codes. - Example:
mv BulkUploadWidgetDefault_en.properties BulkUploadWidgetDefault_fr.properties
- The two letters before
- For each of the resource files, provide localized strings.
# Localization for the Upload widgettitle=Transfert Groupé message.noTypes=Il n'y a pas de types de contenu qui peuvent être transfert groupé.
- Rebuild your Brightspot project.
Users who change their Locale setting in Admin > Users & Roles see the localized text in Brightspot.
You can localize the field and tab labels in content edit forms. The following screen shots show the content edit form after localizing an Article model into Spanish.
Localization of content edit forms is achieved with properties files, where keys for fields and tabs are set with language-specific strings.
To create a localized properties file for a model:
- Change to or create the
resources/
directory for your Brightspot project. This directory is in the standard position for Maven projects,src/main/resources/
, although your Brightspot project may have a differentresources/
directory if your project includes themes. - Change to or create the subdirectory corresponding to the required model. For example, if you are localizing the content edit form for articles, change to or create the subdirectory
article/
. - Create the file
<ContentType>Default.properties_xx
. For example, the fileArticleDefault_es.properties
localizes the article model into Spanish. In the properties file, add lines that specify the localized names of fields and tabs, using the following forms:
field.<fieldname>=<localname>
andtab.<tabname>=<localname>
.The following example shows localization of an
Article
model into Spanish.# Localization for Article Content Edit Form field.headline=Titular field.leadImage=Imagen de Plomo field.body=Texto del Cuerpo tab.Main=Principal tab.Overrides=Anulaciones tab.Push\ Notification=Notificación
-
Localizes names of fields defined in the Article model.
-
Localizes names of the default tabs that Brightspot provides for content edit forms. If a tab name has more than one word, such as
Push Notification
, the spaces between words need to be escaped.
If you add custom tabs to a model via @ToolUi.Tab, they can also be localized by adding their names to the properties file.
-
- Reload or rebuild your Brightspot project.
Users who change their Locale setting in Admin > Users & Roles see the localized text in Brightspot.