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

From version 37.1
edited by tbritt
on 2009/11/06 10:18
Change comment: There is no comment for this version
To version 55.1
edited by Ramsey Gurley
on 2010/02/02 23:01
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.tbritt
1 +XWiki.ramsey
Content
... ... @@ -1,5 +1,7 @@
1 1  == Unicode ==
2 2  
3 +See also: [[UTF-8 Encoding Tips]]
4 +
3 3  To Enable Unicode for your WO app, add the following to your application constructor:
4 4  
5 5  {{code}}
... ... @@ -101,8 +101,15 @@
101 101  
102 102  {{/noformat}}
103 103  
104 -
106 +The other changes are then in the er.extensions.ERXLocalizer.availableLanguages and ERXLanguages:
107 +In the above case after adding canadian french these would change in:
105 105  
109 +{{noformat}}
110 +
111 +er.extensions.ERXLocalizer.availableLanguages=(English,Japanese,French_CA)
112 +
113 +{{/noformat}}
114 +
106 106  ===== Localized strings and components =====
107 107  
108 108  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:
... ... @@ -109,6 +109,7 @@
109 109  
110 110  Project->Resources->English.lproj->Localizable.strings
111 111  Project->Resources->Japanese.lproj->Localizable.strings
121 +Project->Resources->French//CA.lproj->Localizable.strings//
112 112  
113 113  As mentioned earlier, it's recommended that these be in UTF-16 format. You can do that by right clicking on the file in WOLips and selecting "Properties." In the resources panel, change from the project default encoding to UTF-16.
114 114  
... ... @@ -122,6 +122,26 @@
122 122  
123 123  and then right-click->Copy it from English.lproj and right-click->Paste it into Japanese.lproj. At this point, when you open the component in WOLips, there will be a tab at the bottom of the component editor view that allows you to switch back and forth between different localized versions of that component.
124 124  
135 +Your layout would end up something like this:
136 +
137 +[[image:ERXLocalizerEclipseLayout.png]]
138 +
139 +===== Localized EOAttributes =====
140 +
141 +In Wonder, it is also possible to localize attributes. There are two requisites:
142 +
143 +First add ERXLanguages to your Properties file:
144 +
145 +{{noformat}}
146 +
147 +ERXLanguages = (en,jp,fr_ca)
148 +
149 +{{/noformat}}
150 +
151 +Then, for the attribute you'd like to localize, add the ERXLanguages key to the UserInfo for that specific attribute:
152 +
153 +[[image:ERXLocalizerUserInfo.png]]
154 +
125 125  ===== Direct Actions =====
126 126  
127 127  If you are defaulting to direct actions, you may not have a session. If you do not have a session, the server will return the default language specified in the Properties mentioned above. If you're using direct actions and you don't like that behavior, you can stick this in your direct action class:
... ... @@ -141,8 +141,10 @@
141 141  
142 142  {{/code}}
143 143  
144 -That should give the user their browser's default language setting instead of your server's default language setting until a session is created.
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.
145 145  
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.
177 +
146 146  ===== Database setup =====
147 147  
148 148  Outside of this, if you are using a database, you'll need to make sure that is encoded properly as well. I'm using MySQL, so I have in my EOModel: