This is a migrated thread and some comments may be shown as answers.

Adding resource files

2 Answers 443 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Paul Kater
Top achievements
Rank 1
Paul Kater asked on 01 Jun 2010, 03:08 PM
Hello,

I want to use resource files in my reports. I found the way that has to be done w.r.t. the culture-identification, and that is quite simple.
My problem however is that I don't know where to put the files. I found some C# code that will allow me to access a resource file but that does not work as I don't know where I have to tell it where the resourcefiles are. That code is:

public static string ReadResourceValue(string file, string key)
        {
            //value for our return value
            string resourceValue = string.Empty;
            try
            {
                // specify your resource file name
                string resourceFile = file;
                // get the path of your file
               // string filePath = System.AppDomain.CurrentDomain.BaseDirectory.ToString();
                string filePath = "";
                // create a resource manager for reading from
                //the resx file
                ResourceManager resourceManager = ResourceManager.CreateFileBasedResourceManager(resourceFile, filePath, null);
                // retrieve the value of the specified key
                resourceValue = resourceManager.GetString(key);
            }
            catch (Exception ex)
            {
                resourceValue = string.Empty;
            }
            return resourceValue;
        }

Is there a simple (simpler) way to do this?

Thank you

2 Answers, 1 is accepted

Sort by
0
Paul Kater
Top achievements
Rank 1
answered on 02 Jun 2010, 07:40 AM
Found and fixed:

http://www.telerik.com/help/reporting/advanced-localizing-reports.html had the answer for me:

To localize a report:

  1. In the designer set the Report Localizable property to true.
  2. Select a Language property value from the drop down list in the properties window.
  3. Translate the static text into the desired language indicated by the Language property.

0
deepak
Top achievements
Rank 1
answered on 17 May 2018, 06:25 AM

Hello,

Can we add two Resource file in .cs for two different language, by default one is creating  ,other i want to add like Spanish , so that based on  Culture,it may fetch the value

 

Tags
General Discussions
Asked by
Paul Kater
Top achievements
Rank 1
Answers by
Paul Kater
Top achievements
Rank 1
deepak
Top achievements
Rank 1
Share this question
or