Example #1
0
        protected bool TryGetLocalizedText(out string p_localizedValue)
        {
            bool v_sucess = false;

            if ((!string.IsNullOrEmpty(m_key) || m_autoTrackKey) && LocaleManager.InstanceExists())
            {
                // If no localization key has been specified, use the label's/Input's text as the key
                if (m_autoTrackKey && string.IsNullOrEmpty(_language) && string.IsNullOrEmpty(m_key))
                {
                    m_key = Text;
                }

                // If we still don't have a key, leave the value as blank
                if (string.IsNullOrEmpty(m_key))
                {
                    p_localizedValue = "";
                }
                else
                {
                    v_sucess = LocaleManager.TryGetLocalizedText(m_key, out p_localizedValue, m_supportLocaleRichTextTags);
                }

                //Return Key value if localization is empty
                if (!v_sucess)
                {
                    p_localizedValue = m_key;
                }
            }
            else
            {
                p_localizedValue = m_key != null? m_key : "";
            }

            return(v_sucess);
        }
        protected bool TryGetLocalizedText(string p_text, out string p_localizedValue)
        {
            bool v_sucess = false;

            if (m_isLocalized && !string.IsNullOrEmpty(p_text) && LocaleManager.InstanceExists())
            {
                v_sucess = LocaleManager.TryGetLocalizedText(p_text, out p_localizedValue, m_supportLocaleRichTextTags && m_isRichText);

                //Return Key value if localization is empty
                if (!v_sucess)
                {
                    p_localizedValue = p_text;
                }

                _lastLocalizedLanguage = LocaleManager.Instance.CurrentLanguage;
            }
            else
            {
                p_localizedValue = p_text != null ? p_text : "";
            }

            return(v_sucess);
        }