Exemplo n.º 1
0
        public static short AddLanguageFile(string RelativeLanguageFilename)
        {
            EnsureStrReader();

            TIS_STR_STATUS status = m_strReader.AddLanguageFile(RelativeLanguageFilename);

            return((short)status);
        }
Exemplo n.º 2
0
        public static short Load()
        {
            EnsureStrReader();

            TIS_STR_STATUS status = m_strReader.Load();

            return((short)status);
        }
Exemplo n.º 3
0
        public TIS_STR_STATUS GetLocalizedStringByTokenDef(
            string tokenName,
            ref string localizedString,
            string DefaultString)
        {
            TIS_STR_STATUS status =
                GetLocalizedStringByToken(tokenName, ref localizedString);

            if (status == TIS_STR_STATUS.STR_ERROR_NO_ERROR)
            {
                if (localizedString == STRING_NOT_FOUND && !String.IsNullOrEmpty(DefaultString))
                {
                    localizedString = DefaultString;
                }
            }

            return(status);
        }
Exemplo n.º 4
0
        public static string LoadText(string sTokenName, string sDefaultString)
        {
            string errorMsg = "Failed to get localized string for '" + sTokenName + "'.";

            try
            {
                EnsureStrReader();

                string localizedString = null;

                TIS_STR_STATUS status =
                    m_strReader.GetLocalizedStringByTokenDef(sTokenName, ref localizedString, sDefaultString);

                if (status != TIS_STR_STATUS.STR_ERROR_NO_ERROR)
                {
                    switch (status)
                    {
                    case TIS_STR_STATUS.STR_ERROR_NOT_INITIALIZED:
                        Log.WriteError("Localization was not initialized. " + errorMsg);
                        break;

                    case TIS_STR_STATUS.STR_ERROR_MISSING_TOKEN:
                        Log.WriteError("Missing token '" + sTokenName + "'. " + errorMsg);
                        break;

                    case TIS_STR_STATUS.STR_ERROR_MISSING_FILENAME:
                        Log.WriteError("Missing localization file name. " + errorMsg);
                        break;
                    }

                    return(sDefaultString);
                }
                else
                {
                    return(localizedString);
                }
            }
            catch (Exception e)
            {
                Log.WriteError(errorMsg + " : " + e.Message);
                return(sDefaultString);
            }
        }