🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.pl.comp.lang.csharp
Article #22473

Re: UICulture i GetLocalResourceObject

#22473
From: Robert Sadza
Date: Wed, 27 Feb 2013 07:34
31 lines
2260 bytes
> UICulture jest ustawione per-thread, więc technicznie rzecz ujmując
> nie może być źle ustawione dla User Control. Strzelałbym, że
> problem jest tej natury:
>
> http://stackoverflow.com/questions/2029315/resource-file-for-a-custom-asp-net-control-ascx-invalidoperationexception
>
> <quote>
> When you call GetLocalResourceObject from within a user control, you are
> actually calling TemplateControl.GetLocalResourceObject, which will look in
> the wrong place for the resource file.
> <quote>
>
> Tzn. zamiast wołać lokalny GLRO(czyli, implicit GLRO z TemplateControl),
> zawołać:
>
> <quote>
> protected string HttpContextGetLocalResourceObjectAsString(string message)
> {
>    string path = HttpContext.Current.Request.Path;
>    return (HttpContext.GetLocalResourceObject(path, message) as string);
> }
>
> label1.InnerText = HttpContextGetLocalResourceObjectAsString("default");
> </quote>
>

to rozwiązanie również nie zadziałało. Na obecną chwile utworzyłem plik 
globalnych zasobów dla języka polskiego i angielskiego i za pomocą 
HttpContext.GetGlobalResourceObject pobiera prawidłowe wartości w 
zależności od ustawionego języka.
Technical Details
Message-ID: <kgkdcd$nh9$1@mx1.internetia.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!nf1.ipartners.pl!ipartners.pl!news.internetia.pl!not-for-mail
References: <kg75nn$m4m$1@mx1.internetia.pl> <40bukxqqse6m.182g2rpimaiac.dlg@40tude.net> <kgi7ep$j76$1@mx1.internetia.pl> <1hhfuw7kc1p3$.1v9llx7sbjskg$.dlg@40tude.net>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!nf1.ipartners.pl!ipartners.pl!news.internetia.pl!not-for-mail
From: Robert Sadza <szagi44@poczta.fm>
Newsgroups: alt.pl.comp.lang.csharp
Subject: Re: UICulture i GetLocalResourceObject
Date: Wed, 27 Feb 2013 08:34:17 +0100
Organization: Netia S.A.
Lines: 32
Message-ID: <kgkdcd$nh9$1@mx1.internetia.pl>
References: <kg75nn$m4m$1@mx1.internetia.pl> <40bukxqqse6m.182g2rpimaiac.dlg@40tude.net> <kgi7ep$j76$1@mx1.internetia.pl> <1hhfuw7kc1p3$.1v9llx7sbjskg$.dlg@40tude.net>
NNTP-Posting-Host: ns1.rabbit.pl
Mime-Version: 1.0
X-Trace: mx1.internetia.pl 1361950925 24105 62.233.179.193 (27 Feb 2013 07:42:05 GMT)
X-Complaints-To: abuse@inetia.pl
NNTP-Posting-Date: Wed, 27 Feb 2013 07:42:05 +0000 (UTC)
In-Reply-To: <1hhfuw7kc1p3$.1v9llx7sbjskg$.dlg@40tude.net>
X-Tech-Contact: usenet@internetia.pl
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130215 Thunderbird/17.0.3
X-Server-Info: http://www.internetia.pl/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit