diff --git a/16/umbraco-ui-builder/collections/localization.md b/16/umbraco-ui-builder/collections/localization.md index cf75145fd7f..3ff2f6ecfb3 100644 --- a/16/umbraco-ui-builder/collections/localization.md +++ b/16/umbraco-ui-builder/collections/localization.md @@ -10,6 +10,19 @@ To enable localization, prefix the input string with the `#` character. Upon character identification in the fluent configuration, the localization context will attempt to lookup a matching localized string using two services available. If no matching record is found, it will default to the provided string value. +Supported areas: + +* Collections - `Name` and `Description` properties. +* Data Views - only if the key is in a localization resource, not in the translation dictionary (e.g. [additional localization](#localizing-an-additional-area)). +* Collection filters - `Label` and `Description` properties. +* Cards +* Editor fields - `Label` and `Description` field properties. +* Fieldsets names +* Actions names +* Context Apps names +* Dashboards names +* Sections names + ## Localization Services The localization context uses two abstractions to provide localization options. @@ -68,4 +81,39 @@ For a custom section, use the following configuration: ![section_name](../images/section_name.png) +### Localizing an additional area + +In a scenario where a specific area is not covered by the implemented localization, you can update it directly in the fluent configuration by using the `LocalizationContext`. + +For example, this custom data view: + +```csharp +public class CommentStatusDataViewsBuilder : DataViewsBuilder +{ + private readonly LocalizationContext _localizationContext; + public CommentStatusDataViewsBuilder(LocalizationContext localizationContext) + { + _localizationContext = localizationContext; + } + public override IEnumerable GetDataViews() + { + yield return new DataViewSummary + { + Name = _localizationContext.TryLocalize("#dataView_All", out string localizedText) ? localizedText : string.Empty, + Alias = "all", + Group = "Status" + }; + + foreach (var val in Enum.GetValues()) + { + yield return new DataViewSummary + { + Name = val.ToString(), + Alias = val.ToString().ToLower(), + Group = "Status" + }; + } + } +} +``` diff --git a/17/umbraco-ui-builder/collections/localization.md b/17/umbraco-ui-builder/collections/localization.md index 2d745d7f295..a94cf512003 100644 --- a/17/umbraco-ui-builder/collections/localization.md +++ b/17/umbraco-ui-builder/collections/localization.md @@ -10,6 +10,19 @@ To enable localization, prefix the input string with the `#` character. Upon character identification in the fluent configuration, the localization context will attempt to lookup a matching localized string using two services available. If no matching record is found, it will default to the provided string value. +Supported areas: + +* Collections - `Name` and `Description` properties. +* Data Views - only if the key is in a localization resource, not in the translation dictionary (e.g. [additional localization](#localizing-an-additional-area)). +* Collection filters - `Label` and `Description` properties. +* Cards +* Editor fields - `Label` and `Description` field properties. +* Fieldsets names +* Actions names +* Context Apps names +* Dashboards names +* Sections names + ## Localization Services The localization context uses two abstractions to provide localization options. @@ -68,4 +81,41 @@ For a custom section, use the following configuration: ![section_name](../images/section_name.png) +### Localizing an additional area + +In a scenario where a specific area is not covered by the implemented localization, you can update it directly in the fluent configuration by using the `LocalizationContext`. + +For example, this custom data view: + +```csharp +public class CommentStatusDataViewsBuilder : DataViewsBuilder +{ + private readonly LocalizationContext _localizationContext; + public CommentStatusDataViewsBuilder(LocalizationContext localizationContext) + { + _localizationContext = localizationContext; + } + + public override IEnumerable GetDataViews() + { + yield return new DataViewSummary + { + Name = _localizationContext.TryLocalize("#dataView_All", out string localizedText) ? localizedText : string.Empty, + Alias = "all", + Group = "Status" + }; + + foreach (var val in Enum.GetValues()) + { + yield return new DataViewSummary + { + Name = val.ToString(), + Alias = val.ToString().ToLower(), + Group = "Status" + }; + } + } +} +``` +