How load localization file from resource?

jabijabi Czech Republic
edited 2:46AM in FastReport .NET
Hello Alex,

method static void FastReport.Utils.Res LoadLocale(string fileName) can load localization from external file. How can I load this localization data from resource (or Stream in general)?

Thanks

Comments

  • jabijabi Czech Republic
    edited 2:46AM
    No answer? Can I integrate localization files into EXE file?
  • edited 2:46AM
    Hello,

    I will add overloaded Res.LoadLocale method in the next daily build.
  • jabijabi Czech Republic
    edited 2:46AM
    Thanks very much >
  • edited September 2011
    How to use it? Is it possible today?

    I try this, but there is error:
    Stream theMemStream = new MemoryStream();
    theMemStream.Write(Resources.FastReportLanguage, 0, Resources.FastReportLanguage.Length);
    FastReport.Utils.Res.LoadLocale((Stream)theMemStream);
    

    This is error code:
    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> FastReport.Utils.FileFormatException: Cannot load the file. Unknown file format
       at FastReport.Utils.XmlReader.RaiseException()
       at FastReport.Utils.XmlReader.ReadItem(XmlItem item)
       at FastReport.Utils.XmlReader.ReadHeader()
       at FastReport.Utils.XmlReader.Read(XmlItem item)
       at FastReport.Utils.XmlDocument.Load(Stream stream)
       at FastReport.Utils.Res.LoadLocale(Stream stream)
    
  • edited 2:46AM
    Could you send me the complete example project to tz@fast-report.com?
  • edited 2:46AM
    Ok, I was sent you an email too. Thanks.
  • edited 2:46AM
    The error in your code is that you don't reset the stream Position to 0. \
    Stream theMemStream = new MemoryStream();
    theMemStream.Write(Resources.FastReportLanguage, 0, Resources.FastReportLanguage.Length);
    theMemStream.Position = 0;
    FastReport.Utils.Res.LoadLocale((Stream)theMemStream);
    

    or, the shorter
    Stream theMemStream = new MemoryStream(Resources.FastReportLanguage);
    FastReport.Utils.Res.LoadLocale(theMemStream);
    
  • edited 2:46AM
    Thanks, its working.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.