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

From version 34.1
edited by Johan Henselmans
on 2009/11/10 06:43
Change comment: There is no comment for this version
To version 47.1
edited by Pascal Robert
on 2010/09/19 11:14
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -Web Applications-Development-Localization and Internationalization
1 +Development-Localization and Internationalization
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.johanhenselmans
1 +XWiki.probert
Content
... ... @@ -1,5 +1,7 @@
1 1  == Unicode ==
2 2  
3 +See also: [[UTF-8 Encoding Tips>>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}}
... ... @@ -68,7 +68,7 @@
68 68  
69 69  If you use localized strings in your UTF-8 application you may also check out Project Wonder's [[ERXLocalizer>>WOnder-ERXLocalizer]] class.
70 70  
71 -=== Project Localization tips [[~~ramsey]] ===
73 +=== Project Localization tips [[~~ramsey]] ===
72 72  
73 73  The following are some tips and suggestions for localizing a project in WOLips using Project Wonder.
74 74  
... ... @@ -112,7 +112,7 @@
112 112  
113 113  ===== Localized strings and components =====
114 114  
115 -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:
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:
116 116  
117 117  Project->Resources->English.lproj->Localizable.strings
118 118  Project->Resources->Japanese.lproj->Localizable.strings
... ... @@ -120,18 +120,20 @@
120 120  
121 121  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.
122 122  
123 -If you have any components that need localizing, then you should relocate that component from your Project->Components folder into the appropriate Lang.lproj folder. Then make a copy of the component into the remaining lproj directories and you can begin the process of localizing the component. You do not need more than one copy of the associated API or java file. You only need duplicates of the WO. So, as an example, if you wanted to localize
125 +If you have any components that need localizing, then you should relocate that component from your Project->Components folder into the appropriate Lang.lproj folder. Then make a copy of the component into the remaining lproj directories and you can begin the process of localizing the component. You do not need more than one copy of the associated API or java file. You only need duplicates of the WO. So, as an example, if you wanted to localize
124 124  
125 125  > Project->Components->Main WO
128 +>\\
129 +>>You would right-click->Refactor->Move it to
126 126  
127 -You would right-click->Refactor->Move it to
131 +> Project->Resources->English.lproj->Main WO
132 +>\\
133 +>>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.
128 128  
129 -> Project->Resources->English.lproj->Main WO
130 -
131 -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.
132 -
133 133  Your layout would end up something like this:
134 134  
137 +[[image:ERXLocalizerEclipseLayout.png]]
138 +
135 135  ===== Localized EOAttributes =====
136 136  
137 137  In Wonder, it is also possible to localize attributes. There are two requisites:
... ... @@ -146,6 +146,8 @@
146 146  
147 147  Then, for the attribute you'd like to localize, add the ERXLanguages key to the UserInfo for that specific attribute:
148 148  
153 +[[image:ERXLocalizerUserInfo_correct.png||border="1"]]
154 +
149 149  ===== Direct Actions =====
150 150  
151 151  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:
... ... @@ -167,6 +167,8 @@
167 167  
168 168  That should give the user their browser's default language setting instead of your server's default language setting until a session is created.
169 169  
176 +[[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 +
170 170  ===== Database setup =====
171 171  
172 172  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: