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


C# ITranslator.Translate方法代码示例

本文整理汇总了C#中ITranslator.Translate方法的典型用法代码示例。如果您正苦于以下问题:C# ITranslator.Translate方法的具体用法?C# ITranslator.Translate怎么用?C# ITranslator.Translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITranslator的用法示例。


在下文中一共展示了ITranslator.Translate方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GameOfLife

 public GameOfLife(String gameInput, GameCriteria criteria, 
                   ITranslator<GameData> translator, BoardFactory boardFactory)
 {
     this.criteria = criteria;
     var gameData = translator.Translate(gameInput);
     board = boardFactory.GetBoard(gameData);
 }
开发者ID:kevPo,项目名称:GameOfLife,代码行数:7,代码来源:GameOfLife.cs

示例2: OnPreInit

        protected override void OnPreInit(EventArgs e)
        {
            base.OnPreInit(e);
            Translator = IoC.Get<ITranslator>();

            Page.Title = Translator.Translate("/ImageSlideShow/EditModeProperty/SlideEditor/Title");
            MasterPageFile = VirtualPaths.PlugInMasterPage;
        }
开发者ID:kirolosgerges,项目名称:Blog,代码行数:8,代码来源:ImageSlideEditor.aspx.cs

示例3: SetUp

        public void SetUp()
        {
            console = Substitute.For<IConsole>();
            translator = Substitute.For<ITranslator>();
            translator.Translate("GeneralHelpMessage").Returns("foo");

            routine = new HelpRoutine(console, translator);
        }
开发者ID:daniellee,项目名称:Cloney,代码行数:8,代码来源:HelpRoutineBehavior.cs

示例4: SetUp

        public void SetUp()
        {
            console = Substitute.For<IConsole>();
            translator = Substitute.For<ITranslator>();
            translator.Translate("SettingsMessage").Returns("{0}{1}{2}");

            routine = new SettingsRoutine(console, translator);
        }
开发者ID:daniellee,项目名称:Cloney,代码行数:8,代码来源:SettingsRoutineBehavior.cs

示例5: SetUp

        public void SetUp()
        {
            console = Substitute.For<IConsole>();
            translator = Substitute.For<ITranslator>();
            translator.Translate("GuiStartMessage").Returns("message");
            process = Substitute.For<IProcess>();

            routine = new GuiRoutine(console, translator, process);
        }
开发者ID:daniellee,项目名称:Cloney,代码行数:9,代码来源:GuiRoutineBehavior.cs

示例6: MasterSetUp

        public void MasterSetUp()
        {
            args = new[] { "foo" };

            ArgumentParser = Substitute.For<ICommandLineArgumentParser>();
            Console = Substitute.For<IConsole>();
            Translator = Substitute.For<ITranslator>();
            Translator.Translate(Arg.Any<string>()).Returns(x => x[0]);
        }
开发者ID:faktumsoftware,项目名称:Cloney,代码行数:9,代码来源:SubRoutineTestBase.cs

示例7: SetUp

        public void SetUp()
        {
            arguments = new List<string> { "foo", "bar" };
            console = Substitute.For<IConsole>();
            translator = Substitute.For<ITranslator>();
            translator.Translate(Arg.Any<string>()).Returns(x => x[0]);
            subRoutineLocator = Substitute.For<ISubRoutineLocator>();

            program = new Program(console, translator, subRoutineLocator);
        }
开发者ID:faktumsoftware,项目名称:Cloney,代码行数:10,代码来源:ProgramBehavior.cs

示例8: SetUp

        public void SetUp()
        {
            console = Substitute.For<IConsole>();
            translator = Substitute.For<ITranslator>();
            translator.Translate("NoRoutineMatchMessage").Returns("foo");
            argumentParser = Substitute.For<ICommandLineArgumentParser>();
            subRoutineLocator = Substitute.For<ISubRoutineLocator>();

            program = new Program(console, translator, argumentParser, subRoutineLocator);
            arguments = new List<string> { "foo", "bar" };

            SetUpLanguage();
        }
开发者ID:daniellee,项目名称:Cloney,代码行数:13,代码来源:ProgramBehavior.cs

示例9: SetUp

        public void SetUp()
        {
            console = Substitute.For<IConsole>();
            console.ReadLine().Returns("input value");

            translator = Substitute.For<ITranslator>();
            translator.Translate("EnterFolderPath").Returns("{0}");

            solutionCloner = Substitute.For<ISolutionCloner>();

            routine = new CloneRoutine(console, translator, solutionCloner);
        }
开发者ID:daniellee,项目名称:Cloney,代码行数:12,代码来源:CloneRoutineBehavior.cs

示例10: ExtractResourcesToDataSet

        GlobalizationDataSet ExtractResourcesToDataSet(string sourceCulture, string targetCulture, ITranslator translator)
        {
            int resourceCount = 0;

            GlobalizationDataSet ds = new GlobalizationDataSet();

            List<string> files = GetAssemblyFileList(applicationPath);

            foreach (string file in files)
            {
                int fileResourceCount = 0;

                GlobalizationDataSet.CulturalResourcesRow newrow;

                Assembly resourceAssembly = ResolveResourceAssembly(file, sourceCulture);

                // skip missing satellite assemblies
                if (resourceAssembly == null) continue;

                string[] resourceNames = resourceAssembly.GetManifestResourceNames();
                foreach (string resourceName in resourceNames)
                {

                    this.AppendToLog("Processing resource '{0}'", resourceName);

                    string manifestResourceName = resourceName;

                    // trim off any culture specification from satellite manifest resource name
                    if (manifestResourceName.EndsWith("." + sourceCulture + ".resources", true, CultureInfo.InvariantCulture))
                    {
                        manifestResourceName = manifestResourceName.Substring(0, manifestResourceName.Length - (1 + sourceCulture.Length + ".resources".Length));
                        manifestResourceName += ".resources";
                    }

                    if (manifestResourceName.EndsWith(".resources"))
                    {
                        using (ResourceReader reader = new ResourceReader(resourceAssembly.GetManifestResourceStream(resourceName)))
                        {
                            bool isSharedStrings = manifestResourceName.EndsWith("SharedStrings.resources");

                            IDictionaryEnumerator enumerator = reader.GetEnumerator();
                            while (enumerator.MoveNext())
                            {
                                if (isSharedStrings || IsTextResource(enumerator.Entry))
                                {
                                    fileResourceCount++;

                                    string assemblyName = resourceAssembly.GetName().Name;

                                    // discard any .resource suffix on the end (satellite assemblies)
                                    if (assemblyName.EndsWith(".resources", true, CultureInfo.InvariantCulture))
                                    {
                                        assemblyName = assemblyName.Substring(0, assemblyName.Length - ".resources".Length);
                                    }

                                    string sourceText = enumerator.Value.ToString();

                                    this.AppendToLog(SharedStrings.TRANSLATING, sourceText);

                                    string translatedText = translator.Translate(sourceCulture, targetCulture, sourceText);

                                    newrow = ds.CulturalResources.NewCulturalResourcesRow();
                                    newrow.AssemblyName = assemblyName;
                                    newrow.ResourceVersion = this.GetSatelliteContractVersion(resourceAssembly).ToString();
                                    newrow.ManifestResourceName = manifestResourceName;
                                    newrow.ResourceName = enumerator.Key.ToString();
                                    newrow.ResourceValue = translatedText;
                                    newrow.ResourceType = enumerator.Value.GetType().FullName;
                                    newrow.SourceCultureName = sourceCulture;
                                    newrow.SourceValue = sourceText;

                                    ds.CulturalResources.AddCulturalResourcesRow(newrow);

                                }
                            }
                        }
                    }
                    else
                    {
                        // embedded resource does not end with .resources
                        continue;
                    }
                }

                this.AppendToLog(SharedStrings.EXTRACTION_COUNT, file, fileResourceCount);
                resourceCount += fileResourceCount;
            }

            this.AppendToLog(SharedStrings.EXTRACTION_COMPLETE, resourceCount);

            return ds;
        }
开发者ID:NALSS,项目名称:epiinfo-82474,代码行数:92,代码来源:ResourceTool.cs

示例11: GetTranslation

 public override List<LowLevelCommand> GetTranslation(ITranslator translator, Report current)
 {
     return translator.Translate(current, this);
 }
开发者ID:kentmkmb,项目名称:StrategyTester,代码行数:4,代码来源:StoppingAt.cs

示例12: SetUp

        public void SetUp()
        {
            _translator = Substitute.For<ITranslator>();
            _translator.Translate(GetPropertyResourceKey()).Returns("bar");
            _translator.Translate(GetValidationAttributeResourceKey()).Returns("bar");
            _translator.TranslationExists(GetPropertyResourceKey()).Returns(true);
            _translator.TranslationExists(Arg.Is<string>(x => x != GetPropertyResourceKey())).Returns(false);
            _translator.TranslationExists(GetValidationAttributeResourceKey()).Returns(true);
            _translator.TranslationExists(Arg.Is<string>(x => x != GetValidationAttributeResourceKey())).Returns(false);

            _provider = new ProviderWrapper(_translator, true, "_");
        }
开发者ID:xlongtang,项目名称:nextra,代码行数:12,代码来源:LocalizedDataAnnotationsModelMetadataProviderBehavior.cs


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