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);
        }
Пример #2
0
        public void Parse_HasLanguageAndRegion_RFC5646TagHasExpectedFields()
        {
            var tag = RFC5646Tag.Parse("en-US");

            AssertTag(tag, "en", string.Empty, "US", string.Empty, string.Empty);
        }
Пример #3
0
        public void Parse_HasLanguageAndMultipleVariants_RFC5646TagHasExpectedFields()
        {
            var tag = RFC5646Tag.Parse("en-alalc97-aluku");

            AssertTag(tag, "en", string.Empty, string.Empty, "alalc97-aluku", string.Empty);
        }
Пример #4
0
        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");
        }
Пример #5
0
        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");
        }
Пример #6
0
        public void Parse_HasLanguageAndScriptAndRegionAndMultipleVariants_RFC5646TagHasExpectedFields()
        {
            var tag = RFC5646Tag.Parse("de-Latn-DE-1901-bauddha");

            AssertTag(tag, "de", "Latn", "DE", "1901-bauddha", string.Empty);
        }
Пример #7
0
        public void Parse_HasLanguageAndScript_RFC5646TagHasExpectedFields()
        {
            var tag = RFC5646Tag.Parse("en-Latn");

            AssertTag(tag, "en", "Latn", string.Empty, string.Empty, string.Empty);
        }
Пример #8
0
        public void Parse_HasLanguage_RFC5646TagHasExpectedFields()
        {
            var tag = RFC5646Tag.Parse("de");

            AssertTag(tag, "de", string.Empty, string.Empty, string.Empty, string.Empty);
        }
Пример #9
0
        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");
        }