LanguageFactoryFindByKey Method |
Find a language using his key (culture info name like "en-GB", "fr-FR" etc...), return null if not found
Namespace:
AskiaPortalCmn
Assembly:
AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax public static ILanguage FindByKey(
IContext context,
string key
)
Public Shared Function FindByKey (
context As IContext,
key As String
) As ILanguage
public:
static ILanguage^ FindByKey(
IContext^ context,
String^ key
)
Parameters
- context
- Type: AskiaPortalCmnIContext
Context of execution - key
- Type: SystemString
Key of the language to find
Return Value
Type:
ILanguageReturn null if the language was not found
Examples
Find the language using his key
var context = ContextFactory.CreateByUserGuid(Guid.Parse("20BE5F84-F006-49A0-9674-4B16A090AF2D"));
var contextValidation = context.Validate();
if (!contextValidation.Success)
{
throw contextValidation.Exception;
}
var language = LanguageFactory.FindByKey(context, "fr-FR");
if (language != null)
{
Console.WriteLine("The id of the `{0}` is {1}", language.Key, language.Id);
}
else
{
Console.WriteLine("The specified language was not found.");
}
See Also