diff --git a/src/Umbraco.Web/NotificationServiceExtensions.cs b/src/Umbraco.Web/NotificationServiceExtensions.cs index 8817d37853..ad75fb2c0d 100644 --- a/src/Umbraco.Web/NotificationServiceExtensions.cs +++ b/src/Umbraco.Web/NotificationServiceExtensions.cs @@ -8,6 +8,7 @@ using Umbraco.Core.Models.Membership; using Umbraco.Core.Services; using umbraco; using umbraco.interfaces; +using Umbraco.Core.Models; namespace Umbraco.Web { @@ -71,12 +72,12 @@ namespace Umbraco.Web sender, entity, action.Letter.ToString(CultureInfo.InvariantCulture), - ui.Text("actions", action.Alias), + applicationContext.Services.TextService.Localize("actions", action.Alias), umbracoContext.HttpContext, - (mailingUser, strings) => ui.Text("notifications", "mailSubject", strings, mailingUser), + (mailingUser, strings) => applicationContext.Services.TextService.Localize("notifications/mailSubject", mailingUser.GetUserCulture(applicationContext.Services.TextService), strings), (mailingUser, strings) => UmbracoConfig.For.UmbracoSettings().Content.DisableHtmlEmail - ? ui.Text("notifications", "mailBody", strings, mailingUser) - : ui.Text("notifications", "mailBodyHtml", strings, mailingUser)); + ? applicationContext.Services.TextService.Localize("notifications/mailBody", mailingUser.GetUserCulture(applicationContext.Services.TextService), strings) + : applicationContext.Services.TextService.Localize("notifications/mailBodyHtml", mailingUser.GetUserCulture(applicationContext.Services.TextService), strings)); } } } \ No newline at end of file diff --git a/src/Umbraco.Web/WebServices/BulkPublishController.cs b/src/Umbraco.Web/WebServices/BulkPublishController.cs index ad61dab622..8459cdbcf8 100644 --- a/src/Umbraco.Web/WebServices/BulkPublishController.cs +++ b/src/Umbraco.Web/WebServices/BulkPublishController.cs @@ -58,7 +58,7 @@ namespace Umbraco.Web.WebServices //if all are successful then just say it was successful if (statuses.All(x => ((int) x.StatusType) < 10)) { - return ui.Text("publish", "nodePublishAll", doc.Name, UmbracoUser); + return Services.TextService.Localize("publish/nodePublishAll", new[] { doc.Name}); } //if they are not all successful the we'll add each error message to the output (one per line) @@ -79,24 +79,23 @@ namespace Umbraco.Web.WebServices { case PublishStatusType.Success: case PublishStatusType.SuccessAlreadyPublished: - return ui.Text("publish", "nodePublish", status.ContentItem.Name, UmbracoUser); + return Services.TextService.Localize("publish/nodePublish", new[] { status.ContentItem.Name}); case PublishStatusType.FailedPathNotPublished: - return ui.Text("publish", "contentPublishedFailedByParent", - string.Format("{0} ({1})", status.ContentItem.Name, status.ContentItem.Id), UmbracoUser); + return Services.TextService.Localize("publish/contentPublishedFailedByParent", + new [] { string.Format("{0} ({1})", status.ContentItem.Name, status.ContentItem.Id) }); case PublishStatusType.FailedHasExpired: case PublishStatusType.FailedAwaitingRelease: case PublishStatusType.FailedIsTrashed: return "Cannot publish document with a status of " + status.StatusType; case PublishStatusType.FailedCancelledByEvent: - return ui.Text("publish", "contentPublishedFailedByEvent", - string.Format("{0} ({1})", status.ContentItem.Name, status.ContentItem.Id), UmbracoUser); + return Services.TextService.Localize("publish/contentPublishedFailedByEvent", + new [] { string.Format("{0} ({1})", status.ContentItem.Name, status.ContentItem.Id) }); case PublishStatusType.FailedContentInvalid: - return ui.Text("publish", "contentPublishedFailedInvalid", + return Services.TextService.Localize("publish/contentPublishedFailedInvalid", new []{ string.Format("{0} ({1})", status.ContentItem.Name, status.ContentItem.Id), string.Join(",", status.InvalidProperties.Select(x => x.Alias)) - }, - UmbracoUser); + }); default: return status.StatusType.ToString(); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseTree.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseTree.cs index c0d967caed..2a07daa1bf 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseTree.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseTree.cs @@ -483,7 +483,7 @@ namespace umbraco.cms.presentation.Trees /// public static string GetTreeHeader(string alias) { - string treeCaption = ui.Text(alias); + string treeCaption = ApplicationContext.Current.Services.TextService.Localize(alias); //this is a hack. the tree header title should be in the language files, however, if it is not, we're just //going to make it equal to what is specified in the db. if (treeCaption.Length > 0 && treeCaption.Substring(0, 1) == "[") diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.cs index aa7b71f61e..1bae753ed6 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.cs @@ -154,7 +154,7 @@ namespace umbraco.presentation.dialogs // populate the message mail.Subject = Services.TextService.Localize("translation/mailSubject", Translator.UserEntity.GetUserCulture(Services.TextService), subjectVars); mail.IsBodyHtml = false; - mail.Body = ui.Text("translation", "mailBody", bodyVars, Translator); + mail.Body = Services.TextService.Localize("translation/mailBody", Translator.UserEntity.GetUserCulture(Services.TextService), bodyVars); try { SmtpClient sender = new SmtpClient(); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx.cs index 67820e916e..1d5ae2427f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx.cs @@ -9,6 +9,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using Umbraco.Core; +using Umbraco.Core.Services; using Action = Umbraco.Web.LegacyActions.Action; namespace umbraco.presentation.umbraco.dialogs @@ -42,7 +43,7 @@ namespace umbraco.presentation.umbraco.dialogs ArrayList actions = Action.GetAll(); foreach (interfaces.IAction a in actions) { - return ui.Text(action); + return Services.TextService.Localize(action); } return action; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberGroup.aspx b/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberGroup.aspx index 3dc7d26f4c..488a616f08 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberGroup.aspx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberGroup.aspx @@ -10,7 +10,7 @@
- <%=umbraco.ui.Text("name", base.getUser())%> + <%=Services.TextService.Localize("name")%> diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberGroup.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberGroup.aspx.designer.cs index c9f8222fa2..0319903f54 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberGroup.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberGroup.aspx.designer.cs @@ -1,10 +1,9 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.4927 // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs index ca5363fb0e..b5bed0d759 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs @@ -38,7 +38,7 @@ namespace umbraco.settings save.ButtonType = uicontrols.MenuButtonType.Primary; Literal txt = new Literal(); - txt.Text = "

" + ui.Text("dictionaryItem", "description", currentItem.key, Security.CurrentUser) + "


"; + txt.Text = "

" + Services.TextService.Localize("dictionaryItem/description", new[] { currentItem.key }) + "


"; p.addProperty(txt); foreach (cms.businesslogic.language.Language l in cms.businesslogic.language.Language.getAll) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs index 2388a46243..25e0258288 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs @@ -101,9 +101,9 @@ namespace umbraco.cms.presentation.settings SaveButton.CssClass = "client-side"; Panel1.Text = Services.TextService.Localize("edittemplate"); - pp_name.Text = ui.Text("name", UmbracoUser); - pp_alias.Text = ui.Text("alias", UmbracoUser); - pp_masterTemplate.Text = ui.Text("mastertemplate", UmbracoUser); + pp_name.Text = Services.TextService.Localize("name"); + pp_alias.Text = Services.TextService.Localize("alias"); + pp_masterTemplate.Text = Services.TextService.Localize("mastertemplate"); // Editing buttons diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs index 425a467b22..9b2a5590ce 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs @@ -51,8 +51,8 @@ namespace umbraco.cms.presentation.settings.stylesheet protected void Page_Load(object sender, EventArgs e) { Panel1.Text = Services.TextService.Localize("stylesheet/editstylesheet"); - pp_name.Text = ui.Text("name", UmbracoUser); - pp_path.Text = ui.Text("path", UmbracoUser); + pp_name.Text = Services.TextService.Localize("name"); + pp_path.Text = Services.TextService.Localize("path"); var stylesheet = Services.FileService.GetStylesheetByName(filename); if (stylesheet == null) // not found diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs index b3826644d4..881e4810b9 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs @@ -90,7 +90,7 @@ namespace umbraco.cms.presentation.user { if (UmbracoContext.UmbracoUser.IsAdmin() || ut.Alias != "admin") { - ListItem li = new ListItem(ui.Text("user", ut.Name.ToLower(), UmbracoUser), ut.Id.ToString()); + ListItem li = new ListItem(Services.TextService.Localize("user", ut.Name.ToLower()), ut.Id.ToString()); if (ut.Id == u.UserType.Id) li.Selected = true; @@ -166,7 +166,7 @@ namespace umbraco.cms.presentation.user pp.addProperty(Services.TextService.Localize("user/username"), uname); pp.addProperty(Services.TextService.Localize("user/loginname"), lname); pp.addProperty(Services.TextService.Localize("user/password"), passw); - pp.addProperty(ui.Text("email", UmbracoUser), email); + pp.addProperty(Services.TextService.Localize("email"), email); pp.addProperty(Services.TextService.Localize("user/usertype"), userType); pp.addProperty(Services.TextService.Localize("user/language"), userLanguage); @@ -205,7 +205,7 @@ namespace umbraco.cms.presentation.user sectionValidator.ServerValidate += new ServerValidateEventHandler(sectionValidator_ServerValidate); sectionValidator.ControlToValidate = lapps.ID; - sectionValidator.ErrorMessage = ui.Text("errorHandling", "errorMandatoryWithoutTab", Services.TextService.Localize("user/modules"), UmbracoUser); + sectionValidator.ErrorMessage = Services.TextService.Localize("errorHandling/errorMandatoryWithoutTab", new[] { Services.TextService.Localize("user/modules") }); sectionValidator.CssClass = "error"; sectionValidator.Style.Add("color", "red"); @@ -249,7 +249,7 @@ namespace umbraco.cms.presentation.user { if (UmbracoContext.UmbracoUser.IsAdmin() || currentUserApps.Contains(";" + app.alias + ";")) { - ListItem li = new ListItem(ui.Text("sections", app.alias), app.alias); + ListItem li = new ListItem(Services.TextService.Localize("sections", app.alias), app.alias); if (!IsPostBack) foreach (Application tmp in uapps) if (app.alias == tmp.alias) li.Selected = true; lapps.Items.Add(li); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.cs index 08872c2b36..f7aa5277df 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.cs @@ -99,7 +99,7 @@ namespace umbraco.cms.presentation.user foreach (IAction ai in Action.GetPermissionAssignable()) { - ListItem li = new ListItem(umbraco.ui.Text(ai.Alias, Security.CurrentUser), ai.Letter.ToString()); + ListItem li = new ListItem(Services.TextService.Localize(ai.Alias), ai.Letter.ToString()); if(CurrentUserTypeActions.Contains(ai)) li.Selected = true; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/NodePermissions.ascx b/src/Umbraco.Web/umbraco.presentation/umbraco/users/NodePermissions.ascx index fecd4fcec7..694b3e9ee4 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/NodePermissions.ascx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/NodePermissions.ascx @@ -25,7 +25,7 @@
  • />
  • diff --git a/src/umbraco.businesslogic/ui.cs b/src/umbraco.businesslogic/ui.cs deleted file mode 100644 index e9b5a7b6eb..0000000000 --- a/src/umbraco.businesslogic/ui.cs +++ /dev/null @@ -1,356 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Globalization; -using System.Linq; -using System.Threading; -using System.Web.Caching; -using System.Xml; -using Umbraco.Core; -using Umbraco.Core.IO; -using Umbraco.Core.Logging; -using Umbraco.Core.Models; -using Umbraco.Core.Models.Membership; -using File = System.IO.File; -using User = umbraco.BusinessLogic.User; - -namespace umbraco -{ - - //TODO: Make the User overloads obsolete, then publicize the IUser object - - /// - /// The ui class handles the multilingual text in the umbraco back-end. - /// Provides access to language settings and language files used in the umbraco back-end. - /// - [Obsolete("Use the ILocalizedTextService instead which is on the ApplicationContext.Services.TextService")] - public class ui - { - private static readonly string UmbracoDefaultUiLanguage = Umbraco.Core.Configuration.GlobalSettings.DefaultUILanguage; - private static readonly string UmbracoPath = SystemDirectories.Umbraco; - - private static string GetLanguage() - { - return "en-US"; - throw new NotImplementedException("NOTHING WILL WORK UNTIL WE REPLACE ALL USAGES OF THE ui CLASS"); - } - - private static string GetLanguage(User u) - { - if (u != null) - { - return u.Language; - } - return GetLanguage(""); - } - - private static string GetLanguage(IUser u) - { - if (u != null) - { - return u.Language; - } - return GetLanguage(""); - } - - private static string GetLanguage(string userLanguage) - { - if (userLanguage.IsNullOrWhiteSpace() == false) - { - return userLanguage; - } - var language = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; - if (string.IsNullOrEmpty(language)) - language = UmbracoDefaultUiLanguage; - return language; - } - - /// - /// Returns translated UI text with a specific key based on the specified user's language settings - /// - /// The key. - /// The user. - /// - public static string Text(string Key, User u) - { - if (ApplicationContext.Current == null) return "[" + Key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize(Key, GetCultureFromUserLanguage(GetLanguage(u))); - } - - internal static string Text(string key, IUser u) - { - if (ApplicationContext.Current == null) return "[" + key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize(key, GetCultureFromUserLanguage(GetLanguage(u))); - } - - /// - /// Returns translated UI text with a specific key based on the logged-in user's language settings - /// - /// The key. - /// - public static string Text(string Key) - { - if (ApplicationContext.Current == null) return "[" + Key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize(Key, GetCultureFromUserLanguage(GetLanguage())); - } - - /// - /// Returns translated UI text with a specific key and area, based on the specified users language settings - /// - /// The area. - /// The key. - /// The user. - /// - public static string Text(string Area, string Key, User u) - { - if (ApplicationContext.Current == null) return "[" + Key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize( - string.Format("{0}/{1}", Area, Key), - GetCultureFromUserLanguage(GetLanguage(u))); - } - - public static string Text(string area, string key, IUser u) - { - if (ApplicationContext.Current == null) return "[" + key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize( - string.Format("{0}/{1}", area, key), - GetCultureFromUserLanguage(GetLanguage(u))); - } - - /// - /// Returns translated UI text with a specific key and area, based on the logged-in users language settings - /// - /// The area. - /// The key. - /// - public static string Text(string Area, string Key) - { - if (ApplicationContext.Current == null) return "[" + Key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize( - string.Format("{0}/{1}", Area, Key), - GetCultureFromUserLanguage(GetLanguage())); - } - - /// - /// Returns translated UI text with a specific area and key. based on the specified users language settings and variables array passed to the method - /// - /// The area. - /// The key. - /// The variables array. - /// The user. - /// - public static string Text(string Area, string Key, string[] Variables, User u) - { - if (ApplicationContext.Current == null) return "[" + Key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize( - string.Format("{0}/{1}", Area, Key), - GetCultureFromUserLanguage(GetLanguage(u)), - ConvertToDictionaryVars(Variables)); - } - - internal static string Text(string area, string key, string[] variables) - { - if (ApplicationContext.Current == null) return "[" + key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize( - string.Format("{0}/{1}", area, key), - GetCultureFromUserLanguage(GetLanguage()), - ConvertToDictionaryVars(variables)); - } - - internal static string Text(string area, string key, string[] variables, IUser u) - { - if (ApplicationContext.Current == null) return "[" + key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize( - string.Format("{0}/{1}", area, key), - GetCultureFromUserLanguage(GetLanguage(u)), - ConvertToDictionaryVars(variables)); - } - - /// - /// Returns translated UI text with a specific key and area based on the specified users language settings and single variable passed to the method - /// - /// The area. - /// The key. - /// The variable. - /// The u. - /// - public static string Text(string Area, string Key, string Variable, User u) - { - if (ApplicationContext.Current == null) return "[" + Key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize( - string.Format("{0}/{1}", Area, Key), - GetCultureFromUserLanguage(GetLanguage(u)), - ConvertToDictionaryVars(new[] { Variable })); - } - - internal static string Text(string area, string key, string variable) - { - if (ApplicationContext.Current == null) return "[" + key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize( - string.Format("{0}/{1}", area, key), - GetCultureFromUserLanguage(GetLanguage()), - ConvertToDictionaryVars(new[] { variable })); - } - - internal static string Text(string area, string key, string variable, IUser u) - { - if (ApplicationContext.Current == null) return "[" + key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize( - string.Format("{0}/{1}", area, key), - GetCultureFromUserLanguage(GetLanguage(u)), - ConvertToDictionaryVars(new[] { variable })); - } - - /// - /// Returns translated UI text with a specific key based on the logged-in user's language settings - /// - /// The key. - /// - public static string GetText(string key) - { - return ApplicationContext.Current.Services.TextService.Localize(key, GetCultureFromUserLanguage(GetLanguage())); - } - - /// - /// Returns translated UI text with a specific key and area based on the logged-in users language settings - /// - /// The area. - /// The key. - /// - public static string GetText(string area, string key) - { - if (ApplicationContext.Current == null) return "[" + key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize( - string.Format("{0}/{1}", area, key), - GetCultureFromUserLanguage(GetLanguage())); - } - - /// - /// Returns translated UI text with a specific key and area based on the logged-in users language settings and variables array send to the method. - /// - /// The area. - /// The key. - /// The variables. - /// - public static string GetText(string area, string key, string[] variables) - { - if (ApplicationContext.Current == null) return "[" + key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize( - string.Format("{0}/{1}", area, key), - GetCultureFromUserLanguage(GetLanguage()), - ConvertToDictionaryVars(variables)); - } - - /// - /// Returns translated UI text with a specific key and area matching the variable send to the method. - /// - /// The area. - /// The key. - /// The variable. - /// - public static string GetText(string area, string key, string variable) - { - if (ApplicationContext.Current == null) return "[" + key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize( - string.Format("{0}/{1}", area, key), - GetCultureFromUserLanguage(GetLanguage()), - ConvertToDictionaryVars(new[] { variable })); - } - - /// - /// Returns translated UI text with a specific key, area and language matching the variables send to the method. - /// - /// The area (Optional) - /// The key (Required) - /// The variables (Optional) - /// The language (Optional) - /// - /// This is the underlying call for all Text/GetText method calls - public static string GetText(string area, string key, string[] variables, string language) - { - if (ApplicationContext.Current == null) return "[" + key + "]"; - - return ApplicationContext.Current.Services.TextService.Localize( - string.Format("{0}/{1}", area, key), - GetCultureFromUserLanguage(GetLanguage()), - ConvertToDictionaryVars(variables)); - } - - /// - /// Gets the language file as a xml document. - /// - /// The language. - /// - [Obsolete("This is no longer used and will be removed from the codebase in future versions, to get the contents of language text use ILocalizedTextService.GetAllStoredValues")] - public static XmlDocument getLanguageFile(string language) - { - var cacheKey = "uitext_" + language; - - var file = IOHelper.MapPath(UmbracoPath + "/config/lang/" + language + ".xml"); - if (File.Exists(file)) - { - return ApplicationContext.Current.ApplicationCache.GetCacheItem( - cacheKey, - CacheItemPriority.Default, - new CacheDependency(IOHelper.MapPath(UmbracoPath + "/config/lang/" + language + ".xml")), - () => - { - using (var langReader = new XmlTextReader(IOHelper.MapPath(UmbracoPath + "/config/lang/" + language + ".xml"))) - { - try - { - var langFile = new XmlDocument(); - langFile.Load(langReader); - return langFile; - } - catch (Exception e) - { - LogHelper.Error("Error reading umbraco language xml source (" + language + ")", e); - return null; - } - } - }); - } - else - { - return null; - } - - } - - /// - /// Convert an array of strings to a dictionary of indicies -> values - /// - /// - /// - internal static IDictionary ConvertToDictionaryVars(string[] variables) - { - if (variables == null) return null; - if (variables.Any() == false) return null; - - return variables.Select((s, i) => new {index = i.ToString(CultureInfo.InvariantCulture), value = s}) - .ToDictionary(keyvals => keyvals.index, keyvals => keyvals.value); - } - - private static CultureInfo GetCultureFromUserLanguage(string userLang) - { - return CultureInfo.GetCultureInfo(userLang.Replace("_", "-")); - } - - } -} \ No newline at end of file diff --git a/src/umbraco.businesslogic/umbraco.businesslogic.csproj b/src/umbraco.businesslogic/umbraco.businesslogic.csproj index 6cf109410a..6333c853f9 100644 --- a/src/umbraco.businesslogic/umbraco.businesslogic.csproj +++ b/src/umbraco.businesslogic/umbraco.businesslogic.csproj @@ -189,9 +189,6 @@ Code - - Code - Code