本文整理汇总了C#中WritingSystemDefinition类的典型用法代码示例。如果您正苦于以下问题:C# WritingSystemDefinition类的具体用法?C# WritingSystemDefinition怎么用?C# WritingSystemDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WritingSystemDefinition类属于命名空间,在下文中一共展示了WritingSystemDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IpaStatus_SetToIpaWasAlreadyIpaWithOtherVariants_NoChange
public void IpaStatus_SetToIpaWasAlreadyIpaWithOtherVariants_NoChange()
{
var ws = new WritingSystemDefinition();
ws.Variants.AddRange(new VariantSubtag[] {"1901", "biske", "fonipa"});
ws.IpaStatus = IpaStatusChoices.Ipa;
Assert.That(ws.Variants, Is.EqualTo(new VariantSubtag[] {"1901", "biske", "fonipa"}));
}
示例2: GetSuggestions
public IEnumerable<IWritingSystemDefinitionSuggestion> GetSuggestions(WritingSystemDefinition primary, IEnumerable<WritingSystemDefinition> existingWritingSystemsForLanguage)
{
if (primary.Language == null && primary.Variants.Any(v => !v.IsPrivateUse))
yield break;
if (SuppressSuggestionsForMajorWorldLanguages
&& new[]{"en", "th", "es", "fr", "de", "hi", "id", "vi","my","pt", "fi", "ar", "it","sv", "ja", "ko", "ch", "nl", "ru"}.Contains((string) primary.Language))
yield break;
WritingSystemDefinition[] existingWSs = existingWritingSystemsForLanguage.ToArray();
if (SuggestIpa && IpaSuggestion.ShouldSuggest(existingWSs))
{
yield return new IpaSuggestion(_writingSystemFactory, primary);
}
if (SuggestVoice && VoiceSuggestion.ShouldSuggest(existingWSs))
{
yield return new VoiceSuggestion(_writingSystemFactory, primary);
}
if (SuggestDialects)
{
yield return new DialectSuggestion(_writingSystemFactory, primary);
}
if (SuggestOther)
{
yield return new OtherSuggestion(_writingSystemFactory, primary, existingWSs);
}
}
示例3: IpaStatus_SetToIpaWasAlreadyIpaWithOtherVariants_NoChange
public void IpaStatus_SetToIpaWasAlreadyIpaWithOtherVariants_NoChange()
{
var ws = new WritingSystemDefinition();
ws.Variant = "1901-biske-fonipa";
ws.IpaStatus = IpaStatusChoices.Ipa;
Assert.AreEqual("1901-biske-fonipa", ws.Variant);
}
示例4: DeleteInputSystemDialog
public DeleteInputSystemDialog(WritingSystemDefinition wsToDelete,
IEnumerable<WritingSystemDefinition> possibleWritingSystemsToConflateWith, bool showHelpButton)
{
InitializeComponent();
if (!showHelpButton)
{
_helpButton.Hide();
}
_deleteRadioButton.Text = String.Format(_deleteRadioButton.Text, DisplayName(wsToDelete));
_mergeRadioButton.Text = String.Format(_mergeRadioButton.Text, DisplayName(wsToDelete));
_wsSelectionComboBox.Items.AddRange(
possibleWritingSystemsToConflateWith.Where(ws => ws != wsToDelete).Select(ws=>new WritingSystemDisplayAdaptor(ws)).ToArray());
Choice = Choices.Delete;
if (_wsSelectionComboBox.Items.Count > 0)
{
_wsSelectionComboBox.SelectedIndex = 0;
}
_wsSelectionComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
_okButton.Click += OnOkClicked;
_cancelButton.Click += OnCancelClicked;
_deleteRadioButton.CheckedChanged += OnDeleteRadioButtonCheckedChanged;
_mergeRadioButton.CheckedChanged += OnMergeRadioButtonCheckedChanged;
_helpButton.Click += OnCustomHelpButtonClicked;
_deleteRadioButton.Checked = true;
}
示例5: IpaStatus_SetToIpaWasAlreadyIpaAndOnyVariant_NoChange
public void IpaStatus_SetToIpaWasAlreadyIpaAndOnyVariant_NoChange()
{
var ws = new WritingSystemDefinition();
ws.IpaStatus = IpaStatusChoices.Ipa;
ws.Variant = "fonipa";
Assert.AreEqual("fonipa", ws.Variant);
}
示例6: Setup
public void Setup()
{
_temporaryFolder = new TemporaryFolder();
string filePath = _temporaryFolder.GetTemporaryFile();
_repository = new LiftLexEntryRepository(filePath);
_headwordWritingSystem = new WritingSystemDefinition("th");
}
示例7: TestEnvironment
public TestEnvironment()
{
_temporaryFolder = new TemporaryFolder("LiftLexEntryRepositoryTests");
string filePath = _temporaryFolder.GetTemporaryFile();
_repository = new LiftLexEntryRepository(filePath);
_headwordWritingSystem = new WritingSystemDefinition("th") {DefaultCollation = new IcuRulesCollationDefinition("standard")};
}
示例8: IpaStatus_SetToIpaWhenVariantHasContents_FonIpaAtEnd
public void IpaStatus_SetToIpaWhenVariantHasContents_FonIpaAtEnd()
{
var ws = new WritingSystemDefinition();
ws.Variants.AddRange(new VariantSubtag[] {"1901", "biske"});
ws.IpaStatus = IpaStatusChoices.Ipa;
Assert.That(ws.Variants, Is.EqualTo(new VariantSubtag[] {"1901", "biske", "fonipa"}));
}
示例9: IpaStatus_SetToNotIpaWhenWasOnlyVariant_FonIpaRemoved
public void IpaStatus_SetToNotIpaWhenWasOnlyVariant_FonIpaRemoved()
{
var ws = new WritingSystemDefinition();
ws.Variants.Add("fonipa");
ws.IpaStatus = IpaStatusChoices.NotIpa;
Assert.That(ws.Variants, Is.Empty);
}
示例10: Read_ValidXml_SetsAllProperties
public void Read_ValidXml_SetsAllProperties()
{
const string projectSettingsXml =
@"<ProjectLexiconSettings>
<WritingSystems>
<WritingSystem id=""qaa-Qaaa-QM-x-kal-Fake-ZG-var1-var2"">
<Abbreviation>kal</Abbreviation>
<LanguageName>Kalaba</LanguageName>
<ScriptName>Fake</ScriptName>
<RegionName>Zolrog</RegionName>
<SystemCollation>snarf</SystemCollation>
</WritingSystem>
<WritingSystem id=""fr-FR"">
<SpellCheckingId>fr_FR</SpellCheckingId>
<LegacyMapping>converter</LegacyMapping>
<Keyboard>Old Keyboard</Keyboard>
</WritingSystem>
</WritingSystems>
</ProjectLexiconSettings>";
var projectSettingsDataMapper = new ProjectLexiconSettingsWritingSystemDataMapper(new MemorySettingsStore {SettingsElement = XElement.Parse(projectSettingsXml)});
var ws1 = new WritingSystemDefinition("qaa-Qaaa-QM-x-kal-Fake-ZG-var1-var2");
projectSettingsDataMapper.Read(ws1);
Assert.That(ws1.Abbreviation, Is.EqualTo("kal"));
Assert.That(ws1.Language.Name, Is.EqualTo("Kalaba"));
Assert.That(ws1.Script.Name, Is.EqualTo("Fake"));
Assert.That(ws1.Region.Name, Is.EqualTo("Zolrog"));
Assert.That(ws1.SpellCheckingId, Is.EqualTo(string.Empty));
Assert.That(ws1.LegacyMapping, Is.EqualTo(string.Empty));
Assert.That(ws1.Keyboard, Is.EqualTo(string.Empty));
var scd = new SystemCollationDefinition {LanguageTag = "snarf"};
Assert.That(ws1.DefaultCollation.ValueEquals(scd), Is.True);
var ws2 = new WritingSystemDefinition("fr-FR");
projectSettingsDataMapper.Read(ws2);
Assert.That(ws2.Abbreviation, Is.EqualTo("fr"));
Assert.That(ws2.Language.Name, Is.EqualTo("French"));
Assert.That(ws2.Script.Name, Is.EqualTo("Latin"));
Assert.That(ws2.Region.Name, Is.EqualTo("France"));
Assert.That(ws2.Variants, Is.Empty);
Assert.That(ws2.SpellCheckingId, Is.EqualTo("fr_FR"));
Assert.That(ws2.LegacyMapping, Is.EqualTo("converter"));
Assert.That(ws2.Keyboard, Is.EqualTo("Old Keyboard"));
var ws3 = new WritingSystemDefinition("es");
projectSettingsDataMapper.Read(ws3);
Assert.That(ws3.Abbreviation, Is.EqualTo("es"));
Assert.That(ws3.Language.Name, Is.EqualTo("Spanish"));
Assert.That(ws3.Script.Name, Is.EqualTo("Latin"));
Assert.That(ws3.Region, Is.Null);
Assert.That(ws3.Variants, Is.Empty);
Assert.That(ws3.SpellCheckingId, Is.EqualTo(string.Empty));
Assert.That(ws3.LegacyMapping, Is.EqualTo(string.Empty));
Assert.That(ws3.Keyboard, Is.EqualTo(string.Empty));
}
示例11: Create
public override bool Create(string ietfLanguageTag, out WritingSystemDefinition ws)
{
if (_writingSystems.TryGet(ietfLanguageTag, out ws))
return true;
ws = ConstructDefinition(ietfLanguageTag);
return true;
}
示例12: SetUp
public virtual void SetUp()
{
_writingSystem = new WritingSystemDefinition();
RepositoryUnderTest = CreateNewStore();
_writingSystemIdChangedEventArgs = null;
_writingSystemDeletedEventArgs = null;
_writingSystemConflatedEventArgs = null;
}
示例13: WritingSystemDefinitionForTest
private static WritingSystemDefinition WritingSystemDefinitionForTest(string languageISO, Font font)
{
var retval = new WritingSystemDefinition();
retval.Language = languageISO;
retval.DefaultFontName = font.Name;
retval.DefaultFontSize = font.Size;
return retval;
}
示例14: AllWritingSystems_HasAllWritingSystems_ReturnsAllWritingSystems
public void AllWritingSystems_HasAllWritingSystems_ReturnsAllWritingSystems()
{
var ws1 = new WritingSystemDefinition("fr");
ws1.IsVoice = true;
RepositoryUnderTest.Set(ws1);
RepositoryUnderTest.Set(new WritingSystemDefinition("de"));
RepositoryUnderTest.Set(new WritingSystemDefinition("es"));
Assert.IsTrue(RepositoryUnderTest.AllWritingSystems.Count() == 3);
}
示例15: SetTwoDefinitions_CountEquals2
public void SetTwoDefinitions_CountEquals2()
{
_writingSystem.Language = "one";
RepositoryUnderTest.Set(_writingSystem);
var ws2 = new WritingSystemDefinition();
ws2.Language = "two";
RepositoryUnderTest.Set(ws2);
Assert.AreEqual(2, RepositoryUnderTest.Count);
}