Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3
-
Upload
kathy-brown -
Category
Technology
-
view
1.906 -
download
0
description
Transcript of Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3
![Page 1: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/1.jpg)
© 2014 IBM Corporation
BP 208: Uno! Deux! Three! Making Localization of XPages Apps as Easy as 1-2-3
Brad Balassaitis, PSC Group Kathy Brown, PSC Group
![Page 2: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/2.jpg)
¿quiénes somos (Who are we?)
▪ Brad Balassaitis – PSC Group, LLC – Blogger, Author, Wordfeud Addict – IBM Champion for IBM Collaboration Solutions – @Balassaitis – xcellerant.net !
▪ Kathy Brown – PSC Group, LLC – Blogger, Author, Runner, Geek, and Loud Laugher – IBM Champion for IBM Collaboration Solutions – @RunningKathy – runningnotes.net
2
![Page 3: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/3.jpg)
Perché Questa Sessione (Why This Session)
▪ The enterprise is global
▪ We will demonstrate: – what is built-in – what is NOT built-in
▪ How to do both
▪ Special considerations, tips, and gotchas
3
![Page 4: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/4.jpg)
As Easy As 1-2-3
▪ 1. Enabling Localization
▪ 2. Using Built-In Localization
▪ 3. Improving Localization
4
![Page 5: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/5.jpg)
5
1. Enabling Localization
![Page 6: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/6.jpg)
Enabling Localization
▪ Enable Localization Support
▪ Generate Localized Resource Bundles
▪ Verify Localization Support
6
![Page 7: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/7.jpg)
7
I. Enable Localization Support
▪ Application Properties > XPages > Localization Options
▪ Select Enable Localization
▪ Add languages (including native language)
▪ Set Source language (development)
▪ Set Default language (display)
![Page 8: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/8.jpg)
8
I. Enable Localization Support
![Page 9: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/9.jpg)
9
Google App Languages
▪ Klingon
!▪ Hacker
!▪ Pirate
!▪ Elmer Fudd
!▪ Bork, Bork, Bork
![Page 10: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/10.jpg)
8
I. Enable Localization Support
![Page 11: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/11.jpg)
11
Region Codes
▪ Allow for regionalized translations of the same language
▪ Example: – en – en_US – en_GB
![Page 12: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/12.jpg)
!12
I. Enable Localization Support
![Page 13: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/13.jpg)
!13
I. Enable Localization Support
![Page 14: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/14.jpg)
14
Region Codes
▪ Allow for regionalized translations of the same language
▪ Example: – en – en_US – en_GB
![Page 15: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/15.jpg)
9
II. Generate Localized Resource Bundles
▪ Clean and Build
▪ Verify via Package Explorer
![Page 16: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/16.jpg)
10
II. Generate Localized Resource Bundles
▪ Optionally verify in Java source – Package Explorer > [db] > local > xsp > pageName.java
▪ Java Source for a Label (Before)
!private UIComponent createLabel1(FacesContext context, UIComponent parent, PageExpressionEvaluator evaluator) {
XspOutputLabel result = new XspOutputLabel();
result.setValue("Front End ");
setId(result, "label1");
return result;
}
![Page 17: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/17.jpg)
11
II. Generate Localized Resource Bundles
▪ Java Source for a Label (After)
!private UIComponent createLabel1(FacesContext context, UIComponent parent, PageExpressionEvaluator evaluator) {
XspOutputLabel result = new XspOutputLabel();
result.setValue(_currentLocale[55]);
setId(result, "label1");
return result;
}
![Page 18: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/18.jpg)
12
III. Verify Localization Support
▪ Set the browser to different supported languages and look for default translations
![Page 19: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/19.jpg)
13
2. Using Built-In Localization
![Page 20: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/20.jpg)
Using Built-In Localization
▪ Built-In Features
▪ Resource Bundles
▪ Translating – Export Resource Bundles – Send Resource Bundles for Translation – Import Translations – Test Supported Languages
▪ Specifying the Browser Language
14
![Page 21: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/21.jpg)
15
I. Built-In Features
▪ Sets up many properties for translation – Static Text
• Field Labels, View Column Titles, Hard-Coded String Properties (Default Values) – Hard-coded keyword lists
• Comboboxes, Listboxes, Radio Buttons, Checkboxes – Hard-coded Text on Page
• Caveat: No component ID • Properties file key is based on position and can change
– Hard-coded Validation Messages
▪ Automatically loads locale-specific resource bundles
Tip! Make IDs descriptive so translators know what they are translating
![Page 22: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/22.jpg)
16
I. Built-In Features
!▪ Demo!
![Page 23: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/23.jpg)
17
I. Built-In Features
▪ Some localization is performed even without enabling localization application-wide – Date and Number formats – Currency symbols – Standard component label strings
• File Download control headers, default error messages – Dojo translations
![Page 24: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/24.jpg)
18
I. Built-In Features
▪ Locale class – getCountry() – getDecimalSeparator() – getDefault() – getDisplayCountry() – getDisplayLanguage()
▪ TimeZone class – getDefault() – getDisplayName() – inDaylightTime()
▪ Create new Locale or TimeZone object from XSP context – context.getLocale().getDecimalSeparator() – context.getTimeZone().getDisplayName()
![Page 25: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/25.jpg)
19
I. Built-In Features
▪ Programmatically Change Session Locale – This overrides browser language setting for the current session !– context.setLocaleString(‘de’) – context.reloadPage()
![Page 26: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/26.jpg)
22
I. Built-In Features
▪ Property: Merge source file changes into property files – Automatically updates properties files with additions, changes, or removals to XPage/CC – Add: will be added to all resource bundles and will get the default translation (with the
language prefix) – Remove: will remove it from the properties files – Modify: get a default translation for it and the original translation will move to the top of the
file and be commented out • If the default translation was still in place, it would be updated
![Page 27: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/27.jpg)
23
I. Built-In Features
▪ In Notes9, you can specify the Character set for the properties file – In 8.x you were limited to ASCII and Unicode escape sequences
![Page 28: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/28.jpg)
20
II. Resource Bundles
▪ Plain text file with a .properties extension
▪ Filename format: filename_locale.properties – Ex: MyProperties_fr.properties
▪ When localization is enabled, locale-specific copies of properties files are created for each created for each XPage and custom control
![Page 29: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/29.jpg)
21
II. Resource Bundles
▪ Consist of key-value pairs and comments – key=value
• formRow1/@label=[de| Name ] • label3/@value=[de| Status\: ]
– Comment lines start with # – Blank lines are ignored
![Page 30: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/30.jpg)
24
III. Translation
▪ Translate files in DDE or export to send to translators
▪ Sending files for translation – Export resource bundles – Send for translation – Import resource bundles – Test
![Page 31: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/31.jpg)
25
1. Export Resource Bundles
▪ Right-click on DB in Package Explorer and select Export
▪ General > File System
![Page 32: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/32.jpg)
26
1. Export Resource Bundles
▪ Select Create directory structure for files
▪ Click Filter Types… and select *.properties
![Page 33: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/33.jpg)
27
1. Export Resource Bundles
▪ Deselect Unnecessary Files – Mastering XPages suggests deselecting the following files, since they don’t need to be
translated: • <root>\build.properties • AppProperties\database.properties • AppProperties\xspdesign.properties • WebContent\WEB-INF\xsp.properties
▪ Click Finish
![Page 34: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/34.jpg)
28
1. Export Resource Bundles
▪ Check exported files – Look for properties files for old/unused design elements
![Page 35: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/35.jpg)
29
2. Send Resource Bundles for Translation
▪ Send files for each language to each translator
![Page 36: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/36.jpg)
30
3. Import Translations
▪ Ensure that files are in same directory structure as exported
▪ Right click on application in Package Explorer and select Import
▪ Select General > File System
▪ Select directory with the app name – Ex: Do not select C:\My Translations – Ex: Select C:\My Translations\Localization_OneUI_Connect2014.nsf
▪ Click Select All button
▪ Click Finish
▪ Click Yes to All when prompted to overwrite existing files
![Page 37: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/37.jpg)
31
4. Test Supported Languages
▪ Change browser language to test each supported language
![Page 38: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/38.jpg)
32
IV. Specifying the Browser Language
▪ *Application display language is determined based on browser settings – Setting the XSP locale directly will override the browser language setting !
▪ Rules – If the application supports the first browser language, then that’s what will display – If not, then it checks the next browser language and so on until there’s a match – If the application does not support any browser languages, it displays in the default – If there is not a match for a specific regional setting, it will roll up to the local
• Ex: en_US and en_GB would both roll up to en if that’s what the language supports
![Page 39: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/39.jpg)
33
IV. Specifying the Browser Language
▪ IE Language Settings – Internet Options > General tab > Languages
![Page 40: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/40.jpg)
34
IV. Specifying the Browser Language
▪ Firefox Language Settings – Options > Content tab – Languages section > “Choose…” button
![Page 41: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/41.jpg)
35
IV. Specifying the Browser Language
▪ Chrome Language Settings – Settings > Show advanced settings – Languages > Language and Input Settings… – Page display language can be different from browser configuration language!
![Page 42: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/42.jpg)
35
IV. Specifying the Notes Browser Language
▪ File > Preferences > Regional Settings – Select the language from Regional Profile – Click OK – A prompt will inform you to restart the program
![Page 43: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/43.jpg)
36
3. Improving Localization
![Page 44: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/44.jpg)
Improving Localization
▪ What XPages Localization Does Not Translate
▪ Approach
▪ Implementation
37
![Page 45: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/45.jpg)
38
I. What XPages Localization Does Not Translate
▪ Computed values – Labels, link/button titles, menu options, application layout tabs/module title
▪ Programmatic messages – Form-level messages – Popup help text – E-mail text – Field validation messages raised by code
▪ List Fields with computed values – Comboboxes, Listboxes, Radio Buttons, Checkboxes
![Page 46: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/46.jpg)
39
I. What XPages Localization Does Not Translate
▪ Demo!
![Page 47: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/47.jpg)
40
I. What XPages Localization Does Not Translate
![Page 48: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/48.jpg)
41
II. Approach
▪ Create another Resource Bundle (properties file) with all additional translations
▪ Manually create a copy of the Resource Bundle with each supported locale code suffix
▪ Create a script library with functions to use the Resource Bundle 1. Retrieve/cache the custom resource bundle 2. Retrieve a translated string value 3. Retrieve a translated keyword list (edit mode) 4. Retrieve a translated keyword value (read mode)
![Page 49: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/49.jpg)
42
III. Retrieving a Custom Resource Bundle
▪ Logic – Check for properties in a sessionScope variable – If not found, retrieve properties and store in sessionScope – Return a handle to the properties HashMap
▪ Full function available in Mastering XPages Book (pg 640-641)
▪ Example
getTranslations();
![Page 50: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/50.jpg)
43
III. Retrieving a Custom Resource Bundle
▪ Magic!
!var resource = new com.ibm.xsp.resource.BundleResource(); resource.src = "/MyTranslations.properties"; resource.component = view; keys = resource.contents;
![Page 51: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/51.jpg)
44
IV. Translating Computed Values
▪ Computed labels, links, menu titles, etc must be localized
▪ Any code that returns a message to display to the user must be localized
▪ Call a function and pass it the name of a key and it will return the translated value !function getTranslatedString(key) { return getTranslations()[key]; }
▪ Example !getTranslatedString(“ErrorMessage”)
Tip! Put the code in a try-catch block to prevent errors
![Page 52: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/52.jpg)
52
Improving Localization
▪ Sample errors when a key is not found in the resource bundle – Better to trap for this ahead of time
![Page 53: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/53.jpg)
53
Improving Localization
▪ Sample errors when a key is not found in the resource bundle – Better to trap for this ahead of time
![Page 54: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/54.jpg)
45
IV. Translating Computed Values
▪ Parameterized Messages – Greeting that includes the user’s name – Error message that includes error count
▪ I18n.format() – Add placeholders to value in properties file – Properties File: !
ErrorMessage=Uh oh, {0}, there are {1} errors! !– SSJS: !
var msg = getTranslations()[‘ErrorMessage’]; return I18n.format(msg, session.getCommonUserName(), numErrors);
![Page 55: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/55.jpg)
47
V. Translating Keyword Lists
▪ Critically Important – Documents are classified on predefined status or type values – Views are generally filtered or categorized on keyword values – Charts are based on keywords
![Page 56: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/56.jpg)
48
V. Translating Keyword Lists
▪ Best Practice: Aliased Keyword Lists in Resource Bundle – Store the alias in the field and display the translated value in the current language – Aliasing allows for filtering and categorization in any language
▪ Resource Bundle Example – # My Form Keywords – Division=1_Division A|^|2_Division B|^|3_Division C|^|4_Division D – Status=1_New|^|2_Current|^|3_Expiring|^|4_Late !
▪ Tips! – Consistent pattern for alias – Don’t use comma (,) as a separator – No spaces around equals sign (=) or between options
![Page 57: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/57.jpg)
49
V. Translating Keyword Lists
▪ Create SSJS function to retrieve aliased keyword list: – Retrieve the specified property value – Parse the options, based on the alias and separator – Return array of aliased keywords
▪ Example
getKeywordList(“Status”);
▪ Code snippet … var intPosition = thisOption.indexOf("_"); // Process each option to reformat as [DisplayOption]|[Alias] var alias = thisOption.substring(0, intPosition); var display = thisOption.substring(intPosition + 1); listOptions[i+1] = display + "|" + alias; …
![Page 58: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/58.jpg)
50
VI. Displaying Selected Keyword in Read Mode
▪ Create SSJS function to display a keyword value in read mode – Use string parsing to retrieve keyword list and get translated value based on alias – Used for views, charts, etc.
getKeywordDisplay(key, alias);
▪ Example !getKeywordDisplay(“Status”, “1”);
![Page 59: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/59.jpg)
46
IV. Translating Computed Values
▪ Tip! Only define common sets of choices one time – Examples:
• Yes, No, Maybe, N/A • Strongly Disagree, Disagree, Neutral, Agree, Strongly Agree
![Page 60: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/60.jpg)
51
Improving Localization
▪ Demo!
![Page 61: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/61.jpg)
54
Additional Considerations
![Page 62: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/62.jpg)
56
Additional Considerations
▪ What we’re not translating – User-entered text
• We’re managing controlled sets of values – Proper nouns
• Names, locations, etc
![Page 63: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/63.jpg)
57
Additional Considerations
▪ Numeric default values in text fields – A default of 0 would be translated – Compute the value as: return ‘0’
▪ Text within pass-through HTML tags in page source – Tags are untouched, but text within them is set up for translation
• Problematic with <script> tags – use Output Script controls instead
![Page 64: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/64.jpg)
55
Additional Considerations
▪ Currency symbol will be automatically modified based on the locale
▪ Override by computing currency codes and symbols – They can only be computed on page load – they cannot be refreshed dynamically
• Cannot work in a view display on a per-document basis – If both are set, symbol overrides code
![Page 65: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/65.jpg)
58
Additional Considerations
▪ Client-Side JavaScript – Client JS within an <xp:> tag can use EL syntax !
"#{javascript:return getKeywordDisplay('Status', '1');}“ !– If you need a translated value outside of <xp:>, use SSJS to write out client-side JS vars
▪ Scheduled LotusScript agents – Cannot read properties files
![Page 66: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/66.jpg)
59
Additional Considerations
▪ Search – Full-text search will not work as expected – keyword values are all stored as aliases – Solution: Set up translated drop-down lists for filtering
• Programmatically build search string looking for the selected alias in the field • Notify users that full-text search will work only on plain text fields
▪ Beyond Your Control – “Browse” button in File Upload control from Extension Library
• Does not get automatically translated by browser and does not have a parameter to programmatically translate
• Hacktastic
![Page 67: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/67.jpg)
59
Additional Considerations
▪ Tip! Build the application with localization in mind, but do not send files for translation until design is stable
![Page 68: Uno! Deux! Three! Making Localization of XPages as Easy as 1-2-3](https://reader033.fdocuments.us/reader033/viewer/2022052321/5484260e5906b5ad158b4726/html5/thumbnails/68.jpg)
▪ Access Connect Online to complete your session surveys using any: – Web or mobile browser – Connect Online kiosk onsite
!68