-
Log in to SkyVault Explorer:
- Open a web browser and enter the URL: http://localhost:8080/SkyVault
- If prompted, log in with the user name admin and password admin.
- Navigate to Company Home > Data Dictionary > Web Scripts Extensions.
-
Create a folder to represent the top-level package structure (skip this step if the
org space already exists):
- In the Create menu, click Create Space.
- Enter the name for the folder in the Name field, such as: org
- Click Create Space.
-
Create a sub-package (skip this step if the example space already
exists):
- Navigate to Company Home > Data Dictionary > Web Scripts Extensions > org.
- In the Create menu, click Create Space.
- Enter the name for the folder in the Name field, such as: example
- Navigate to Company Home > Data Dictionary > Web Scripts Extensions > org > example.
-
Create a web script description document for your I18N sample:
- In the Create menu, click Create Content.
- Enter the name for the web script in the Name field as: i18n.get.desc.xml
- In the Content Type list, select XML.
- Click Next.
-
Type the following in the Enter Content box:
<webscript> <shortname>I18N Sample</shortname> <description>Internationalization Sample</description> <url>/i18n</url> </webscript>
- Click Next, click Finish, and then click OK.
-
Create a default message bundle for your I18N sample:
- In the Create menu, click Create Content.
- Enter the name in the Name field, such as: i18n.get.properties
- In the Content Type list, select Plain Text.
- Click Next.
-
Type the following in the Enter Content box:
greeting=Hello farewell=Goodbye
- Click Next, click Finish, and then click OK.
-
Create a response template for your I18N sample:
- In the Create menu, click Create Content.
- Enter the name in the Name field, such as: i18n.get.html.ftl
- In the Content Type list, select Plain Text.
- Click Next.
-
Type the following in the Enter Content box:
${msg("greeting")}. ${msg("farewell")}
- Click Next, click Finish, and then click OK.
-
Register the I18N web script with SkyVault.
- In a web browser, enter the URL: http://localhost:8080/alfresco/s/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.