This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, I'm trying to localize the validation messages, but something stroke me: How can I translate the table names / column names? I think (almost) everyone designs the model in english language, e.g. Customer table, which has a Firstname and Lastname, but when displaying validation errors, Lightspeed displays these messages using (I guess) Name property of the table/column which is still in English! A solution would be to have a "Caption" property on table / column level in the designer but that works only when application supports one single non-english langauge. Any ideas how this can be done?
|
|
|
Aaugh. Good question. As you know, we support localising the messages, but at the moment we just format in the property's "friendly name" (basically, the property name with spaces added between words) directly. There's no way to intercept either the formatting process or the derivation of the "friendly name." I'll take a look at this -- what's the urgency? |
|
|
It is not urgent but it is nice to have. I have a workaround to my problem and that is use other validations, e.g. Castle Validator's attributes added to the properties and adding the localized castle validation messages in OnValidating method of the entity, but as I said, it is best to have this natively in the Lightspeed. |
|
|
Sorry to rush you guys, but as the delivery date of my application draws near, I really need to find a way to do this. Any progress so far? Any feedback is really appreciated. |
|
|
I've added a new interface, IDisplayNamingStrategy, which will be in the next nightly build (29 April 2010). This contains one member (for now), GetDisplayName, which takes a property's default display name and an entity type, and returns the desired display name. Set LightSpeedContext.DisplayNamingStrategy in code, or displayNamingStrategyClass in config, to specify a display naming strategy. You can then implement your strategy to look in a resource file or whatever: private class MyDisplayNamingStrategy : IDisplayNamingStrategy { Notes: * The DisplayNamingStrategy is currently used only for validations. For example, if a database error occurs, that will NOT go through the DisplayNamingStrategy. This is because we believe that validation errors are the only ones which would normally be presented directly to the user: for "programmer-facing" errors it would just be confusing to put localised names in the error message. We welcome feedback on other scenarios where we should be supporting localisation. * The DisplayNamingStrategy currently supports only property naming (because of the restriction to validations). If you have a scenario where you need to be able to localise type names as well, let us know. * Because the DisplayNamingStrategy is associated with a LightSpeedContext, it will be used ONLY for entities which are associated with a unit of work -- i.e. entities loaded from the database, or for which Add or Attach has been called. Until the entity is associated with a UOW, it will use the default names. We welcome feedback on whether this meets your requirements or how it could be improved. |
|