private static string UniqueTagForDuplicate(string rfcTag, IEnumerable <string> uniqueRfcTags) { RFC5646Tag tag = RFC5646Tag.Parse(rfcTag); string originalPrivateUse = tag.PrivateUse; int duplicateNumber = 0; do { duplicateNumber++; tag.PrivateUse = originalPrivateUse; tag.AddToPrivateUse(String.Format("dupl{0}", duplicateNumber)); } while (uniqueRfcTags.Any(s => s.Equals(tag.CompleteTag, StringComparison.OrdinalIgnoreCase))); return(tag.CompleteTag); }
public void Parse_HasLanguageAndRegion_RFC5646TagHasExpectedFields() { var tag = RFC5646Tag.Parse("en-US"); AssertTag(tag, "en", string.Empty, "US", string.Empty, string.Empty); }
public void Parse_HasLanguageAndMultipleVariants_RFC5646TagHasExpectedFields() { var tag = RFC5646Tag.Parse("en-alalc97-aluku"); AssertTag(tag, "en", string.Empty, string.Empty, "alalc97-aluku", string.Empty); }
public void Parse_HasLanguageAndRegionAndVariantAndMultiplePrivateUse_RFC5646TagHasExpectedFields() { var tag = RFC5646Tag.Parse("de-DE-bauddha-x-private-use"); AssertTag(tag, "de", string.Empty, "DE", "bauddha", "x-private-use"); }
public void Parse_HasLanguageAndScriptAndRegionAndMultipleVariantsAndMultiplePrivateUse_RFC5646TagHasExpectedFields() { var tag = RFC5646Tag.Parse("de-Latn-DE-1901-bauddha-x-private-use"); AssertTag(tag, "de", "Latn", "DE", "1901-bauddha", "x-private-use"); }
public void Parse_HasLanguageAndScriptAndRegionAndMultipleVariants_RFC5646TagHasExpectedFields() { var tag = RFC5646Tag.Parse("de-Latn-DE-1901-bauddha"); AssertTag(tag, "de", "Latn", "DE", "1901-bauddha", string.Empty); }
public void Parse_HasLanguageAndScript_RFC5646TagHasExpectedFields() { var tag = RFC5646Tag.Parse("en-Latn"); AssertTag(tag, "en", "Latn", string.Empty, string.Empty, string.Empty); }
public void Parse_HasLanguage_RFC5646TagHasExpectedFields() { var tag = RFC5646Tag.Parse("de"); AssertTag(tag, "de", string.Empty, string.Empty, string.Empty, string.Empty); }
public void Parse_HasMultiplePrivateUse_RFC5646TagHasExpectedFields() { var tag = RFC5646Tag.Parse("x-private-use"); AssertTag(tag, string.Empty, string.Empty, string.Empty, string.Empty, "x-private-use"); }