当前位置: 首页>>代码示例>>C#>>正文


C# Localizer.AddLocalization方法代码示例

本文整理汇总了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;
                    }
开发者ID:Jeremiahf,项目名称:wix3,代码行数:67,代码来源:light.cs


注:本文中的Localizer.AddLocalization方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。