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); } }
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); } }
/// <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; }
public CustomMoLoader(Stream moStream, MoFileParser parser) : base(moStream, parser) { }
public CustomMoLoader(string filePath, MoFileParser parser) : base(filePath, parser) { }
public CustomMoLoader(string domain, string localeDir, MoFileParser parser) : base(domain, localeDir, parser) { }
public CustomMoLoader(Stream moStream, IPluralRuleGenerator pluralRuleGenerator, MoFileParser parser) : base(moStream, pluralRuleGenerator, parser) { }
public CustomMoLoader(string filePath, IPluralRuleGenerator pluralRuleGenerator, MoFileParser parser) : base(filePath, pluralRuleGenerator, parser) { }
public CustomMoLoader(string domain, string localeDir, IPluralRuleGenerator pluralRuleGenerator, MoFileParser parser) : base(domain, localeDir, pluralRuleGenerator, parser) { }
/// <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) { }
/// <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) { }
/// <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) { }