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

Static and Dynamic text in Resource(Resx) files

2 Answers 840 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Amar
Top achievements
Rank 1
Amar asked on 22 Jul 2015, 09:32 AM

Hi,

I need to put some text in the textboxes which is language dependent. So what am I doing is, I have used combination of static text and dynamic text for each language culture. For example

For English : textBox1.Value="Label" + Fields.Name + ", " + Fields.Address

For ​Russian : textBox1.Value="этикетка" + Fields.Name ​+ ", " + Fields.Address

 Till now I have placed the English part(i.e. "Label" + Fields.Name + ", " + Fields.Address) and Russian part(i.e. "этикетка" + Fields.Name ​+ ", " + Fields.Address) in their respective files.

My question is - Can we place just static part of the expression in the Resx files and keep the rest intact (Means placing just "Label" and "этикетка" in the resx files) ?

If yes then How?

2 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 27 Jul 2015, 07:44 AM
Hello Amar,

Telerik Reporting uses a similar methodology for localization as Visual Studio uses for Windows Forms. The designer lets you define static text for the report (e.g. column headings, titles) in each language that you specify. A resource file () is automatically created for each language to store translated text. The value of a report item e.g., TextBox, is stored inside the file and retrieved using the following code:
resources.ApplyResources(this.textBox1, "textBox1");

The whole value is retrieved from the resource file, so our suggestion is to store the whole string (static part and data fields) inside the file. More information on the method above is available in the ComponentResourceManager.ApplyResources Method (Object, String) MSDN page.

For more background information on localizing applications see the MSDN article Globalizing and Localizing Applications.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Amar
Top achievements
Rank 1
answered on 05 Aug 2015, 05:14 AM
Thank you !
Tags
General Discussions
Asked by
Amar
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Amar
Top achievements
Rank 1
Share this question
or