Once you have created and registered your web script, you can add additional resource
bundles for other languages.
This task adds another resource bundle for the German language.
-
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.
- Click on the Repository link on the Share header.
- Navigate to Data Dictionary > Web Scripts Extensions > org > example.
-
Create a German resource bundle for your i18n sample:
- In the Create menu, select Plain Text.
- Enter the name for the web script in the Name field: i18n.get_de.properties
-
Type the following in the content box:
greeting=Guten Tag farewell=Auf Wiedersehen
- Click Create.
- Navigate back to the org/example folder using the breadcrumb trail.
-
Re-register the i18n web script with SkyVault Content Services.
- In a web browser, 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.
This time you have created a resource bundle for the German language as identified by the locale of de. Locales are specified as follows: <language>[_<country>][_<variant>]
The language argument is a valid ISO language code, which is a lowercase, two-letter code as defined by ISO-639. The optional country argument is a valid ISO country code, which is an uppercase, two-letter code as defined by ISO-3166. Finally, the optional variant argument is a vendor-or web browser–specific code.
-
Test your response template to ensure it is rendering values from the German resource
bundle by typing the following in your command line: curl -H "Accept-Language: de"
"http://localhost:8080/alfresco/service/i18n"
The response is: Guten Tag. Auf Wiedersehen.
A client specifies its preferred language through the HTTP header named
Accept-Language, to which the Web Script Framework adheres.