Last modified by Pascal Robert on 2015/05/04 04:24

From version 46.1
edited by Pascal Robert
on 2010/09/19 11:14
Change comment: There is no comment for this version
To version 56.1
edited by David Holt
on 2011/06/10 19:20
Change comment: Moved latest addition to the "properties" section

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.probert
1 +XWiki.dholt
Content
... ... @@ -64,13 +64,13 @@
64 64  
65 65  {{/code}}
66 66  
67 -To make WOFileUpload components working I also had to add the launch parameter WOUseLegacyMultipartParser true to my application. This launch parameter forces the parsing of all form values, the first time WORequest.formValues is called. See the [[apple developer documentation>>http://developer.apple.com/documentation/WebObjects/Reference/api/com/webobjects/appserver/WORequest.html]] for additional information. Without WOUseLegacyMultipartParser true I had serious problems in my applications using a WOFileUpload component because the bindings //data// and //filePath// have been emptied after a form POST.
67 +To make WOFileUpload components working I also had to add the launch parameter WOUseLegacyMultipartParser true to my application. This launch parameter forces the parsing of all form values, the first time WORequest.formValues is called. See the [[apple developer documentation>>http://webobjects.mdimension.com/javadoc/WebObjects/5.4.2/com/webobjects/appserver/WORequest.html]] for additional information. Without WOUseLegacyMultipartParser true I had serious problems in my applications using a WOFileUpload component because the bindings //data// and //filePath// have been emptied after a form POST.
68 68  
69 69  With Jesse's code and this extension, you will be able to handle UTF-8 character data correctly in your WO application.
70 70  
71 71  If you use localized strings in your UTF-8 application you may also check out Project Wonder's [[ERXLocalizer>>WOnder-ERXLocalizer]] class.
72 72  
73 -=== Project Localization tips [[~~ramsey]] ===
73 +=== Project Localization tips ===
74 74  
75 75  The following are some tips and suggestions for localizing a project in WOLips using Project Wonder.
76 76  
... ... @@ -103,8 +103,13 @@
103 103  
104 104  {{/noformat}}
105 105  
106 -The other changes are then in the er.extensions.ERXLocalizer.availableLanguages and ERXLanguages:
106 +{{color value="#333333"}}
107 +The other changes are then in the er.extensions.ERXLocalizer.availableLanguages and ERXLanguages:
108 +{{/color}}
109 +
110 +{{color value="#333333"}}
107 107  In the above case after adding canadian french these would change in:
112 +{{/color}}
108 108  
109 109  {{noformat}}
110 110  
... ... @@ -112,6 +112,16 @@
112 112  
113 113  {{/noformat}}
114 114  
120 +{{color value="#333333"}}
121 +Localized formatters use this property:
122 +{{/color}}
123 +
124 +{{noformat}}
125 +
126 +er.extensions.ERXLocalizer.useLocalizedFormatters=false
127 +
128 +{{/noformat}}
129 +
115 115  ===== Localized strings and components =====
116 116  
117 117  For each language available, you will need a corresponding Localizable.strings file. This file should be located in Projects->Resources->"Lang".lproj directory. In these directories, you'll store localized resources such as Localizable.strings files and localized components. So, continuing with the above example, you should create two new Localizable.strings files in the following places in your project directory:
... ... @@ -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:
156 +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 -First add ERXLanguages to your Properties file:
158 +To tell EOF that we want a specific attribute localized you have to add a key ERXLanguages to its user info.
144 144  
160 +[[image:ERXLocalizerUserInfo_correct.png||border="1"]]
161 +
162 +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:
163 +
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 the attribute you'd like to localize, add the ERXLanguages key to the UserInfo for that specific attribute:
170 +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"]]
172 +* attribute user info with an array for ERXLanguages
173 +* if type of found user info is not an array then get array from key ERXLanguages from user info of the model
174 +* if user info of the model has no key ERXLanguages look for a property ERXLanguages in your property files
175 +* if no property ERXLanguages is found ignore localization
154 154  
155 155  ===== Direct Actions =====
156 156  
... ... @@ -158,7 +158,7 @@
158 158  
159 159  {{code}}
160 160  
161 - @Override
183 +@Override
162 162   public WOActionResults performActionNamed(String actionName) {
163 163   if(!context().hasSession()) {
164 164   ERXLocalizer localizer =
... ... @@ -168,7 +168,6 @@
168 168   return super.performActionNamed(actionName);
169 169   }
170 170  
171 -
172 172  {{/code}}
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.
... ... @@ -182,3 +182,11 @@
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.
206 +
207 +===== Localization presentation from WOWODC West 2009 =====
208 +
209 +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]].
210 +
211 +=== ===
212 +
213 +