本文整理汇总了C#中Localizer.AddLocalization方法的典型用法代码示例。如果您正苦于以下问题:C# Localizer.AddLocalization方法的具体用法?C# Localizer.AddLocalization怎么用?C# Localizer.AddLocalization使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Localizer
的用法示例。
在下文中一共展示了Localizer.AddLocalization方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
//.........这里部分代码省略.........
foreach (string bindPath in this.bindPaths)
{
if (-1 == bindPath.IndexOf('='))
{
this.sourcePaths.Add(bindPath);
}
}
}
// instantiate the localizer and load any localization files
if (!this.suppressLocalization || 0 < this.localizationFiles.Count || null != this.cultures || !this.outputXml)
{
List<Localization> localizations = new List<Localization>();
localizer = new Localizer();
localizer.Message += new MessageEventHandler(this.messageHandler.Display);
// load each localization file
foreach (string localizationFile in this.localizationFiles)
{
Localization localization = Localization.Load(localizationFile, linker.TableDefinitions, this.suppressSchema);
localizations.Add(localization);
}
if (null != this.cultures)
{
// add localizations in order specified in cultures
foreach (string culture in this.cultures)
{
foreach (Localization localization in localizations)
{
if (culture.Equals(localization.Culture, StringComparison.OrdinalIgnoreCase))
{
localizer.AddLocalization(localization);
}
}
}
}
else
{
bool neutralFound = false;
foreach (Localization localization in localizations)
{
if (0 == localization.Culture.Length)
{
// if a neutral wxl was provided use it
localizer.AddLocalization(localization);
neutralFound = true;
}
}
if (!neutralFound)
{
// cultures wasn't specified and no neutral wxl are available, include all of the files
foreach (Localization localization in localizations)
{
localizer.AddLocalization(localization);
}
}
}
// immediately stop processing if any errors were found
if (this.messageHandler.EncounteredError)
{
return this.messageHandler.LastErrorNumber;
}