• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: get the browser's language and session set up question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: get the browser's language and session set up question


  • Subject: Re: get the browser's language and session set up question
  • From: Alexander Spohr <email@hidden>
  • Date: Tue, 17 Feb 2004 20:41:13 +0100

hey xavier,

try French instead of french (and English). WOs default mechanism works with capitals as the first letter.

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.

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.

what does goAccueil() do?

	atze


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.

  • Follow-Ups:
    • Re: get the browser's language and session set up question [SOLVED]
      • From: Dev WO <email@hidden>
References: 
 >Re: get the browser's language and session set up question (From: Dev WO <email@hidden>)
 >Re: get the browser's language and session set up question (From: Dev WO <email@hidden>)
 >Re: get the browser's language and session set up question (From: Dev WO <email@hidden>)
 >Re: get the browser's language and session set up question (From: Dev WO <email@hidden>)

  • Prev by Date: Re: get the browser's language and session set up question
  • Next by Date: Re: get the browser's language and session set up question [SOLVED]
  • Previous by thread: Re: get the browser's language and session set up question
  • Next by thread: Re: get the browser's language and session set up question [SOLVED]
  • Index(es):
    • Date
    • Thread