Global instance of language information

Namespace:  EPiServer
Assembly:  EPiServer (in EPiServer.dll) Version: 5.2.375.236

Syntax

C#
[ObsoleteAttribute("Use LanguageManager.Instance instead.")]
public static LanguageManager EPLang { get; set; }

Remarks

The main use for the EPLang property is to translate EPiServer strings into the current language. EPLang is an instantce of LanguageManager, which has a property, Directory, and a few methods. It is the Translate method that is primarily used.

By default, EPiServer will monitor the BaseDirectory + "/lang" directory for language files.

Translate has two overloaded variants. The first one is used in the first two code examples below. It takes a string argument, key, in a simplified XML XPath form and returns the proper language string. The key is typically something like "/admin/settings/heading", where the expression closely follows the folder/ file/ usage pattern. You can also enter "#" to automatically construct a path to the current file. For example, calling the Translate method in the file /templates/mypage.aspx with the key set to '#heading', Translate( "#heading" ) is equivalent to Translate( "/templates/mypage/heading").

Note: Note: If the key does not begin with a "/" or "#", the key itself is simply returned as the result. The reason for this behavior is to be able to use EPiServer Web controls that use Translate for visible strings, but you might not have translations in place or you prefer not to translate the text.

The second form of Translate takes two string arguments, the first again being a key used in the same way as earlier, and the second argument being a language identifier.

See Also