-
Log in to SkyVault Share:
- Open a web browser and enter the URL: http://localhost:8080/share
- If prompted, log in with the user name admin and password admin.
- Navigate to Data Dictionary > Web Scripts Extensions > org > example.
-
Create a web script description document for your i18n sample:
- In the Create menu, select XML.
- Enter the name for the web script in the Name field: i18n.get.desc.xml
-
Type the following in the content box:
<webscript> <shortname>I18n Sample</shortname> <description>Internationalization Sample</description> <url>/i18n</url> </webscript>
- Click Create.
- Navigate back to the org/example folder using the breadcrumb trail.
-
Create a default message bundle for your i18n sample:
- In the Create menu, select Plain Text.
- Enter the name in the Name field: i18n.get.properties
-
Type the following in the content box:
greeting=Hello farewell=Goodbye
- Click Create.
-
Create a response template for your i18n sample:
- In the Create menu, select Plain Text.
- Enter the name in the Name field: i18n.get.html.ftl
-
Type the following in the content box:
${msg("greeting")}. ${msg("farewell")}
- Click Create.
- Navigate back to org/example using the breadcrumb trail.
-
Register the i18n web script with SkyVault.
- In a web browser tab, enter the URL: http://localhost:8080/alfresco/service/index
- If prompted, log in with the user name admin and password admin.
- Click Refresh Web Scripts. A message indicates there is one additional web script.
-
Test your response template to ensure it is rendering values from the default resource
bundle by type the following in your command line: curl
"http://localhost:8080/alfresco/service/i18n"
The response is: Hello. Goodbye.
Each resource bundle adheres to the naming convention defined by the Web Script Framework, which are structured as follows: <web script id>.<http method>[_<locale>].properties
The <web script id> identifies the web script and must be the same as the web script ID defined in the file name of the associated Web script description document. The <http method> specifies which HTTP method will initiate the web script and must be the same as the associated web script description document.
The optional <locale> identifies the language for which this resource bundle applies. If not specified, the resource bundle is treated as the fallback set of values if no other relevant resource bundle for the required language can be found.
Finally, all resource bundle file names end with .properties. This indicates to the Web Script Framework that the file is a resource bundle.