Localization Business Objects

The following business objects are used to provide localization services in MM .NET:

Localization Business Object Properties and Methods

Here is a description of each object and its commonly used properties and methods.


Note: If you change the names of localization tables or fields listed in the Localization Tables Help topic, you must change the corresponding table and field name properties in the business objects listed below. Alternately, you can change the corresponding SQL SELECT commands stored in properties of the business object, or simply override a business object method (for example, if you want to run a stored procedure rather than using SQL Pass-through). For details, see the section below "Overriding Localization Business Object Data Access Settings".


mmLanguageManager

Properties

  • TableName - Name of the Language table
  • PrimaryKey - Name of the Primary Key field in the Language table
  • PrimaryKeyFieldType - Type of the Primary Key field
  • CultureField - Name of the Culture field in the Language table
  • DescriptionField - Name of the description field in the Language table
  • CurrentLanguage - The primary key of the current language
  • DefaultLanguage - Application default language (used when application first starts up before users log in)
  • GetAllLanguagesCmd - SQL SELECT command executed in the GetAllLanguages method
  • GetCultureCmd - SQL SELECT command executed in the GetCulture method
  • OriginalLanguage - Primary key of the "original" language used to design the application

Methods

  • AddLanguage - (Overloaded) Adds the specified language and optional culture to the Language table
  • DeleteLanguage - Deletes the specified Language
  • GetAllLanguages - Returns a DataSet containing all languages
  • GetCulture - Gets the culture for the specified language
  • IsOriginalLanguage - Returns a boolean value indicating if the specified language is the "original" language
  • SetCulture - (Overloaded) Sets the culture of the current thread based on the specified culture string (en-US, de-CH, de-DE, etc.) or sets the culture of the specified language

mmMessageManager

Properties

  • TableName - Name of the Message table
  • PrimaryKey - Name of the Primary Key field in the Message table
  • DescriptionField - Name of the description field in the Message table
  • DialogTextField - Name of the DialogText field in the Message table
  • DialogTextFieldType - Type of the DialogText field in the Message table
  • GetMessageCmd - SQL SELECT command executed in the GetMessage method
  • LanguageField - Name of the Language foreign key field in the Message table
  • LanguageFieldType - Type of the Language field in the Message table
  • LocalizeSetupText - ArrayList of text retrieved from the specified UI element (form, menu, toolbar) during Localize Setup
  • MessageKeyField - Name of the MessageKey field in the Message table
  • MessageTextField - Name of the MessageText field in the Message table
  • Separator - The separator character used for labels (colon ":" by default). This trailing character is stripped off during language translation

Methods

  • AddDialogSetupText - Adds the Dialog Setup text to the LocalizeSetupText ArrayList
  • AddLocalizeSetupText - Adds the specified text to the LocalizeSetup text ArrayList if it's not there already
  • GetAllMessages - Returns a list of all messages for a specific language
  • GetDialogText - Returns all original language dialog text from the Message table
  • GetMessage - (Overloaded) Returns the message associated with the specified message key for the current or specified language
  • GetMessageCache - Returns a string dictionary of messages that consist of the Key (MessageKey) and Text (MessageText) indexed by the MessageKey. Only one language at a time is loaded to provide limited delayed loading capabilities. The optional ForceLoad parameter specifies if the message cache should be reloaded from disk
  • RemoveSeparator - (Overloaded) - Removes the separator character from the specified string
  • SaveTranslatedText - Saves the specified translated text

Overriding Localization Business Object Data Access Settings

At times you may want to override the default table names, fields, and SQL SELECT statements used in the localization business objects. This section explains how to do this.

To override the name of table or fields used by a localization business object, you need to create a subclass of that business object and change your application's Factory class to instantiate your new subclass.

For example, the following steps show how you can change the name of the table and primary key used by the mmLanguageManager business object:

  1. In the Solution Explorer, right-click your ABusinessObject.cs or ABusinessObject.vb file and select View Code from the shortcut menu or you can choose to put the new class definition in its own source code file (which we think is preferable).

  2. Add the following class definition code to the file:

    In C#:

    public class LanguageManager : mmLanguageManager
    {
    	// Constructor
    	public LanguageManager ()
    	{
    		this.TableName = "Languages";
    		this.PrimaryKey = "Language_PK";
    	}
    }

    And in VB .NET:

    Public Class LanguageManager
       Inherits mmLanguageManager
       
       ' Constructor
       Public Sub New()
         Me.TableName = "Languages"
         Me.PrimaryKey = "Language_PK"
       End Sub
    
    End Class

  3. In the Solution Explorer, right-click the Factory.cs or Factory.vb file and add the following override of the CreateLanguageManager factory method:

    In C#:

    /// <summary>
    /// Summary description for CustomFactory.
    /// </summary>
    public class Factory : OakLeaf.MM.Main.Windows.Forms.mmFactoryDesktop
    {
    	/// <summary>
    	/// Creates a new Language Manager object
    	/// </summary>
    	/// <returns>Language Manager object</returns>
    	public override mmLanguageManager CreateLanguageManager()
    	{
    		return new LanguageManager();
    	}
    }

    And in VB .NET:

    Namespace Main
        ' Application-level Factory
        Public Class Factory
            Inherits OakLeaf.MM.Main.Windows.Forms.mmFactoryDesktop
    
       ' Creates a new Language Manager object
       Public Overrides Function CreateLanguageManager() As mmLanguageManager
          Return New LanguageManager()
       End Function
    
        End Class
    End Namespace

Overriding Data Access Methods

If you want to completely override the SELECT statement used by a localization business object, you can do so by overriding the object's corresponding SQL SELECT command property. For example, if you want to change the SQL SELECT statement used by the mmLanguageManager object's GetAllLanguages method, you would override the corresponding GetAllLanguagesCmd property Get accessor:

In C#:

public class LanguageManager : mmLanguageManager
{
	// Constructor
	public Role()
	{

	}
	protected override string GetAllLanguagesCmd
	{
		get
		{
			return "SELECT LanguagePK, Description FROM Language";
		}
	}
}

And in VB .NET:

Public Class LanguageManager
   Inherits mmLanguageManager
   
   ' Constructor
   Public Sub New()

   End Sub 
   
   Protected Overrides ReadOnly Property GetAllRolesCmd() As String
      Get
         Return "SELECT LanguagePK, Description FROM Language"
      End Get
   End Property
End Class

© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/26/18
Comment or report problem with topic