Globalized Enum

Stimulsoft Reports.NET discussion
Post Reply
TeWe
Posts: 8
Joined: Thu Jun 14, 2012 8:36 am

Globalized Enum

Post by TeWe »

Hello,

I have a problem, which I can not solve. I still use globalized labels in the reportdesigner via setting the "Globalized Name" property and putting the text into a resx-file. But I'm not able to globalize enum-values. I would like to put an enums-value into the report by using his int-value and in the report I would like to see a depending text. The text should be localiced.
E.g. SomeEnum with values from 0 to 2 should show the globalized text "test 1", "test 2", "test3".

How can I solve this? Can I set globalized labels used in an expression or something like that?

Thanks in advance!

Regards,

Thorsten
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Globalized Enum

Post by Alex K. »

Hello,

Can you please describe your task in details? And, if possible, send us a sample.

Thank you.
TeWe
Posts: 8
Joined: Thu Jun 14, 2012 8:36 am

Globalized Enum

Post by TeWe »

Hello Aleksey,

I try to describe with more details. I know how to globalize an textlabel in the report-layout via designer. I set the "Globalized Name" property with an id and put the text into a resx-file. Before I show the report, the resx-file will be defined in the GlobalizationManager class. This works perfectly.
But I only get this work with textlabels where I can set the "Globalized Name" property via Gui. I don't know how handle different type of text. E.g. in expressions. I often have to handle enum values. E.g. the reports receive int values which I want to translate into humanreadable text. "0" shall be displayed as "Test Example 1", "1" for "Another Test Example 2".
The expression which do this can look like this:

{switch (DataSource.FieldName == 0, "Test Example 1", DataSource.FieldName == 1, "Another Test Example 2")}

But how to use the globalization feature in this expression of an layout? How can I put the text into resx-files to make it translateable?

I hope I could make my point clear.

Regards
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Globalized Enum

Post by Ivan »

Hello,

You can add yours text strings to the resx-file, and then use the following expression:

Code: Select all

{this.GlobalizationManager.GetString("name_of_your_text")}
For example, you can add strings "test1", "test2" and then write

Code: Select all

{switch (DataSource.FieldName == 0, this.GlobalizationManager.GetString("test1"), DataSource.FieldName == 1, this.GlobalizationManager.GetString("test2"))}
Thank you.
TeWe
Posts: 8
Joined: Thu Jun 14, 2012 8:36 am

Globalized Enum

Post by TeWe »

That was exactly what I needed.

Thanks a lot! :-)

Regards
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Globalized Enum

Post by Andrew »

Hello,

Great!

Let us know if have additional questions.
Thank you.
Post Reply