Re: get the browser's language and session set up question
Re: get the browser's language and session set up question
- Subject: Re: get the browser's language and session set up question
- From: Dev WO <email@hidden>
- Date: Tue, 17 Feb 2004 19:54:07 +0100
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.