KXB.Umbraco.UmbracoDictionaryExtension 1.1.1

An extension to the UmbracoHelper with several ease of life improvements, such as code first generation of dictionary items and getting dictionary items from a partial key

Install-Package KXB.Umbraco.UmbracoDictionaryExtension -Version 1.1.1
dotnet add package KXB.Umbraco.UmbracoDictionaryExtension --version 1.1.1
<PackageReference Include="KXB.Umbraco.UmbracoDictionaryExtension" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KXB.Umbraco.UmbracoDictionaryExtension --version 1.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Umbraco Dictionary Extension

An extension to the UmbracoHelper with several ease of life improvements

Using the new method Umbraco.GetDictionaryValueAndCreateDictionaryItem(string key, string fallback=&quot;&quot;) you can create dictionary items code first by simply requesting them in your code. It's no longer necessary to manually create the dictionary items under Umbraco -> Settings.

"Folders" in the dictionary is created based on the name of the key, example:

The key "Foo.Bar.Key" will be placed in Dictionary -> "Foo" -> "Bar"

The method has 3 "creation modes":

  • "key": This will initialize the dictionary item with the dictionary key stored in the dictionary (This is the default mode)
  • "fallback": This will initialize the dictionary item with the fallback value stored in the dictionary
  • "empty": This will initialize the dictionary item without a value

The creation mode can be set by modifying the app.config key: "KXB.Umbraco.UmbracoDictionaryExtension.CreationMode"


Using Umbraco.GetDictionaryItemsForPrefix(string prefix) or GetDictionaryValuesForPrefix(string prefix) you can retrieve dictionary values for a given prefix.

Example:
Umbraco.GetDictionaryItemsForPrefix(&quot;Foo.&quot;) could return dictionary items with the following keys:

  • "Foo.Bar"
  • "Foo.Foo"
  • "Foo.Foo.Bar"

etc


App config keys and their usage:
XB.Umbraco.UmbracoDictionaryExtension.CreationMode" determines what values is stored in newly created keys. Valid options are "key" (default), "fallback", "empty"
"KXB.Umbraco.UmbracoDictionaryExtension.SeparationSymbol" determines which symbol is used to separate "folders" in the names of dictionary keys. Default value is "."

Umbraco Dictionary Extension

An extension to the UmbracoHelper with several ease of life improvements

Using the new method Umbraco.GetDictionaryValueAndCreateDictionaryItem(string key, string fallback=&quot;&quot;) you can create dictionary items code first by simply requesting them in your code. It's no longer necessary to manually create the dictionary items under Umbraco -> Settings.

"Folders" in the dictionary is created based on the name of the key, example:

The key "Foo.Bar.Key" will be placed in Dictionary -> "Foo" -> "Bar"

The method has 3 "creation modes":

  • "key": This will initialize the dictionary item with the dictionary key stored in the dictionary (This is the default mode)
  • "fallback": This will initialize the dictionary item with the fallback value stored in the dictionary
  • "empty": This will initialize the dictionary item without a value

The creation mode can be set by modifying the app.config key: "KXB.Umbraco.UmbracoDictionaryExtension.CreationMode"


Using Umbraco.GetDictionaryItemsForPrefix(string prefix) or GetDictionaryValuesForPrefix(string prefix) you can retrieve dictionary values for a given prefix.

Example:
Umbraco.GetDictionaryItemsForPrefix(&quot;Foo.&quot;) could return dictionary items with the following keys:

  • "Foo.Bar"
  • "Foo.Foo"
  • "Foo.Foo.Bar"

etc


App config keys and their usage:
XB.Umbraco.UmbracoDictionaryExtension.CreationMode" determines what values is stored in newly created keys. Valid options are "key" (default), "fallback", "empty"
"KXB.Umbraco.UmbracoDictionaryExtension.SeparationSymbol" determines which symbol is used to separate "folders" in the names of dictionary keys. Default value is "."

Release Notes

Changed default value of "KXB.Umbraco.UmbracoDictionaryExtension.SeparationSymbol" to "." (period).

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.1 4,165 10/17/2017
1.1.0 870 3/31/2017
1.0.9 309 3/31/2017
1.0.8 322 3/31/2017
1.0.7 376 3/17/2017
1.0.6 304 3/17/2017
1.0.5 321 3/17/2017
1.0.4 294 3/17/2017
1.0.3 283 3/17/2017
1.0.2 389 3/17/2017