You can import pages according to the locale of a user by using a Localized Resource builder call in conjunction with the Localization
inputs in the Imported Page builder call.
The URL to the pages consists of the Import Page builder call's Localized Base URL + Locale Key in the Localized Resource builder call + the Page to Import value in the Imported Page builder call.
You can use this construction to import localized pages based on a directory name or part or all of a file name.
To import pages based on the user's locale into the web application:
- Create the directory structure and the localized files that you want to import into a web application.
Keep in mind that the directory structure or file names should be differentiated by the possible values of the Locale Key in the Localized Resource builder call. The imported page inserts the value of the Locale Key between the Localized Base URL and the Page to Import values to build the URL to the page to import.
Pages differentiated by locale-specific directory
/pages/spanish/index.htmPages differentiated by locale-specific file name
The differentiator in the path names is the locale key.
- Add Localized Resource builder call and specify the default value for the Locale Key input.
- Profile-Enable this input (click the button) and create a profile set (or use the default). button) and create a profile set (or use the default).
- Create a profile for each locale.
- Specify a value for the Locale Key entry.
This locale key will be used to determine the path to an imported page.
For example, for the directory and file names used in the example in Step 1, you can create a profile set called "Language" and create three profiles named "Spanish", "Russian", and "Japanese", with a value for the LocaleKey entry being "spanish", "russian", and "japanese", respectively.
- Add an Import Page builder call for each page of which you want to import a localized version. Specify the following inputs to the Imported Page builder.
Enable this checkbox.Localize URL Base
Enter the path from the servable content root directory down to the portion of the URL defined by the Locale Key. For example, "pages/"Page to Import
Enter the remaining portion of the URL to the file. For example, "_imported.htm"
As a result of these input settings, the URL to the imported page will be: page/LocaleKeyValue
_imported.htm, where LocaleKeyValue
is defined by the profile determined by the browser's locale setting.
Parent topic: Localizing applications