示例#1
0
        /// <summary>
        ///     Gets the label. This method using in Models and Controllers.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns>Translated text.</returns>
        public static string GetLabel(string id)
        {
            if (String.IsNullOrEmpty(id))
            {
                return _noTextString;
            }

            try
            {
                var manager = new TranslationManager();
                string label = manager.GetLabelTranslation(id, CultureHelper.GetCurrentNeutralCulture());

                return String.IsNullOrEmpty(label) ? _noTextString : label;
            }
            catch (Exception ex)
            {
                return _noTextString;
            }
        }
示例#2
0
        /// <summary>
        /// Gets the dynamic resource. This method using in Models and Controllers.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns>Returns translated text.</returns>
        public static string GetDynamicResource(string id)
        {
            if (String.IsNullOrEmpty(id))
            {
                return _noTextString;
            }

            try
            {
                var manager = new TranslationManager();
                string resource = manager.GetDynamicTranslation(id, CultureHelper.GetCurrentNeutralCulture());

                return String.IsNullOrEmpty(resource) ? _noTextString : resource;
            }
            catch (Exception ex)
            {
                return _noTextString;
            }
        }