I noticed that I can add sub (child) nodes to dictionary items. I'm using dictionary items both in html and codebehind, so I'm wondering if I could use this feature in a smart/clean manner so that I can segment my dictionary in a more convenient way. For example:
If I have many pages (or user controls) that each has many properties that I'd like to translate using dictionary items.
Could I then create some sort of hiarchy where the page/usercontrol would be the parent of the properties?
For example (dictionary): SomePage -- Name -- Address -- Country SomeOtherPage -- SomeProperty -- SomeOtherProperty etc..
Then I'd like to access this in some way like this: umbraco.library.GetDictionaryItem("SomePage_Name") (or however I could do it?)
Then how would I also to that using <umbraco:Item ... /> ?
Turns out that this is a non-issue. When you set up your dictionary in such a hirachy, you still refer to it's elements as if the hirachy was flat.
For example; if you have the same structure as above, you can do this: umbraco.library.GetDictionaryItem("Address") and also umbraco.library.GetDictionaryItem("SomeOtherPage").
Be aware that even though elements are set up in a hiarchy, they still have to be universally unique. For axamle SomePage / Name and SomeOtherPage / Name is not unique since Name = Name.
Smart use sub Dictionary nodes ?
Hi,
I noticed that I can add sub (child) nodes to dictionary items. I'm using dictionary items both in html and codebehind, so I'm wondering if I could use this feature in a smart/clean manner so that I can segment my dictionary in a more convenient way. For example:
If I have many pages (or user controls) that each has many properties that I'd like to translate using dictionary items.
Could I then create some sort of hiarchy where the page/usercontrol would be the parent of the properties?
For example (dictionary):
SomePage
-- Name
-- Address
-- Country
SomeOtherPage
-- SomeProperty
-- SomeOtherProperty
etc..
Then I'd like to access this in some way like this: umbraco.library.GetDictionaryItem("SomePage_Name") (or however I could do it?)
Then how would I also to that using <umbraco:Item ... /> ?
With thanks.
Turns out that this is a non-issue. When you set up your dictionary in such a hirachy, you still refer to it's elements as if the hirachy was flat.
For example; if you have the same structure as above, you can do this: umbraco.library.GetDictionaryItem("Address") and also umbraco.library.GetDictionaryItem("SomeOtherPage").
Be aware that even though elements are set up in a hiarchy, they still have to be universally unique. For axamle SomePage / Name and SomeOtherPage / Name is not unique since Name = Name.
Home this helps someone :)
is working on a reply...