On Apr 10, 2006, at 6:25 AM, Miguel Arroz wrote:
Hi!
Unfortunately, it's very true. There is a really big list of
problems caused by the "We speak english so we don't care" problem,
in all fields of software engineering.
Personally, I think WO is, even so, one of the best solutions
around in what relates to localization. But there are some
problems. One of them is, for example, that I have to turn off
component caching if I want my "languages" menu in my Web App to
work. If I don't turn the cache off, I always get the current
component in the same language. This is not very serious, but if
effectively disallows me to use the cache, eventually causing some
performance problems. I'm sure it would be not a big problem for WO
developers to reload the component if the language was different
that the one in cache.
I suspect the real problem is that the localized version of the
component is loaded _before_ your languages menu takes effect. The
component cache will have one version of the component in it for each
localization.
Chuck
Well, I can't blame them that much, because I didn't fill a bug
report on this. When I'm new to a tool, I tend to think "I'm
probably wrong, and they are probably right, so I won't write
stupid bug reports, because they will answer a big RTFM on me".
Yours
Miguel Arroz
On 2006/04/10, at 14:01, WebObjects wrote:
This should not be a joke . I mean it seriously.
I belive, cos the people who created WO are developers, and they
think only
in english, they completely forgot that there is another
languages, and dont
add the language part in a correct Object Oriented solution to the
applications.
We (at least I) still face problems using non ASCII characters in
databases.
First God created developers(Her started the real problem :) ).
Developers
created databases in English. Then Developers added languages to
almost
close-System.
To be honest. I develop my applications and after monthes i think
"oh i need
another languages".
Solutions: reengineering. Who says, it goes well? :/)
peaSakoe
----- Original Message -----
From: "Miguel Arroz" <[EMAIL PROTECTED]>
To: "WebObjects-Dev Apple" <[email protected]>
Sent: Saturday, April 08, 2006 6:15 PM
Subject: Re: Logout and localization problem
Hi!
Well, I could mate it work... (I removed some verifications code
from the snippet blow to make it simpler to read):
public WOActionResults logoutAction() {
String language = (String)request().formValueForKey
("language");
changeLanguage(language);
WOComponent result = pageWithName("LogoutComponent");
Session theSession = (Session)result.context().session();
theSession.changeLanguage(language);
return result;
}
The strange this is that I have to call changeLanguage in the DA,
and in the session... if I call only in the Session, I have the
reverse effect, that is, I get the LogoutComponent in english and
everything else in the desired language.
Why does this happen?
Yours
MigueL Arroz
On 2006/04/08, at 16:55, Miguel Arroz wrote:
Hi!
We have an application where the preferred user language is
stored in his account. So, he may see the application in English,
but as soon as he logs-in, the app switches to the language he
choose before. We do this by removing his language from the session
language list, and adding it again as the first one.
I'm implementing Logout now. To implement Logout, I have used
code from Practical WebObjects book:
public WOComponent logout() {
NSMutableDictionary arguments = new NSMutableDictionary();
arguments.setObjectForKey(Boolean.FALSE, "wosid");
session().terminate();
WORedirect mainPage = (WORedirect) pageWithName
("WORedirect");
mainPage.setUrl(context().directActionURLForActionNamed
("logout", arguments));
return mainPage;
}
When using this, it's obvious that, whatever the language was
before, the Logout page will appear in english. So, I did a small
modification:
public WOComponent logout() {
NSMutableDictionary arguments = new NSMutableDictionary();
arguments.setObjectForKey(Boolean.FALSE, "wosid");
arguments.setObjectForKey(session().languages
().objectAtIndex(0), "language");
session().terminate();
WORedirect mainPage = (WORedirect) pageWithName
("WORedirect");
mainPage.setUrl(context().directActionURLForActionNamed
("logout", arguments));
return mainPage;
}
And, in DirectAction, I tried this:
public WOActionResults logoutAction() {
String language = (String)request().formValueForKey
("language");
changeLanguage(language);
return pageWithName("LogoutComponent");
}
public void changeLanguage(String newLanguage) {
NSMutableArray languagesArray = new NSMutableArray
(this.languages());
languagesArray.removeObject(newLanguage);
languagesArray.insertObjectAtIndex(newLanguage,0);
this.setLanguages(languagesArray);
}
This almost works, but I'm having a problem... the
"LogoutComponent" itself appears in the correct language, but all
the sub-components it includes appear in English. I suspect this
happens because they have WOHyperlinks, so a new session is created
somewhere between by return pageWithName and the page actually gets
sent to the browser. Probably, the other subcomponents are getting
the language from the Session (which, at that point, i cannot
control) and not from the Direct Action.
As the session does not exist during the execution of my
logoutAction() method, I cannot change it's languages array. Is
there any way to solve this? Maybe forcing the creation of a
session in the logoutAction() method, but I could not find out how
to do it.
Yours
Miguel Arroz
"GUERRA E' PAZ
LIBERDADE E' ESCRAVIDAO
IGNORANCIA E' FORCA" -- 1984
Miguel Arroz
http://www.ipragma.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/arroz%
40guiamac.com
This email sent to [EMAIL PROTECTED]
"I felt like putting a bullet between
the eyes of every Panda that wouldn't
scr*w to save its species." -- Fight Club
Miguel Arroz
http://www.ipragma.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/webobjects%
40datos.de
This email sent to [EMAIL PROTECTED]
"The world lies in the hands of evil
And we pray it would last" -- Apocalyptica, Life Burns!
Miguel Arroz
http://www.ipragma.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%
40global-village.net
This email sent to [EMAIL PROTECTED]
--
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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]