I am currently working on a 7.2.6 site and it seems the syntax is slightly different to the documentation you pointed to, so I thought I'd add a comment on here in case it is useful for someone else.
In the version I am using, you also have to pass in a culture, I have slightly changed my code so it is trying to get the same key mentioned in the original question above:
var textService = this.ApplicationContext.Services.TextService;
textService.Localize("mail2cms/settings"), CultureInfo.CurrentCulture)
How I can localize name of tree nodes in custom section?
I have created a few nodes with a tree controller like this:
protected TreeNodeCollection GetChildTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var nodes = new TreeNodeCollection { CreateTreeNode(id+"-1", id, queryStrings, "Settings", "icon-mail2cms-settingstwo-gearalt",false,"mail2CMS/mail2CMSTree/settings/" + id + "-1"), CreateTreeNode(id+"-2", id, queryStrings, "Mapping", "icon-mail2cms-emailforwarders", false,"mail2CMS/mail2CMSTree/mapping/" + id + "-2"), CreateTreeNode(id+"-3", id, queryStrings, "Blacklist and Whitelist", "icon-mail2cms-th-list", false, "mail2CMS/mail2CMSTree/blackwhitelist/" + id + "-3") }; return nodes; }How can I localize the name of tree nodes (here: "Settings", "Mapping", "Blacklist") ?
My language file looks like this:
Can anyone help me, please?
Cheers
Sören
I have solved it with ui.Text(areaAlias,key)
CreateTreeNode(id+"-1", id, queryStrings, ui.Text("mail2cms", "settings"), "icon-mail2cms-settingstwo-gearalt",false,"mail2CMS/mail2CMSTree/settings/" + id + "-1"),Sören
I think the following is depreciated:
And you should be using the localizationService, however I am not sure of the syntax, maybe someone else can confirm the new syntax?
Cheers,
Chris
Comment author was deleted
Think it's the TextService you need to use, that has a localize method
(LocalizationService is for languages and dictionary items)
Comment author was deleted
Example usage can be found here https://our.umbraco.org/documentation/Extending/Language-Files/Language-Files-For-Packages/
Thanks Tim,
I am currently working on a 7.2.6 site and it seems the syntax is slightly different to the documentation you pointed to, so I thought I'd add a comment on here in case it is useful for someone else.
In the version I am using, you also have to pass in a culture, I have slightly changed my code so it is trying to get the same key mentioned in the original question above:
I hope this thread helps someone else :)
Cheers,
Chris
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.