Example #1
0
 public void TestManualEncoding()
 {
     using (var stream = File.OpenRead(Path.Combine(LocalesDir, Path.Combine("ru_RU", Path.Combine("LC_MESSAGES", "Test_KOI8-R.mo")))))
     {
         var parser     = new MoFileParser(Encoding.GetEncoding("KOI8-R"), false);
         var parsedFile = parser.Parse(stream);
         this._TestLoadedTranslation(parsedFile.Translations);
     }
 }
Example #2
0
 public void TestBigEndianParsing()
 {
     using (var stream = File.OpenRead(Path.Combine(LocalesDir, Path.Combine("ru_RU", Path.Combine("LC_MESSAGES", "Test_BigEndian.mo")))))
     {
         var parser     = new MoFileParser();
         var parsedFile = parser.Parse(stream);
         this._TestLoadedTranslation(parsedFile.Translations);
     }
 }
Example #3
0
        /// <summary>
        /// Load translations from given MO file stream using given encoding (UTF-8 encoding by default).
        /// </summary>
        /// <param name="moStream">Stream that contain binary data in the MO file format</param>
        /// <param name="encoding">File encoding (UTF-8 by default)</param>
        public void Load(Stream moStream, Encoding encoding = null)
        {
            var parser = new MoFileParser();

            if (encoding != null)
            {
                parser.Encoding = encoding;
            }

            var translations = parser.GetTranslations(moStream);

            this.Translations = translations;
        }
Example #4
0
File: T.cs Project: FPLedit/FPLedit
 public CustomMoLoader(Stream moStream, MoFileParser parser) : base(moStream, parser)
 {
 }
Example #5
0
File: T.cs Project: FPLedit/FPLedit
 public CustomMoLoader(string filePath, MoFileParser parser) : base(filePath, parser)
 {
 }
Example #6
0
File: T.cs Project: FPLedit/FPLedit
 public CustomMoLoader(string domain, string localeDir, MoFileParser parser) : base(domain, localeDir, parser)
 {
 }
Example #7
0
File: T.cs Project: FPLedit/FPLedit
 public CustomMoLoader(Stream moStream, IPluralRuleGenerator pluralRuleGenerator, MoFileParser parser) : base(moStream, pluralRuleGenerator, parser)
 {
 }
Example #8
0
File: T.cs Project: FPLedit/FPLedit
 public CustomMoLoader(string filePath, IPluralRuleGenerator pluralRuleGenerator, MoFileParser parser) : base(filePath, pluralRuleGenerator, parser)
 {
 }
Example #9
0
File: T.cs Project: FPLedit/FPLedit
 public CustomMoLoader(string domain, string localeDir, IPluralRuleGenerator pluralRuleGenerator, MoFileParser parser) : base(domain, localeDir, pluralRuleGenerator, parser)
 {
 }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MoLoader"/> class which will try to load a MO file
 /// from the specified stream.
 /// <see cref="CompiledPluralRuleGenerator"/> will be used to generate a plural form rule.
 /// </summary>
 /// <param name="moStream"></param>
 /// <param name="parser"></param>
 public MoCompilingPluralLoader(Stream moStream, MoFileParser parser)
     : base(moStream, new CompiledPluralRuleGenerator(), parser)
 {
 }
Example #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MoLoader"/> class which will try to load a MO file
 /// from the specified path.
 /// <see cref="CompiledPluralRuleGenerator"/> will be used to generate a plural form rule.
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="parser"></param>
 public MoCompilingPluralLoader(string filePath, MoFileParser parser)
     : base(filePath, new CompiledPluralRuleGenerator(), parser)
 {
 }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MoLoader"/> class which will try to load a MO file
 /// that will be located in the localeDir using the domain name and catalog's culture info.
 /// <see cref="CompiledPluralRuleGenerator"/> will be used to generate a plural form rule.
 /// </summary>
 /// <param name="domain"></param>
 /// <param name="localeDir"></param>
 /// <param name="parser"></param>
 public MoCompilingPluralLoader(string domain, string localeDir, MoFileParser parser)
     : base(domain, localeDir, new CompiledPluralRuleGenerator(), parser)
 {
 }