Search Results for

    Show / Hide Table of Contents

    Class Translator

    Translator component helps in translating aplications to multiple languages using current user regional configuration loads the specified file with the regional extension for the file

    Inheritance
    object
    MarshalByRefObject
    Component
    Translator
    Implements
    IComponent
    IDisposable
    Inherited Members
    Component.Dispose()
    Component.GetService(Type)
    Component.ToString()
    Component.CanRaiseEvents
    Component.Events
    Component.Site
    Component.Container
    Component.DesignMode
    Component.Disposed
    MarshalByRefObject.GetLifetimeService()
    MarshalByRefObject.InitializeLifetimeService()
    MarshalByRefObject.MemberwiseClone(bool)
    object.GetType()
    object.MemberwiseClone()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Reportman.Drawing
    Assembly: Reportman.Drawing.dll
    Syntax
    public class Translator : Component, IComponent, IDisposable

    Constructors

    Translator()

    Simple constructor for the Translator component

    Declaration
    public Translator()

    Translator(IContainer)

    Translator is a component to help the translation of applications in multiple languages. It can open a translation file created from Report Manager Translation utility. It's capable of searching for a file with a file extension according to the regional settings, that is for example if regional setting is Spanish Mexico, it will search for a file with extension .ESM, but if not found, it will search for a file with extension .ES.

    Declaration
    public Translator(IContainer container)
    Parameters
    Type Name Description
    IContainer container

    The container of the Translator, when used in Windows.Forms designer

    Fields

    ResourceAssembly

    Declaration
    public Assembly ResourceAssembly
    Field Value
    Type Description
    Assembly

    Properties

    Active

    Set this property to true to open the resource file. Before obtaining translations, this property must be set.

    Declaration
    public bool Active { get; set; }
    Property Value
    Type Description
    bool

    AutoLocale

    When this property is set to true, the provided file name will extended with the current user regional extension

    Declaration
    public bool AutoLocale { get; set; }
    Property Value
    Type Description
    bool

    Count

    Number of items in the resource file

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    Filename

    Resource file to load strings from, you usually provide the file name without extension, so with, Autolocale set to true, the extension will be added based on the current user regional settings.

    Declaration
    public string Filename { get; set; }
    Property Value
    Type Description
    string

    this[int]

    You can access translation providing an integer index. The Active property must be set to true before accessing translations

    Declaration
    public string this[int index] { get; }
    Parameters
    Type Name Description
    int index
    Property Value
    Type Description
    string

    LookForResource

    Declaration
    public bool LookForResource { get; set; }
    Property Value
    Type Description
    bool

    Methods

    AddString(string)

    You can add elements to the resource using this function.

    Declaration
    public int AddString(string astring)
    Parameters
    Type Name Description
    string astring
    Returns
    Type Description
    int

    Returns the index for the element added.

    Dispose(bool)

    Dispose used elements.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing
    Overrides
    Component.Dispose(bool)

    FileExists()

    Check if the resource file exists.

    Declaration
    public bool FileExists()
    Returns
    Type Description
    bool

    Returns true if the resource file exists or a resource can be found

    FindAssemblyResource(string)

    Declaration
    public static Stream FindAssemblyResource(string nfilename)
    Parameters
    Type Name Description
    string nfilename
    Returns
    Type Description
    Stream

    FindResource()

    Declaration
    public Stream FindResource()
    Returns
    Type Description
    Stream

    FindResource(bool, ref bool, string, Assembly)

    Declaration
    public static Stream FindResource(bool searchonly, ref bool found, string nfilename, Assembly ResourceAssembly)
    Parameters
    Type Name Description
    bool searchonly
    bool found
    string nfilename
    Assembly ResourceAssembly
    Returns
    Type Description
    Stream

    GetLanguageDescriptions(IList)

    Fills a list with language descriptions

    Declaration
    public static void GetLanguageDescriptions(IList alist)
    Parameters
    Type Name Description
    IList alist

    LoadFromFile(string)

    Load the resource from a file.

    Declaration
    public void LoadFromFile(string filename)
    Parameters
    Type Name Description
    string filename

    LoadFromStream(Stream)

    Load the resource from any Stream.

    Declaration
    public void LoadFromStream(Stream astream)
    Parameters
    Type Name Description
    Stream astream

    SaveFileJson(string)

    Declaration
    public void SaveFileJson(string fileName)
    Parameters
    Type Name Description
    string fileName

    SaveFileJsonDefault(string)

    Declaration
    public static void SaveFileJsonDefault(string fileName)
    Parameters
    Type Name Description
    string fileName

    SetDefaultTranslatorPath(string)

    You can override the default path to the search of translation files, useful for example when your translation files are not in the application directory, for example in web applications

    Declaration
    public static void SetDefaultTranslatorPath(string apath)
    Parameters
    Type Name Description
    string apath

    TranslateStr(int)

    TranslateStr is a class function, can be called without instantiating any Translator, it will look for reportmanres.xxx resource files the file must be in path, else a default string will be returned

    this.Text=Reportman.Translator.TranslateStr(4);
    Declaration
    public static string TranslateStr(int index)
    Parameters
    Type Name Description
    int index
    Returns
    Type Description
    string

    UpdateContent()

    Call this method to reload content from resource file

    Declaration
    public void UpdateContent()

    Implements

    IComponent
    IDisposable
    In this article
    Back to top Generated by DocFX