當前位置: 首頁>>代碼示例>>C#>>正文


C# WritingSystemDefinition類代碼示例

本文整理匯總了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"}));
		}
開發者ID:jwickberg,項目名稱:libpalaso,代碼行數:7,代碼來源:WritingSystemDefinitionVariantTests.cs

示例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);
			}
		}
開發者ID:jwickberg,項目名稱:libpalaso,代碼行數:31,代碼來源:WritingSystemSuggestor.cs

示例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);
		}
開發者ID:JohnThomson,項目名稱:libpalaso,代碼行數:7,代碼來源:WritingSystemDefinitionVariantTests.cs

示例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;
		}
開發者ID:jwickberg,項目名稱:libpalaso,代碼行數:25,代碼來源:DeleteInputSystemDialog.cs

示例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);
		}
開發者ID:JohnThomson,項目名稱:libpalaso,代碼行數:7,代碼來源:WritingSystemDefinitionVariantTests.cs

示例6: Setup

		public void Setup()
		{
			_temporaryFolder = new TemporaryFolder();
			string filePath = _temporaryFolder.GetTemporaryFile();
			_repository = new LiftLexEntryRepository(filePath);
			_headwordWritingSystem = new WritingSystemDefinition("th");
		}
開發者ID:JohnThomson,項目名稱:libpalaso,代碼行數:7,代碼來源:LexEntryRepositoryTests.cs

示例7: TestEnvironment

			public TestEnvironment()
			{
				_temporaryFolder = new TemporaryFolder("LiftLexEntryRepositoryTests");
				string filePath = _temporaryFolder.GetTemporaryFile();
				_repository = new LiftLexEntryRepository(filePath);
				_headwordWritingSystem = new WritingSystemDefinition("th") {DefaultCollation = new IcuRulesCollationDefinition("standard")};
			}
開發者ID:jwickberg,項目名稱:libpalaso,代碼行數:7,代碼來源:LexEntryRepositoryTests.cs

示例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"}));
		}
開發者ID:jwickberg,項目名稱:libpalaso,代碼行數:7,代碼來源:WritingSystemDefinitionVariantTests.cs

示例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);
		}
開發者ID:jwickberg,項目名稱:libpalaso,代碼行數:7,代碼來源:WritingSystemDefinitionVariantTests.cs

示例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));
		}
開發者ID:jwickberg,項目名稱:libpalaso,代碼行數:59,代碼來源:ProjectLexiconSettingsWritingSystemDataMapperTests.cs

示例11: Create

		public override bool Create(string ietfLanguageTag, out WritingSystemDefinition ws)
		{
			if (_writingSystems.TryGet(ietfLanguageTag, out ws))
				return true;

			ws = ConstructDefinition(ietfLanguageTag);
			return true;
		}
開發者ID:jwickberg,項目名稱:libpalaso,代碼行數:8,代碼來源:TestWritingSystemFactory.cs

示例12: SetUp

		public virtual void SetUp()
		{
			_writingSystem = new WritingSystemDefinition();
			RepositoryUnderTest = CreateNewStore();
			_writingSystemIdChangedEventArgs = null;
			_writingSystemDeletedEventArgs = null;
			_writingSystemConflatedEventArgs = null;
		}
開發者ID:jwickberg,項目名稱:libpalaso,代碼行數:8,代碼來源:WritingSystemRepositoryTests.cs

示例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;
		}
開發者ID:JohnThomson,項目名稱:libpalaso,代碼行數:8,代碼來源:LexEntryRepositoryCachingTests.cs

示例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);
 }
開發者ID:neilmayhew,項目名稱:libpalaso,代碼行數:9,代碼來源:IWritingSystemRepositoryTests.cs

示例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);
		}
開發者ID:JohnThomson,項目名稱:libpalaso,代碼行數:10,代碼來源:IWritingSystemRepositoryTests.cs


注:本文中的WritingSystemDefinition類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。