[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Localized Exception Message

Luthgers, John

8/15/2008 2:14:00 PM

Hi,

my application uses a global exception handler to catch any unhandled
exceptions and then shows a dialog to inform the user. The dialog shows the
exception content and gives the ability to send an error report to my
website. Now i noticed, that the exception text of system exceptions can by
localized by installing the dotnet language packs. The result is, that some
users send a japanese exception to the website.

My goal is:
1) show the user the localized exception message within the dialog
2) send the exception in english to the website, so i can read it later :)

Goal 1 is already accomplished. And I know that i can change the culture via
"Thread.CurrentThread.CurrentUICulture" to english, but that works only if
the culture is set before the exception is thrown and doing so avoid the
abillity to show a localized version of the message to the user.

Is there any way to "reinit" the text of an exception based on the current
culture?

-J-


6 Answers

John Galt

8/3/2008 11:37:00 AM

0


"Steve" <stevencanyon@yahooooooo.com> wrote in message
news:aq4b945jgl71peld3ich7oin3uoti2pj9i@4ax.com...
> On Sun, 3 Aug 2008 18:59:41 +0800, "John Galt" <kady101@gmail.com>
> wrote:
>
>>
>>"Steve" <stevencanyon@yahooooooo.com> wrote in message
>>news:3q0b9491c2fsj5rq1qr775c2af24mc0lcq@4ax.com...
>>> On Sat, 02 Aug 2008 19:54:05 -0700, George Grapman
>>> <sfgeorge@paccbell.net> wrote:
>>>
>>>> The company I work for is looking to fill a position and Steve has
>>>>given me great idea. Instead of reading resumes and having interviews I
>>>>simply have to ask one question to qualify applicant-"do you rent or
>>>>own?"
>>>
>>>
>>> Nothing wrong with renting if you're under twenty five and just
>>> getting started or if one has put aside other assets or investments to
>>> cover their future.... beyond that, renting is a sign of immature,
>>> and/or irresponsible behavior...
>>
>>Eh......I think that's overstepping a bit. Buying a house isn't a great
>>investment, in that in most situations, it doesn't appreciate at anywhere
>>near the rate of equities. Further, even in normal times, you can get but
>>S
>>C R E W E D on a home purchase, if something happens and for whatever
>>reason
>>(say, you're 25 and your Dad dies and you need to move back to be close to
>>mom) you have to sell inside of 3 to 5 years.
>>
>>There are plenty of circumstances that a mature, responsible person might
>>prefer to rent, as I see it. However, for MOST, you're right -- it's the
>>only chance they have to build a nest egg.
>>
>>JG
>>
>
> I didn't say that buying a home was the best investment.. but it's a
> hell of lot better "investment" than renting.. which is the
> alternative to not buying a home... IOW, renting is the alternative
> to buying, not buying equities....
>
> ..here's the facts... when you buy a home, you're locking in the
> monthly cost of having a place to live... You may start out paying
> more than if you rented, but more than likely, rents will increase and
> unless you got suckered into a ARM, your mortgage payment will stay
> the same...

We're not disagreeing. My point here is that the number of people who have
the opportunity to live in circumstances that enable them to stay in a house
the requisite five years to payback is not as high as we'd like to think.

Buy a house, sell it in three years.......you're usually better off renting,
financially, especially if you're disciplined enough to invest the money
saved.

JG


Alvin Bruney [ASP.NET MVP]

8/16/2008 2:17:00 AM

0

Not sure there is much you can do about this situation given your
circumstance. Have a look at this thread
http://forums.msdn.microsoft.com/en-US/clr/thread/f9fd99d7-4411-4cd9-a126-676...

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Download OWC Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $15.00
Need a free copy of VSTS 2008 w/ MSDN Premium?
http://msmvps.com/blogs/alvin/De...
-------------------------------------------------------


"Luthgers, John" <jls17@gmx.net.nospam> wrote in message
news:uYy9mEu$IHA.1016@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> my application uses a global exception handler to catch any unhandled
> exceptions and then shows a dialog to inform the user. The dialog shows
> the exception content and gives the ability to send an error report to my
> website. Now i noticed, that the exception text of system exceptions can
> by localized by installing the dotnet language packs. The result is, that
> some users send a japanese exception to the website.
>
> My goal is:
> 1) show the user the localized exception message within the dialog
> 2) send the exception in english to the website, so i can read it later :)
>
> Goal 1 is already accomplished. And I know that i can change the culture
> via "Thread.CurrentThread.CurrentUICulture" to english, but that works
> only if the culture is set before the exception is thrown and doing so
> avoid the abillity to show a localized version of the message to the user.
>
> Is there any way to "reinit" the text of an exception based on the current
> culture?
>
> -J-
>
>

Luthgers, John

8/16/2008 6:14:00 AM

0

So, there seems to be no way. Thank you.

-J-


Alvin Bruney [ASP.NET MVP]

8/16/2008 10:40:00 PM

0

Well, there is but it doesn't jive with your approach. Your application runs
on the server, you should not be localizing exceptions on the server since
the support personnel is expected to see the message in their local. What
you should do is translate the message that will be sent to the client in
the requesting locale. That way, german folk see german messages but support
personal in England see English exception messages. I'd argue here that
clients should never see an exception if it wasn't sanitized in some way.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Download OWC Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $15.00
Need a free copy of VSTS 2008 w/ MSDN Premium?
http://msmvps.com/blogs/alvin/De...
-------------------------------------------------------


"Luthgers, John" <jls17@gmx.net.nospam> wrote in message
news:#MqMGd2$IHA.4816@TK2MSFTNGP06.phx.gbl...
> So, there seems to be no way. Thank you.
>
> -J-
>

Luthgers, John

8/16/2008 11:42:00 PM

0

You misunderstood something i havnt pointed out very well. The application
is a winforms application, not a ASP.NET page. I thought it isnt that
important and correctly addressed in a dotnet.framework group. But of course
it was my fault. So, there is no client/server side. The exception is thrown
anywhere in my application and before it crashes it is caught by a global
exception handler. Now a dialog comes up, which shows some error details to
the user (for the case the user can eliminate the problem himself; and this
text should be localized) and gives him the ability to send the exception
content (just plain text; but that should be in english localization) to my
webserver (for later error analysis). The problematic exceptions are system
exceptions like "ArgumentException" or "ArgumentNullException", because they
are automatically localized based on the threads UI-culture.

The link you posted was exactly related to my topic. It was not related to
ASP.NET. The conclusion of this thread is that you should uninstall the
language pack. But the users of this application are spread all over the
world and i'm quite sure they will not uninstall their language pack only
for giving me the english exception text without any benefit for themself.

Till now, i dont know how to get different localized exception texts from a
single exception. And there seems to be no solution.

Thanks so far.
-J-


Alvin Bruney [ASP.NET MVP]

8/17/2008 3:28:00 AM

0

Ok, makes sense. I do not have a solution for you.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Download OWC Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $15.00
Need a free copy of VSTS 2008 w/ MSDN Premium?
http://msmvps.com/blogs/alvin/De...
-------------------------------------------------------


"Luthgers, John" <jls17@gmx.net.nospam> wrote in message
news:e5CO8m$$IHA.5192@TK2MSFTNGP04.phx.gbl...
> You misunderstood something i havnt pointed out very well. The application
> is a winforms application, not a ASP.NET page. I thought it isnt that
> important and correctly addressed in a dotnet.framework group. But of
> course it was my fault. So, there is no client/server side. The exception
> is thrown anywhere in my application and before it crashes it is caught by
> a global exception handler. Now a dialog comes up, which shows some error
> details to the user (for the case the user can eliminate the problem
> himself; and this text should be localized) and gives him the ability to
> send the exception content (just plain text; but that should be in english
> localization) to my webserver (for later error analysis). The problematic
> exceptions are system exceptions like "ArgumentException" or
> "ArgumentNullException", because they are automatically localized based on
> the threads UI-culture.
>
> The link you posted was exactly related to my topic. It was not related to
> ASP.NET. The conclusion of this thread is that you should uninstall the
> language pack. But the users of this application are spread all over the
> world and i'm quite sure they will not uninstall their language pack only
> for giving me the english exception text without any benefit for themself.
>
> Till now, i dont know how to get different localized exception texts from
> a single exception. And there seems to be no solution.
>
> Thanks so far.
> -J-
>