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

From version 42.1
edited by Ramsey Gurley
on 2008/07/25 16:53
Change comment: There is no comment for this version
To version 40.1
edited by Johan Henselmans
on 2009/11/10 06:49
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.ramsey
1 +XWiki.johanhenselmans
Content
... ... @@ -93,6 +93,23 @@
93 93  
94 94  {{/noformat}}
95 95  
96 +Note that if you need to customize the locale for a language, such as Canadian French, you can do so with this property:
97 +
98 +{{noformat}}
99 +
100 +er.extensions.ERXLocalizer.French_CA.locale = fr_ca
101 +
102 +{{/noformat}}
103 +
104 +The other changes are then in the er.extensions.ERXLocalizer.availableLanguages and ERXLanguages:
105 +In the above case after adding canadian french these would change in:
106 +
107 +{{noformat}}
108 +
109 +er.extensions.ERXLocalizer.availableLanguages=(English,Japanese,French_CA)
110 +
111 +{{/noformat}}
112 +
96 96  ===== Localized strings and components =====
97 97  
98 98  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:
... ... @@ -99,6 +99,7 @@
99 99  
100 100  Project->Resources->English.lproj->Localizable.strings
101 101  Project->Resources->Japanese.lproj->Localizable.strings
119 +Project->Resources->French//CA.lproj->Localizable.strings//
102 102  
103 103  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.
104 104  
... ... @@ -112,33 +112,26 @@
112 112  
113 113  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.
114 114  
115 -===== Component HTML =====
133 +Your layout would end up something like this:
116 116  
117 -And, although this is a little redundant... here's what the start of my PageWrapper looks like:
135 +[[image:ERXLocalizerEclipseLayout.png]]
118 118  
119 -{{code}}
137 +===== Localized EOAttributes =====
120 120  
121 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
122 - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
139 +In Wonder, it is also possible to localize attributes. There are two requisites:
123 123  
124 -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang='<wo:localized value = "ls_lang" />' lang='<wo:localized value = "ls_lang" />'>
125 -<head>
126 - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
141 +First add ERXLanguages to your Properties file:
127 127  
128 -{{/code}}
143 +{{noformat}}
129 129  
130 -and in the Localizable.strings file, I keep a language code for each language
145 +ERXLanguages = (en,jp,fr_ca)
131 131  
132 -{{code}}
147 +{{/noformat}}
133 133  
134 -{
135 - "ls_lang" = "en";
136 -}
149 +Then, for the attribute you'd like to localize, add the ERXLanguages key to the UserInfo for that specific attribute:
137 137  
138 -{{/code}}
151 +[[image:ERXLocalizerUserInfo.png]]
139 139  
140 -You'll also notice the "ls//" prefix. You'll definitely want to prefix with something unique so you can do a project-wide search for your keys without difficulty.//
141 -
142 142  ===== Direct Actions =====
143 143  
144 144  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: