Re: Strange WebObjects Localization, need help
Re: Strange WebObjects Localization, need help
- Subject: Re: Strange WebObjects Localization, need help
- From: Chuck Hill <email@hidden>
- Date: Thu, 24 Nov 2005 17:51:12 -0800
Hi,
On Nov 23, 2005, at 9:18 AM, Dev WO wrote:
Hi Amedeo,
you'll get this issue if the browser/system doesn't have one of the
available language (or doesn't request the page in a specific
language, you make some test using OmniWeb that allows you to try
requesting the page in a specific language or none).
To make it work with a "fall back" language, you need to do:
-add the following to your Session.java
----
public void setLanguages(NSArray aLanguageArray) {
if ((aLanguageArray == null) || (aLanguageArray.count() ==
0)) {
aLanguageArray = new NSArray("French"); //or your
fallback language;)
}
super.setLanguages(aLanguageArray);
}
----
-if you have a direct action that has a language parameter, here's
what I'm using in DirectAction.java:
----
public WOActionResults directAccessAction(){
String langue = (String)request().formValueForKey("lang");
String page = (String)request().formValueForKey("section");
NSMutableArray languages = new NSMutableArray();
if (langue.equals("fr")) languages.addObject("French");
if (langue.equals("en")) languages.addObject("English");
if (langue.equals("es")) languages.addObject("Spanish");
if (langue.equals("ru")) languages.addObject("Russian");
if (languages.count()==0) languages.addObject("French");
session().setLanguages(languages);
return pageWithName(page);
}
Seems like a lot of trouble. Does this not work?
public WOActionResults directAccessAction(){
String page = (String)request().formValueForKey("section");
NSMutableArray languages = new NSMutableArray(request
().browserLanguages());
// Don't use the if just in case the only languages requested
are ones you don't have
languages.addObject("French");
session().setLanguages(languages);
return pageWithName(page);
}
I'm pretty sure that session().languages() ends up at
request.browserLanguages() so you could make your own WORequest
subclass to fix this in one place. Then override createRequest in
Application to create an return an instance of your subclass.
Chuck
I have this code in Session Component
NSMutableArray languages = new NSMutableArray();
languages.addObject("English");
languages.addObject("German");
languages.addObject("Italian");
this.setLanguages (languages);
and all .wo files are localized
this is the output from the log:
[2005-11-23 18:05:11 CET] <WorkerThread3>
<com.webobjects.appserver._private.WOComponentDefinition> No
template found for component homePage at "file:/Volumes/AMEDEO-HD/
NUOVOSITO/digitmovies/build/Development/digitmovies.woa/".
On 23/nov/05, at 18:00, Chuck Hill wrote:
Did you put a localized version of each component (.wo directory)
in each of the lproj files? You might also have a build issue if
you are using wretXcode. Try deleting the build directory.
Chuck
On Nov 23, 2005, at 8:54 AM, Amedeo Mantica wrote:
Hello
I have locallized my WO App via the standard Apple method: Make
Localizable to my components, and created English, German and
Italian proj
If I start browsing my WebSite with a browser with a language
other than the three above i reach a totally blank page!
Can anyone help me?
Thanks
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Coming in 2006 - an introduction to web applications using
WebObjects and Xcode http://www.global-village.net/wointro
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve
specific problems. http://www.global-village.net/products/
practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anazys.com
This email sent to email@hidden
--
Coming in 2006 - an introduction to web applications using WebObjects
and Xcode http://www.global-village.net/wointro
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems. http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden