
Martin Roussel
Top achievements
Rank 1
Martin Roussel
asked on 19 Sep 2012, 03:21 PM
Im trying to use local resource files to localize my Windows as demonstrated here: Documentation, but always get the following error at loading (highlighting my
Parser Error Message: The resource object with key 'Maximize' was not found.
Here the code:
I also tried putting the <Localization> under the RadWindowManager as done here: Demo, but same results. And yes the resource files ("RadWindow.resx" and "RadWindow.fr-CA.resx") are in my "App_GlobalResources" folder.
The only way I can do it is by setting the string server-side. Is there a way I can access the resource file server-side?
Anyone can help?
TIA
<Localization... line)
:Parser Error Message: The resource object with key 'Maximize' was not found.
Here the code:
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
Skin
=
"WebBlue"
runat
=
"server"
EnableShadow
=
"true"
>
<
Windows
>
<
telerik:RadWindow
ID
=
"RadWindow1"
runat
=
"server"
Title
=
"Site Comments"
meta:resourcekey
=
"labSiteComment"
Height
=
"420px"
Width
=
"710px"
ReloadOnShow
=
"true"
ShowContentDuringLoad
=
"false"
Modal
=
"true"
>
<
Localization
Maximize="<%$ Resources:RadWindow, Maximize %>" Minimize="<%$ Resources:RadWindow, Minimize %>"
Close="<%$ Resources:RadWindow, Close %>" PinOff="<%$ Resources:RadWindow, PinOff %>"
PinOn="<%$ Resources:RadWindow, PinOn %>" Reload="<%$ Resources:RadWindow,Reload %>"
Restore="<%$ Resources:RadWindow, Restore%>" Cancel="<%$ Resources:RadWindow, Cancel %>"
OK="<%$ Resources:RadWindow, OK %>" No="<%$ Resources:RadWindow, No %>" Yes="<%$ Resources:RadWindow, Yes %>" />
</
telerik:RadWindow
>
</
Windows
>
</
telerik:RadWindowManager
>
I also tried putting the <Localization> under the RadWindowManager as done here: Demo, but same results. And yes the resource files ("RadWindow.resx" and "RadWindow.fr-CA.resx") are in my "App_GlobalResources" folder.
The only way I can do it is by setting the string server-side. Is there a way I can access the resource file server-side?
public
void
LocalizeWindowManager(
ref
RadWindowManager Manager,
string
strCultureCode)
{
if
(Manager !=
null
)
{
if
(strCultureCode ==
"fr-CA"
)
{
Manager.Localization.Close =
"Fermer"
;
//would like to get string from resource file (RadWindow.fr-CA.resx) instead
}
}
}
Anyone can help?
TIA
7 Answers, 1 is accepted
0
Hello Martin,
The most likely reason for this is a typo in the Maximize resource name. I just tried this by creating new resx files and it seems to work properly. I am attaching it here as a reference.
Also, have you compiled your application so that the resource files get compiled, too? This is especially true for a web application type project.
On the subject of getting the resource names in the code-behind this is explained in the following article from MSDN: http://msdn.microsoft.com/en-us/library/ms227982(v=vs.100).aspx. Said shortly - the following is the path to the Close string of the RadWindow: Resources.RadWindow.Close.
All the best,
Marin Bratanov
the Telerik team
The most likely reason for this is a typo in the Maximize resource name. I just tried this by creating new resx files and it seems to work properly. I am attaching it here as a reference.
Also, have you compiled your application so that the resource files get compiled, too? This is especially true for a web application type project.
On the subject of getting the resource names in the code-behind this is explained in the following article from MSDN: http://msdn.microsoft.com/en-us/library/ms227982(v=vs.100).aspx. Said shortly - the following is the path to the Close string of the RadWindow: Resources.RadWindow.Close.
All the best,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Martin Roussel
Top achievements
Rank 1
answered on 21 Sep 2012, 12:04 PM
Thanks Marin.
I double-checked and it doesnt seem to have any typo in the file. In fact, ive used the exact one contained in the Telerik Demo. And yes, ive tried to clean/rebuild the solution many times without any difference. Ive also checked and the App_GlobalResources (and the files) exist in the bin folder.
I also tried your sample files in my app with both your page and resource you provided (and rebuilt)...and I get the same type of error:
Parser Error Message: The resource object with key 'Close' was not found.
The strange thing is im using resource files for localizing my RadFileExplorer (RadEditor), RadGrid and RadImageEditor the same way and those are all fine.
"Resources.RadWindow.Close" works fine however. Is it a proof that the resource is compiled correctly?
UPDATE: Ive built a trimmed down website containing the resource files and the guilty page and it works (with your files and mines). I dont get what is wrong in my real app. Only difference with my app is it's a solution project and not a website. Any clue?
UPDATE 2: After thinking a while, I remember that changing localization for the other controls ive mentioned earlier (RadGrid, etc) is not working exactly like the RadWindow. I do it like this (grid in this example):
BUT If I dont specify the LocalizationPath, it doesnt work (without crashing though..it just stay the same language it was). I think my problem is similar and I need to specify somewhere the LocalizationPath for the RadWindow. Is there a way to set it for the RadWindow or set it globally for all controls?
I double-checked and it doesnt seem to have any typo in the file. In fact, ive used the exact one contained in the Telerik Demo. And yes, ive tried to clean/rebuild the solution many times without any difference. Ive also checked and the App_GlobalResources (and the files) exist in the bin folder.
I also tried your sample files in my app with both your page and resource you provided (and rebuilt)...and I get the same type of error:
Parser Error Message: The resource object with key 'Close' was not found.
The strange thing is im using resource files for localizing my RadFileExplorer (RadEditor), RadGrid and RadImageEditor the same way and those are all fine.
"Resources.RadWindow.Close" works fine however. Is it a proof that the resource is compiled correctly?
UPDATE: Ive built a trimmed down website containing the resource files and the guilty page and it works (with your files and mines). I dont get what is wrong in my real app. Only difference with my app is it's a solution project and not a website. Any clue?
UPDATE 2: After thinking a while, I remember that changing localization for the other controls ive mentioned earlier (RadGrid, etc) is not working exactly like the RadWindow. I do it like this (grid in this example):
public
void
LocalizeGrid(
ref
RadGrid Grid,
string
strCultureCode)
{
if
(Grid !=
null
)
{
Grid.LocalizationPath =
"~/App_GlobalResources"
;
Grid.Culture =
new
CultureInfo(strCultureCode);
Grid.Rebind();
}
}
BUT If I dont specify the LocalizationPath, it doesnt work (without crashing though..it just stay the same language it was). I think my problem is similar and I need to specify somewhere the LocalizationPath for the RadWindow. Is there a way to set it for the RadWindow or set it globally for all controls?
0
Hello Martin,
I am not certain what the problem in your actual project is, but it seems that the problematic page cannot read the resources properly. What happens if you add the server code block simply in the page or in a label, e.g.:
If you get the same error then the problem is something on the page, but I cannot say what.
What you can do is to set the localization in the code-behind instead of in the markup.
The RadWIndow does not use a LocalizationPath property, it has a modest set of properties that can be localized (mainly several tooltips) and takes the culture from the UICulture property of the Page in order to see which resource to use. This is shown in both my sample and its localization demo.
Kind regards,
Marin Bratanov
the Telerik team
I am not certain what the problem in your actual project is, but it seems that the problematic page cannot read the resources properly. What happens if you add the server code block simply in the page or in a label, e.g.:
<
asp:Label
ID
=
"Label1"
Text="<%$ Resources:RadWindow, Minimize %>" runat="server" />
What you can do is to set the localization in the code-behind instead of in the markup.
The RadWIndow does not use a LocalizationPath property, it has a modest set of properties that can be localized (mainly several tooltips) and takes the culture from the UICulture property of the Page in order to see which resource to use. This is shown in both my sample and its localization demo.
Kind regards,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Martin Roussel
Top achievements
Rank 1
answered on 25 Sep 2012, 11:31 AM
I tried
<
asp:Label
ID
=
"Label1"
Text="<%$ Resources:RadWindow, Minimize %>" runat="server" />
on 2 different pages and same error:
Parser Error Message: The resource object with key 'Minimize' was not found.
I'll use code-behind for now and will try to investigate more on this when time comes...and report it here If smething is found.
Thanks anyway
0

Olivier
Top achievements
Rank 2
answered on 23 Nov 2012, 10:19 PM
Hello Martin
I had the same problem, and i search during some hoursde
After i UiCulture in the page, it doesnt work , then i override like Ms show but it's doesnt work
I found the best practice, after restart my visual studio and my computer,
only i put this in Web.config between <system>
<globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="fr-FR" uiCulture="fr-FR" />
And it's work for me.
Olivier
I had the same problem, and i search during some hoursde
After i UiCulture in the page, it doesnt work , then i override like Ms show but it's doesnt work
protected override void InitializeCulture() { String selectedLanguage = "fr-FR"; UICulture = selectedLanguage ; Culture = selectedLanguage ; Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(selectedLanguage); Thread.CurrentThread.CurrentUICulture = new CultureInfo(selectedLanguage); base.InitializeCulture(); }
I found the best practice, after restart my visual studio and my computer,
only i put this in Web.config between <system>
<globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="fr-FR" uiCulture="fr-FR" />
And it's work for me.
Olivier
0

Martin Roussel
Top achievements
Rank 1
answered on 26 Nov 2012, 12:35 PM
Oliver,
You mean that after adding that code in your web.config, you now can use the <Localization> tag in the markup to localize your RadWindow? Ive tried putting the same in mine (but for en-US) and it didnt change anything (same error). Also, did you mean <system.web> instead of <system>?
Thanks for the reply
You mean that after adding that code in your web.config, you now can use the <Localization> tag in the markup to localize your RadWindow? Ive tried putting the same in mine (but for en-US) and it didnt change anything (same error). Also, did you mean <system.web> instead of <system>?
Thanks for the reply
0

Olivier
Top achievements
Rank 2
answered on 26 Nov 2012, 12:43 PM
in system web
You find the Start
And you put in "App_GlobalResources" directory your ressource : RadWindow.fr-FR.resx
if you want to do a test, you put RadWindow.resx without language and you replace the ressource by default.
in radWindowManager, you must set this :
Thanks
Olivier
You find the Start
<?
xml
version
=
"1.0"
?>
<
configuration
>
<
system.web
>
<!-- IMPORTANT DE RAJOUTER LA CULTURE -->
<
globalization
fileEncoding
=
"utf-8"
requestEncoding
=
"utf-8"
responseEncoding
=
"utf-8"
culture
=
"fr-FR"
uiCulture
=
"fr-FR"
/>
And you put in "App_GlobalResources" directory your ressource : RadWindow.fr-FR.resx
if you want to do a test, you put RadWindow.resx without language and you replace the ressource by default.
in radWindowManager, you must set this :
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
runat
=
"server"
EnableShadow
=
"true"
Skin
=
"Web20"
Modal
=
"True"
>
<
Localization
Maximize="<%$ Resources:RadWindow,Maximize %>" Minimize="<%$ Resources:RadWindow, Minimize %>"
Close="<%$ Resources:RadWindow, Close %>" PinOff="<%$ Resources:RadWindow, PinOff %>"
PinOn="<%$ Resources:RadWindow, PinOn %>" Reload="<%$ Resources:RadWindow,Reload %>"
Restore="<%$ Resources:RadWindow, Restore%>" Cancel="<%$ Resources:RadWindow, Cancel %>"
OK="<%$ Resources:RadWindow, OK %>" No="<%$ Resources:RadWindow, No %>" Yes="<%$ Resources:RadWindow, Yes %>" ></
Localization
>
Thanks
Olivier