GetLocalizedMessage() 공개 정적인 메소드

public static GetLocalizedMessage ( string key ) : string
key string
리턴 string
예제 #1
0
        public void TestNLSLoading()
        {
            String message = NLS
                             .GetLocalizedMessage(MessagesTestBundle.Q0004E_INVALID_SYNTAX_ESCAPE_UNICODE_TRUNCATION, new CultureInfo("en"));

            /*
             * if the default locale is ja, you get ja as a fallback:
             * see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
             */
            if (!CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.Equals("ja", StringComparison.OrdinalIgnoreCase))
            {
                assertEquals("Truncated unicode escape sequence.", message);
            }

            message = NLS.GetLocalizedMessage(MessagesTestBundle.Q0001E_INVALID_SYNTAX, new CultureInfo("en"),
                                              "XXX");

            /*
             * if the default locale is ja, you get ja as a fallback:
             * see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
             */
            if (!CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.Equals("ja", StringComparison.OrdinalIgnoreCase))
            {
                assertEquals("Syntax Error: XXX", message);
            }
        }
예제 #2
0
        public void TestMissingMessage()
        {
            CultureInfo locale  = new CultureInfo("en");
            String      message = NLS.GetLocalizedMessage(
                MessagesTestBundle.Q0005E_MESSAGE_NOT_IN_BUNDLE, locale);

            assertEquals("Message with key:Q0005E_MESSAGE_NOT_IN_BUNDLE and locale: "
                         + locale.toString() + " not found.", message);
        }
예제 #3
0
        public void TestNLSLoading_ja()
        {
            String message = NLS.GetLocalizedMessage(
                MessagesTestBundle.Q0004E_INVALID_SYNTAX_ESCAPE_UNICODE_TRUNCATION,
                new CultureInfo("ja-JP"));

            assertEquals("切り捨てられたユニコード・エスケープ・シーケンス。", message);

            message = NLS.GetLocalizedMessage(MessagesTestBundle.Q0001E_INVALID_SYNTAX,
                                              new CultureInfo("ja-JP"), "XXX");
            assertEquals("構文エラー: XXX", message);
        }
예제 #4
0
        public void TestNLSLoading_xx_XX()
        {
            try
            {
                CultureInfo locale  = new CultureInfo("xx-XX");
                String      message = NLS.GetLocalizedMessage(
                    MessagesTestBundle.Q0004E_INVALID_SYNTAX_ESCAPE_UNICODE_TRUNCATION,
                    locale);

                /*
                 * if the default locale is ja, you get ja as a fallback:
                 * see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
                 */
                if (!CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.Equals("ja", StringComparison.OrdinalIgnoreCase))
                {
                    assertEquals("Truncated unicode escape sequence.", message);
                }

                message = NLS.GetLocalizedMessage(MessagesTestBundle.Q0001E_INVALID_SYNTAX,
                                                  locale, "XXX");

                /*
                 * if the default locale is ja, you get ja as a fallback:
                 * see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
                 */
                if (!CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.Equals("ja", StringComparison.OrdinalIgnoreCase))
                {
                    assertEquals("Syntax Error: XXX", message);
                }
            }
            catch (CultureNotFoundException)
            {
                // ignore

                // LUCENENET NOTE: .NET Core throws a CultureNotFoundException in this case.
                // There doesn't seem to be a reasonable way to test this as a result.
            }
        }
예제 #5
0
 public virtual string GetLocalizedMessage(CultureInfo locale)
 {
     return(NLS.GetLocalizedMessage(Key, locale, GetArguments()));
 }