Search Results for

    Show / Hide Table of Contents

    Class DefaultLocalizationManager

    The standard localizer in CoFX / time cockpit. Loads and Save localization info via DefaultLocalizer to a compressed binary column (named APP_LocalizedDataModel) in APP_CultureInfo. If the column APP_LocalizedDataModel does not exist, no localization is performed and the InvariantFriendlyNames are returned.

    Inheritance
    System.Object
    NameLocalizer
    DefaultLocalizationManager
    Inherited Members
    NameLocalizer.GetLocalizedMemberNullMessage(ModelElement, ModelEntityBase)
    NameLocalizer.Resources
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: TimeCockpit.Data.Localization.Default
    Assembly: TimeCockpit.Data.dll
    Syntax
    public class DefaultLocalizationManager : NameLocalizer

    Constructors

    DefaultLocalizationManager()

    Initializes a new instance of the DefaultLocalizationManager class.

    Declaration
    public DefaultLocalizationManager()

    DefaultLocalizationManager(DefaultLocalizer, Dictionary<String, String>)

    Initializes a new instance of the DefaultLocalizationManager class.

    Declaration
    public DefaultLocalizationManager(DefaultLocalizer localizer, Dictionary<string, string> fallbackCultures)
    Parameters
    Type Name Description
    DefaultLocalizer localizer

    the localizer to use.

    System.Collections.Generic.Dictionary<System.String, System.String> fallbackCultures

    the fallback cultures.

    Methods

    BuildCultureFilterAndParams(IEnumerable<String>)

    Builds the query for selecting all cultures required to load.

    Declaration
    [Obsolete]
    public static Tuple<string, IEnumerable<QueryParameter>> BuildCultureFilterAndParams(IEnumerable<string> cultures)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.String> cultures

    The cultures to load.

    Returns
    Type Description
    System.Tuple<System.String, System.Collections.Generic.IEnumerable<QueryParameter>>

    Returns a tuple containing the query string and the query parameters.

    BuildFallbackChain(Dictionary<String, String>, HashSet<String>, String)

    builds a fallback chain from the .net cultures and the defined fallback cultures.

    Declaration
    public static Dictionary<string, string> BuildFallbackChain(Dictionary<string, string> fallbackCultures, HashSet<string> allRelevantCultures, string mainFallback)
    Parameters
    Type Name Description
    System.Collections.Generic.Dictionary<System.String, System.String> fallbackCultures

    The fallback cultures defined in the datamodel.

    System.Collections.Generic.HashSet<System.String> allRelevantCultures

    All relevant cultures.

    System.String mainFallback

    The fail-all fallback culture.

    Returns
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.String>

    Returns a string array defining the fallback culture.

    ClearUserLocalizations(IDataContext, IEnumerable<String>)

    Removes all user localizations for all cultures or for an optionally given list of cultures.

    Declaration
    public static void ClearUserLocalizations(IDataContext dataContext, IEnumerable<string> cultures = null)
    Parameters
    Type Name Description
    IDataContext dataContext

    The data context to clear.

    System.Collections.Generic.IEnumerable<System.String> cultures

    The cultures to remove.

    GetApplicationLocalizations(IDataContext)

    Gets the application specific localization information for the given culture.

    Declaration
    public static DefaultLocalizer GetApplicationLocalizations(IDataContext dataContext)
    Parameters
    Type Name Description
    IDataContext dataContext

    the data context to use.

    Returns
    Type Description
    DefaultLocalizer

    Returns a new localizer instance with the localizations loaded.

    GetLocalizedBackReferenceFriendlyName(Relation, CultureInfo)

    Returns the localized back reference friendly name for the specified model element.

    Declaration
    public override string GetLocalizedBackReferenceFriendlyName(Relation elementToTranslate, CultureInfo targetCulture)
    Parameters
    Type Name Description
    Relation elementToTranslate

    Model entity for which a property has to be translated. It has to be a type derived from ModelElement.

    System.Globalization.CultureInfo targetCulture

    Target culture for which the implementer has to provide a localized name. The CoFX UI will pass the current UI culture into this parameter.

    Returns
    Type Description
    System.String

    Localized text that CoFX has to use. A return value of null indicates that the back reference name has no translation. In this case CoFX will use the BackReferenceInvariantFriendlyName of the Relation.

    Overrides
    NameLocalizer.GetLocalizedBackReferenceFriendlyName(Relation, CultureInfo)

    GetLocalizedFriendlyName(ModelElement, CultureInfo)

    Returns the localized friendly name for the specified model element.

    Declaration
    public override string GetLocalizedFriendlyName(ModelElement elementToTranslate, CultureInfo targetCulture)
    Parameters
    Type Name Description
    ModelElement elementToTranslate

    Model entity for which a property has to be translated. It has to be a type derived from ModelElement.

    System.Globalization.CultureInfo targetCulture

    Target culture for which the implementer has to provide a localized name. The CoFX UI will pass the current UI culture into this parameter.

    Returns
    Type Description
    System.String

    Localized text that CoFX has to use. A return value of null indicates that the name has no translation. In this case CoFX will use the InvariantFriendlyName of the model element repectively the Message of the validation rule.

    Overrides
    NameLocalizer.GetLocalizedFriendlyName(ModelElement, CultureInfo)

    GetLocalizedMessage(ValidationRule, CultureInfo)

    Returns the localized validation rule message for the specified validation rule.

    Declaration
    public override string GetLocalizedMessage(ValidationRule elementToTranslate, CultureInfo targetCulture)
    Parameters
    Type Name Description
    ValidationRule elementToTranslate

    ValidationRule for which the message has to be translated.

    System.Globalization.CultureInfo targetCulture

    Target culture for which the implementer has to provide a localized name. The CoFX UI will pass the current UI culture into this parameter.

    Returns
    Type Description
    System.String

    Localized text that CoFX has to use. A return value of null indicates that the message has no translation. In this case CoFX will use the Message of the ValidationRule.

    Overrides
    NameLocalizer.GetLocalizedMessage(ValidationRule, CultureInfo)

    GetLocalizedMessage(Permission, CultureInfo)

    Returns the localized permission message for the specified permissions.

    Declaration
    public override string GetLocalizedMessage(Permission elementToTranslate, CultureInfo targetCulture)
    Parameters
    Type Name Description
    Permission elementToTranslate

    Permission for which the message has to be translated.

    System.Globalization.CultureInfo targetCulture

    Target culture for which the implementer has to provide a localized name. The CoFX UI will pass the current UI culture into this parameter.

    Returns
    Type Description
    System.String

    Localized text that CoFX has to use. A return value of null indicates that the message has no translation. In this case CoFX will use the Message of the Permission.

    Overrides
    NameLocalizer.GetLocalizedMessage(Permission, CultureInfo)

    GetLocalizedText(String, CultureInfo, String)

    Gets the localized text by looking at the localizer table loaded. If the target culture

    Declaration
    public override string GetLocalizedText(string textConstantIdentifier, CultureInfo targetCulture, string defaultText = null)
    Parameters
    Type Name Description
    System.String textConstantIdentifier

    The identifier of the text to translate.

    System.Globalization.CultureInfo targetCulture

    The target culture to translate to.

    System.String defaultText

    The default text to fallback to.

    Returns
    Type Description
    System.String

    Returns a localized string.

    Overrides
    NameLocalizer.GetLocalizedText(String, CultureInfo, String)

    GetUserLocalizations(IDataContext)

    Gets the user specific localization information for the given culture.

    Declaration
    public static DefaultLocalizer GetUserLocalizations(IDataContext dataContext)
    Parameters
    Type Name Description
    IDataContext dataContext

    the data context to use.

    Returns
    Type Description
    DefaultLocalizer

    returns a new localizer instance with the localization for the user specific parts.

    PrepareLocalizations(IDataContext)

    prepares the localizer to serve localizations specified.

    Declaration
    public override void PrepareLocalizations(IDataContext dataContext)
    Parameters
    Type Name Description
    IDataContext dataContext

    the data context to query for culture information.

    Overrides
    NameLocalizer.PrepareLocalizations(IDataContext)

    PrepareLocalizationsAsync(IDataContext)

    Prepares the localizer using the provided dataContext.

    Declaration
    public override Task PrepareLocalizationsAsync(IDataContext dataContext)
    Parameters
    Type Name Description
    IDataContext dataContext

    The datacontext to use.

    Returns
    Type Description
    System.Threading.Tasks.Task

    Returns the data context when done loading the localizations.

    Overrides
    NameLocalizer.PrepareLocalizationsAsync(IDataContext)

    SaveDirtyApplicationLocalizations(IDataContext, DefaultLocalizer)

    saves the localizations that have been modified to the app column.

    Declaration
    public static void SaveDirtyApplicationLocalizations(IDataContext dataContext, DefaultLocalizer localizations)
    Parameters
    Type Name Description
    IDataContext dataContext

    the data context to use.

    DefaultLocalizer localizations

    the localization to save.

    SaveDirtyUserLocalizations(IDataContext, DefaultLocalizer)

    saves the localizations that have been modified to the user column in the culture info. Before saving the localization, the localization info is reloaded and updates are merged from the localization info in the database.

    Declaration
    public static void SaveDirtyUserLocalizations(IDataContext dataContext, DefaultLocalizer localizations)
    Parameters
    Type Name Description
    IDataContext dataContext

    the data context to use.

    DefaultLocalizer localizations

    the localization to store.

    SetFallbackCultures(IDataContext)

    sets the fallback cultures.

    Declaration
    public void SetFallbackCultures(IDataContext dataContext)
    Parameters
    Type Name Description
    IDataContext dataContext

    The data context to load localizations from.

    In This Article
    Back to top Copyright © 2020 software architects gmbh