本文整理汇总了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);
}
示例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;
}
示例3: SetUp
public void SetUp()
{
console = Substitute.For<IConsole>();
translator = Substitute.For<ITranslator>();
translator.Translate("GeneralHelpMessage").Returns("foo");
routine = new HelpRoutine(console, translator);
}
示例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);
}
示例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);
}
示例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]);
}
示例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);
}
示例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();
}
示例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);
}
示例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;
}
示例11: GetTranslation
public override List<LowLevelCommand> GetTranslation(ITranslator translator, Report current)
{
return translator.Translate(current, this);
}
示例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, "_");
}