Exemple #1
0
        public void TestScratch()
        {
            String[]          strMonths = { "Januari", "Pebruari", "Maret",   "April",     "Mei",
                                            "Juni",             "Juli",     "Agustus", "September", "Oktober","Nopember",
                                            "Desember" };
            String[]          strShortMonths = { "Jan", "Peb", "Mar", "Apr", "Mei", "Jun",
                                                 "Jul",          "Agt", "Sep", "Okt", "Nop", "Des" };
            String[]          strWeeks = { "", "Minggu", "Senin", "Selasa", "Rabu", "Kamis",
                                           "Jumat",     "Sabtu" };
            DateFormatSymbols dfsDate = new DateFormatSymbols(
                new ILOG.J2CsMapping.Util.Locale("id", "ID"));

            dfsDate.SetMonths(strMonths);
            dfsDate.SetShortMonths(strShortMonths);
            dfsDate.SetWeekdays(strWeeks);
            ULocale uloInd = dfsDate.GetLocale(IBM.ICU.Util.ULocale.ACTUAL_LOCALE);

            if (uloInd == null)
            {
                Errln("did not get the expected ULocale");
            }
            Logln(uloInd.ToString());
            ILOG.J2CsMapping.Util.Locale locInd = uloInd.ToLocale();
            if (locInd == null)
            {
                Errln("did not get the expected result");
            }
            Logln(locInd.ToString());
        }
        public void Test_ConstructorLjava_lang_StringLjava_util_Locale()
        {
            // Test for method java.text.MessageFormat(java.lang.String,
            // java.util.Locale)
            ILOG.J2CsMapping.Util.Locale mk     = new ILOG.J2CsMapping.Util.Locale("mk", "MK");
            IBM.ICU.Text.MessageFormat   format = new IBM.ICU.Text.MessageFormat(
                "Date: {0,date} Currency: {1, number, currency} Integer: {2, number, integer}",
                mk);

            NUnit.Framework.Assert.IsTrue(format.GetLocale().Equals(mk), "Wrong locale1");
            NUnit.Framework.Assert.IsTrue(format.GetFormats()[0].Equals(IBM.ICU.Text.DateFormat
                                                                        .GetDateInstance(IBM.ICU.Text.DateFormat.DEFAULT, mk)), "Wrong locale2");
            NUnit.Framework.Assert.IsTrue(format.GetFormats()[1].Equals(IBM.ICU.Text.NumberFormat
                                                                        .GetCurrencyInstance(mk)), "Wrong locale3");
            NUnit.Framework.Assert.IsTrue(format.GetFormats()[2].Equals(IBM.ICU.Text.NumberFormat
                                                                        .GetIntegerInstance(mk)), "Wrong locale4");
        }
        protected void SetUp()
        {
            defaultLocale = ILOG.J2CsMapping.Util.Locale.GetDefault();
            ILOG.J2CsMapping.Util.Locale.SetDefault(Locale.US);

            // test with repeating formats and max argument index < max offset
            String pattern = "A {3, number, currency} B {2, time} C {0, number, percent} D {4}  E {1,choice,0#off|1#on} F {0, date}";

            format1 = new IBM.ICU.Text.MessageFormat(pattern);

            // test with max argument index > max offset
            pattern = "A {3, number, currency} B {8, time} C {0, number, percent} D {6}  E {1,choice,0#off|1#on} F {0, date}";
            format2 = new IBM.ICU.Text.MessageFormat(pattern);

            // test with argument number being zero
            pattern = "A B C D E F";
            format3 = new IBM.ICU.Text.MessageFormat(pattern);
        }
Exemple #4
0
 /// <summary>
 /// Register a new break iterator of the indicated kind, to use in the given
 /// locale. Clones of the iterator will be returned if a request for a break
 /// iterator of the given kind matches or falls back to this locale.
 /// </summary>
 ///
 /// <param name="iter">the BreakIterator instance to adopt.</param>
 /// <param name="locale">the Locale for which this instance is to be registered</param>
 /// <param name="kind">the type of iterator for which this instance is to beregistered</param>
 /// <returns>a registry key that can be used to unregister this instance</returns>
 /// @stable ICU 2.4
 public static Object RegisterInstance(BreakIterator iter, ILOG.J2CsMapping.Util.Locale locale,
                                       int kind)
 {
     return(RegisterInstance(iter, IBM.ICU.Util.ULocale.ForLocale(locale), kind));
 }
Exemple #5
0
 /// <summary>
 /// Returns a new instance of BreakIterator that locates title boundaries.
 /// The iterator returned locates title boundaries as described for Unicode
 /// 3.2 only. For Unicode 4.0 and above title boundary iteration, please use
 /// Word Boundary iterator.<see cref="M:IBM.ICU.Text.BreakIterator.GetWordInstance"/>
 /// </summary>
 ///
 /// <param name="where">A Locale specifying the language of the text being analyzed.</param>
 /// <returns>A new instance of BreakIterator that locates title boundaries.</returns>
 /// @stable ICU 2.0
 public static BreakIterator GetTitleInstance(ILOG.J2CsMapping.Util.Locale where)
 {
     return(GetBreakInstance(IBM.ICU.Util.ULocale.ForLocale(where), KIND_TITLE));
 }
Exemple #6
0
 /// <summary>
 /// Returns a new instance of BreakIterator that locates sentence boundaries.
 /// </summary>
 ///
 /// <param name="where">A Locale specifying the language of the text being analyzed.</param>
 /// <returns>A new instance of BreakIterator that locates sentence boundaries.</returns>
 /// @stable ICU 2.0
 public static BreakIterator GetSentenceInstance(ILOG.J2CsMapping.Util.Locale where)
 {
     return(GetBreakInstance(IBM.ICU.Util.ULocale.ForLocale(where), KIND_SENTENCE));
 }
Exemple #7
0
 /// <summary>
 /// Returns a new instance of BreakIterator that locates logical-character
 /// boundaries.
 /// </summary>
 ///
 /// <param name="where">A Locale specifying the language of the text being analyzed.</param>
 /// <returns>A new instance of BreakIterator that locates logical-character
 /// boundaries.</returns>
 /// @stable ICU 2.0
 public static BreakIterator GetCharacterInstance(ILOG.J2CsMapping.Util.Locale where)
 {
     return(GetBreakInstance(IBM.ICU.Util.ULocale.ForLocale(where), KIND_CHARACTER));
 }