How to localize property-name?

Stimulsoft Reports.WPF discussion
stehwn
Posts: 22
Joined: Wed Jul 08, 2009 8:20 am

How to localize property-name?

Post by stehwn »

Hi,

I'm using report.RegBusinessObject(...) to localize the names of my businessobjects.
But how can I localize the names of their properties?
I have a custom attribute derived from DisplayNameAttribute to localize my properties but it seems to be ignored.
Any ideas?

And is it possible to hide properties (some are unwanted at all and some do not always exist (==null) )?
Maybe also with a custom attribute?

Best Regards
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

How to localize property-name?

Post by Jan »

Hello,
I'm using report.RegBusinessObject(...) to localize the names of my businessobjects.
But how can I localize the names of their properties?
I have a custom attribute derived from DisplayNameAttribute to localize my properties but it seems to be ignored.
Any ideas?
At this moment you can use custom attribute Stimulsoft.Report.Dictionary.StiAlias. Also next prerelease build (26 April) will support DisplayName attribute.

And is it possible to hide properties (some are unwanted at all and some do not always exist (==null) )?
Maybe also with a custom attribute?
You can use two attributes to hide properties:

Code: Select all

        [Browsable(false)]
        [Stimulsoft.Base.Design.StiBrowsable(false)]
Thank you.
stehwn
Posts: 22
Joined: Wed Jul 08, 2009 8:20 am

How to localize property-name?

Post by stehwn »

Thanks a lot!

I'm looking forward to use my localized DisplayAttribute to change the property-name instead of showing an additional alias.

One thing:
If I create BO-hierachy like this:

//company
MoviNeo.MainModule.PrintingObjects.CompanyPrint printMe = new MoviNeo.MainModule.PrintingObjects.CompanyPrint(companyId);
report.RegBusinessObject(Properties.Resources.Firma, printMe);

//company-address
report.Dictionary.Synchronize();//hierachical

StiBusinessObject businessObject = report.Dictionary.BusinessObjects[Properties.Resources.Firma];
StiBusinessObject child = new StiBusinessObject();
child.Name = "Address";
child.Alias = Properties.Resources.Anschrift; //setting by attribute doesn't seem to work for objects
businessObject.BusinessObjects.Add(child);

report.Dictionary.Synchronize();

The sti-alias-attribute on Company.Address seems to be ignored. This is no problem because the alias can be set in code.
But when DisplayAttribute will get also ignored on objects how could I rename it (not alias)?
If Display-Attribute on objects would work, would this also mean that referencing the child.Name would also be by DisplayName?

Best Regards

UPDATE:
Renaming of child-names: After building the hierachy I just change the names and sync again. But all of the localized child-objects are showing empty alias-brackets and runtime failes because its searching for the wrong name.
But maybe there's a better way to do it.

UPDATE 2:
It seems that report-runtime-creation always fails when declaring child-BOs in code???
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

How to localize property-name?

Post by Jan »

Hello,

It is better to get sample project for your request. Is it possible? Sample project will help us solve this problems more quickly.

Thank you.
stehwn
Posts: 22
Joined: Wed Jul 08, 2009 8:20 am

How to localize property-name?

Post by stehwn »

Hi,

I'll try to create a repro-project(can't send the real one) in the next days using the new pre-release-version.

Best Regards
Steffen
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

How to localize property-name?

Post by Andrew »

Ok!

Thank you.
stehwn
Posts: 22
Joined: Wed Jul 08, 2009 8:20 am

How to localize property-name?

Post by stehwn »

Hi,

it seems that DisplyAttribute doesnt change the property's displayname but adds an alias(like the Sti-Attribute) in the designer.
Is this intendet? If it is - is it possible to let the designer just show the alias (maybe without the braces) - or maybe change the order so that alias is before the property-name.
90% of my future end-users will not understand english and might get confused by my property-names.

Best Regards



Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

How to localize property-name?

Post by Jan »

Hello,

Yes that correct behavior. You can hide Names with help of following static options:

Code: Select all

StiOptions.Dictionary.ShowOnlyAliasForBusinessObject = false;
            StiOptions.Dictionary.ShowOnlyAliasForComponents = false;
            StiOptions.Dictionary.ShowOnlyAliasForData = false;
            StiOptions.Dictionary.ShowOnlyAliasForDatabase = false;
            StiOptions.Dictionary.ShowOnlyAliasForDataColumn = false;
            StiOptions.Dictionary.ShowOnlyAliasForDataRelation = false;
            StiOptions.Dictionary.ShowOnlyAliasForDataSource = false;
            StiOptions.Dictionary.ShowOnlyAliasForPages = false;
            StiOptions.Dictionary.ShowOnlyAliasForVariable = false;
Thank you.
stehwn
Posts: 22
Joined: Wed Jul 08, 2009 8:20 am

How to localize property-name?

Post by stehwn »

Perfect!
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

How to localize property-name?

Post by Andrew »

Please let us know if we may be of any further assistance.

Thank you.
Post Reply