Localizing Pages - Alfresco Content Services - 23.4 - 23.4 - Ready - Alfresco - external

Alfresco Content Services

Platform
Alfresco
Product
Alfresco Content Services
Release
23.4
License

You can provide i18n properties files with the same prefix that can then be accessed in the JavaScript controller by calling:

msg.get("<key>")

It is also possible to achieve this by calling from the FreeMarker template:

${msg(“<key>”)}

Traditionally, Share would pass all of the messages from a web script into the widgets that it instantiated by calling its .setMessages() function.

There are global properties files that can be used throughout Share. These are common.properties and slingshot.properties that can be found in /share/WEB-INF/classes/alfresco/messages.

The contents of all of these files will be active on the page by using the JavaScript global variable Alfresco.messages. This is a map with the attributes, global and scope:

  • global contains all the messages from the global properties files
  • scope is a map of widget name to messages map

The .setMessages() function of Share widgets adds its own name as a key into the scope map and assigns all the supplied messages as an object against that key. For example, if the Alfresco.DocumentList widget is instantiated then Alfresco.messages.scope['Alfresco.DocumentList'] can be used to access its messages.