/// ------------------------------------------------------------------------------------
        /// <summary>
        /// Try to retrieve a set of ValidChars (ExemplarCharacters) from ICU for the language
        /// associated with the LanguageDefinition parameter.
        /// </summary>
        /// <param name="icuLocale">Code for an ICU locale</param>
        /// <param name="cpe">A character property engine (needed for normalization).</param>
        /// <returns>Space-delimited set of valid characters characters for the given locale
        /// </returns>
        /// ------------------------------------------------------------------------------------
        public static string GetValidCharsForLocale(string icuLocale,
                                                    ILgCharacterPropertyEngine cpe)
        {
            if (icuLocale == null)
            {
                return(string.Empty);
            }

            s_ICU.Init();
            string strValidChars = ExpandExemplarCharacters(s_ICU.GetExemplarCharacters(icuLocale));

            strValidChars = AddUppercaseCharacters(strValidChars, icuLocale);
            strValidChars = cpe.NormalizeD(strValidChars);

            List <string> lExemplarChars = StringUtils.ParseCharString(strValidChars, " ", cpe);
            StringBuilder strBuilder     = new StringBuilder();

            foreach (string ch in lExemplarChars)
            {
                strBuilder.Append(ch);
                strBuilder.Append(" ");
            }
            if (strBuilder.Length > 0)
            {
                strBuilder.Remove(strBuilder.Length - 1, 1);
            }

            //Ensure that we start the string with two space characters so that
            //space is included in the set of valid characters.
            strBuilder.Insert(0, "  ");
            return(strBuilder.ToString());
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Try to retrieve a set of ValidChars (ExemplarCharacters) from ICU for the language
        /// associated with the LanguageDefinition parameter.
        /// </summary>
        /// <param name="icuLocale">Code for an ICU locale</param>
        /// <param name="cpe">A character property engine (needed for normalization).</param>
        /// <returns>Space-delimited set of valid characters characters for the given locale
        /// </returns>
        /// ------------------------------------------------------------------------------------
        public static string GetValidCharsForLocale(string icuLocale,
                                                    ILgCharacterPropertyEngine cpe)
        {
            if (icuLocale == null)
            {
                return(string.Empty);
            }

            s_ICU.Init();
            string strValidChars = ExpandExemplarCharacters(s_ICU.GetExemplarCharacters(icuLocale));

            strValidChars = AddUppercaseCharacters(strValidChars, icuLocale);
            strValidChars = cpe.NormalizeD(strValidChars);

            List <string> lExemplarChars = TsStringUtils.ParseCharString(strValidChars, " ", cpe);

            //Ensure that we start the string with two space characters so that
            //space is included in the set of valid characters.
            return("  " + lExemplarChars.ToString(" "));
        }
Example #3
0
 public void  Init()
 {
     m_mockICU.Init();
 }