Mindscape
  • Register
  • Login
  • YOUR CART IS EMPTY
home
Software
  • Developers Toolbox
  • LightSpeed
  • Raygun
  • WPF Elements
  • Web Workbench
  • Metro Elements
  • Silverlight Elements
  • NHibernate Designer
  • Phone Elements
  • WPF Diagrams
  • Simple DB management
  • Visual Tools for SharePoint
Downloads
Store
  • Buy online
  • Purchase order
  • Volume discounts
  • Reseller
  • Software license
  • Contact sales
Blog
Support
About
  • About Us
  • Contact
  • Testimonials
rss
twitter
facebook
Building Applications with LightSpeed Configuration Localizing LightSpeed Messages Customising How LightSpeed Connects to the Database

Localizing LightSpeed Messages

All of LightSpeed’s localizable resources such as error and validation messages are kept in a single resources file (Resources.resx). This file is made available as part of the LightSpeed installation and can be found in the Localization folder under the LightSpeed installation directory.

To localize LightSpeed messages, translate the messages in Resources.resx, build the translation into a satellite DLL and deploy the satellite DLL alongside your application.  A sample illustrating how to produce and deployed a localized satellite resource assembly can be found in the Samples folder.

Localizing Property Names

Although you can localize messages such as validation messages via a satellite assembly, in some cases, specifically validation, these messages contain placeholders which LightSpeed will fill in with property names – that is, the same names you use in your code.  Normally, as per the ‘ubiquitous language’ of domain driven development, you will use property names which are familiar to your users.  But if you are serving users in multiple locales then you may need to display different property names in each locale, so you will have to convert from the .NET property names to localized display names.

To do this, create an implementation of the IDisplayNamingStrategy interface to perform the translation and return the translated name.  Here is an example which simply looks up the property name in the application resources, allowing you to localize names through a satellite DLL.

Implementing IDisplayNamingStrategy

public class ResourceLookupStrategy : IDisplayNamingStrategy
{
  public string GetDisplayName(string defaultName, Type entityType)
  {
    string resourceKey = entityType.Name + "_" + defaultName;
    return ResourceManager.GetString(resourceKey); // uses current culture
  }
}

To use this strategy, set LightSpeedContext.DisplayNamingStrategy in code, or the displayNamingStrategyClass attribute in  configuration.

Specifying a display naming strategy in configuration

<add name="Test"
     displayNamingStrategyClass="MyApp.ResourceLookupStrategy, MyAssembly" />

Specifying a display naming strategy in code

_context.DisplayNamingStrategy = new ResourceLookupStrategy();

Data Products

  • LightSpeed ORM
  • NHibernate Designer
  • SimpleDB Tools
  • SharePoint Tools

DevOp Tools

  • Raygun

Visual Controls

  • WPF Elements
  • WPF Diagrams
  • Silverlight Elements
  • Phone Elements

Popular Products

  • Web Workbench

    Modern web development for Visual Studio!

  • Mindscape Megapack

    All Mindscape products for one awesome price!

Quick Links

  • Forums
  • Blog
  • Register
  • Login
  • Contact us
  • Twitter
  • Facebook
  • Google+
  • YouTube
  • Linkedin
  • Rss

© Mindscape 2025. Mindscape is a registered trademark of Mindscape Limited.

  • Terms
  • Privacy