Changes for page Development-Localization and Internationalization
Last modified by Pascal Robert on 2015/05/04 04:24
From version 49.1
edited by David LeBer
on 2010/06/29 16:12
on 2010/06/29 16:12
Change comment:
Edited the User Info image to show ERXLanguages as an array rather than a string
To version 52.1
edited by Johann Werner
on 2010/12/03 08:10
on 2010/12/03 08:10
Change comment:
There is no comment for this version
Summary
-
Page properties (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - Web Applications-Development-Localization and Internationalization1 +Development-Localization and Internationalization - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. dleber1 +XWiki.jw - Content
-
... ... @@ -138,10 +138,14 @@ 138 138 139 139 ===== Localized EOAttributes ===== 140 140 141 -In Wonder, it is also possible to localize attributes. There are two requisites:141 +In Wonder, it is also possible to localize attributes. Let's say we have an entity //Blog// with an attribute //content// that we want to localize. This will be realized by not creating a column //content// in the database but a column for each specified language we want i.e. //content//en//, //content//fr//, ... 142 142 143 -Fir st add ERXLanguages toyourPropertiesfile:143 +To tell EOF that we want a specific attribute localized you have to add a key ERXLanguages to its user info. 144 144 145 +[[image:ERXLocalizerUserInfo_correct.png||border="1"]] 146 + 147 +In this example we set the type to //Array// and add an item for each needed language setting its value to the language code. This must be done for each attribute in our model we want to localize. If you have many localized attributes that have the very same list of languages and you will likely be changing that list in the future you can define your language list either for a whole model or for all models instead. The first way to specify a per model language list is to put an ERXLanguages key into the user info of the model. For a global setting put that key into your property file: 148 + 145 145 {{noformat}} 146 146 147 147 ERXLanguages = (en,jp,fr_ca) ... ... @@ -148,9 +148,12 @@ 148 148 149 149 {{/noformat}} 150 150 151 - Then,for theattributeyou'dlike to localize,addthe ERXLanguageskeyto theUserInfo for that specific attribute:155 +All attributes that should use those global settings must have a key //ERXLanguages// in their user info with a type **different** to //Array//. Its value can be anything as only the presence of the key is of importance. The order that the languages are applied to an attribute is: 152 152 153 -[[image:ERXLocalizerUserInfo_correct.png||border="1"]] 157 +* attribute user info with an array for ERXLanguages 158 +* if type of found user info is not an array then get array from key ERXLanguages from user info of the model 159 +* if user info of the model has no key ERXLanguages look for a property ERXLanguages in your property files 160 +* if no property ERXLanguages is found ignore localization 154 154 155 155 ===== Direct Actions ===== 156 156 ... ... @@ -173,7 +173,7 @@ 173 173 174 174 That should give the user their browser's default language setting instead of your server's default language setting until a session is created. 175 175 176 -[[^LocalizerTest.zip]] is an example application demonstrating the sessionless use of the localizer with localized strings and localized components, storing the language state in a cookie. 183 +[[Development-Localization and Internationalization^LocalizerTest.zip]] is an example application demonstrating the sessionless use of the localizer with localized strings and localized components, storing the language state in a cookie. 177 177 178 178 ===== Database setup ===== 179 179 ... ... @@ -182,3 +182,7 @@ 182 182 jdbc:mysql:~/~/localhost/mydatabase?capitalizeTypenames=true&zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8 183 183 184 184 The database itself is set to default to "UTF8" encoding. (No hyphen in UTF8 for MySQL) You can set that in the "Options" pane of MySQL Administrator.app under the "Advanced" popup menu item in the "Def. char set" field. Of course, you'll need to use the correct database types too, meaning don't use a blob for text storage. Use varchar and longtext (varcharLarge is the name of the Wonder prototype) instead. 192 + 193 +===== Localization presentation from WOWODC West 2009 ===== 194 + 195 +Guido Neitzer did a localization presentation at WOWODC West 2009 that give a good overview of how to localize your apps. The presentation is available [[here>>http://www.wocommunity.org/podcasts/wowodc/west09/WOWODCW09-Localization.mov]].