Re: get the browser's language and session set up question [SOLVED]
Re: get the browser's language and session set up question [SOLVED]
- Subject: Re: get the browser's language and session set up question [SOLVED]
- From: Dev WO <email@hidden>
- Date: Tue, 17 Feb 2004 21:24:12 +0100
YEEES
Thanks a lot Alexander!
hey xavier,
try French instead of french (and English). WOs default mechanism
works with capitals as the first letter.
This did the trick...I'm still a beginner!
and did you add any English.lproj and French.lproj with translated
content (.wo and .strings) to your woa? without it it won't work at
all.
Yes I did, thanks for taking the time to imagine what I could have done
wrong!
try setting your browsers language to fr, then en, and see it it
changes language on the first call to you app
(cgi-bin/WebObjects/YourApp.woa). if it does not, have a closer look
at French.lproj and English.lproj.
I just use the Debug menu in Safari (French) to launch the page in
Mozilla (English). To make sure the localized folder worked.
what does goAccueil() do?
it's the WOHyperlink that goes to the next component when user click on
the main link (no language rewrite)
atze
Thanks a lot again!
Let's go back to the Forms/WOMailDelivery issue
Xavier
Am 17.02.2004 um 19:54 schrieb Dev WO:
Hi Alexander,
Sorry about the delay about this...
So here's what I add to main.java:
-----
public WOComponent changeToFrench()
{
NSMutableArray languages = new NSMutableArray();
languages.addObject("french");
session().setLanguages(languages);
return goAccueil();
}
public WOComponent changeToEnglish()
{
NSMutableArray languages = new NSMutableArray();
languages.addObject("english");
session().setLanguages(languages);
return goAccueil();
}
-----
And I have a button (WOHyperlink) displayed in the browser that calls
"changeToxxx", but when I click on it, it goes on with the same
language, and not the new one...
I know it's not the same thing that you gave me, but this seemed
easier to me...and it looks like your solution is with a list, and I
have a bouton for each language, so I don't need a list. Maybe your
code would be "smaller" in this case.
Thanks a lot for your support Alexander:)
Xavier
1. make yourself an array (Languages.strings) containing all
languages you're going to support.
2. make a repetition on that array containing a hyperlink.
3. translate all those languages in your localized .lproj/.strings
so a german will see Deutsch instead of German.
here is a copy from one of my projects:
the wod:
languages: WORepetition {
list = application.availableLanguages;
item = language;
}
languageLink: WOHyperlink {
action = selectLanguage;
disabled = isSelectedLanguage;
}
languageName: WOString {
value = nativeLanguageName;
escapeHTML = NO;
}
public class Main extends WOComponent {
String language;
public Main(WOContext context) {
super(context);
}
public String languageName()
{
return
NSPathUtilities.stringByDeletingPathExtension(language);
}
public String nativeLanguageName()
{
String aLanguage = languageName();
return
application().resourceManager().stringForKey(aLanguage, "Languages",
aLanguage, null, null);
}
public boolean isSelectedLanguage()
{
return
languageName().equals(session().languages().objectAtIndex(0));
}
public WOComponent selectLanguage()
{
String aLanguage = languageName();
NSMutableArray anArray =
session().languages().mutableClone();
anArray.removeObject(aLanguage);
anArray.insertObjectAtIndex(aLanguage, 0);
session().setLanguages(anArray);
return context().page();
}
}
Am 11.02.2004 um 15:57 schrieb Dev WO:
This start looking good to me thanks Alexander,
May I ask you a little more details:
-How should look my hyperlink in the entry page for people that
don't want to use the display language, but another one:
GoFrench: WOHyperlink {....??
Le 11 fivr. 04, ` 15:32, Alexander Spohr a icrit :
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.