-
Notifications
You must be signed in to change notification settings - Fork 808
Documentation on the localization feature for UI Builder #7484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
fd5c840
Documentation on the localization feature for UI Builder
acoumb b7fca13
Update 15/umbraco-ui-builder/collections/localization.md
acoumb 4def609
Update 15/umbraco-ui-builder/collections/localization.md
acoumb 51291be
Update 15/umbraco-ui-builder/collections/localization.md
acoumb 61fbe63
Update 15/umbraco-ui-builder/collections/localization.md
acoumb 1686e0b
Update 15/umbraco-ui-builder/collections/localization.md
acoumb 70870a7
Update 15/umbraco-ui-builder/collections/localization.md
acoumb d154e16
Update 15/umbraco-ui-builder/collections/localization.md
acoumb 90aa581
Update 15/umbraco-ui-builder/collections/localization.md
acoumb 8f442cc
Update 15/umbraco-ui-builder/collections/localization.md
acoumb 4baa158
Update localization docs for UI Builder 16
acoumb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
description: Using the available context to handle localization for an UI Builder collection | ||
--- | ||
|
||
# Localization | ||
|
||
The localization context enables developers to use multilingual collection names and descriptions in fluent configurations. It also supports translations for actions, context apps, dashboards, sections, and trees. | ||
|
||
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. | ||
|
||
## Localization Services | ||
|
||
The localization context uses two abstractions to provide localization options. | ||
|
||
The first uses the Umbraco translations dictionary to retrieve a value based on a provided key. | ||
|
||
The second uses the CMS `ILocalizedTextService` to retrieve a value based on area and alias. These values are supplied in the collection's fluent configuration, separated by an underscore `_` from the localization resources. | ||
|
||
## Example | ||
|
||
### Localizing a Collection | ||
|
||
For a `Students` collection, use the following fluent configuration: | ||
|
||
```csharp | ||
treeConfig.AddCollection<Student>(x => x.Id, "#CollectionStudents", "#CollectionStudents", "A list of students", "icon-umb-members", "icon-umb-members", collectionConfig => | ||
{ | ||
... | ||
}); | ||
``` | ||
|
||
 | ||
|
||
Alternatively, you can use the lowercase version: | ||
|
||
```csharp | ||
treeConfig.AddCollection<Student>(x => x.Id, "#collection_students", "#collection_students", "A list of students", "icon-umb-members", "icon-umb-members", collectionConfig => | ||
{ | ||
... | ||
}); | ||
``` | ||
|
||
Define the translation in your localization dictionary file: | ||
``` | ||
import type { UmbLocalizationDictionary } from "@umbraco-cms/backoffice/localization-api"; | ||
|
||
export default { | ||
collection: { | ||
students: "Studerende" | ||
} | ||
... | ||
} | ||
``` | ||
|
||
 | ||
|
||
### Localizing a Section | ||
For a custom section, use the following configuration: | ||
|
||
```csharp | ||
.AddSection("#UmbracoTraining", sectionConfig => | ||
{ | ||
... | ||
} | ||
``` | ||
|
||
 | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
description: Using the available context to handle localization for an UI Builder collection | ||
--- | ||
|
||
# Localization | ||
|
||
The localization context enables developers to use multilingual collection names and descriptions in fluent configurations. It also supports translations for actions, context apps, dashboards, sections, and trees. | ||
|
||
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. | ||
|
||
## Localization Services | ||
|
||
The localization context uses two abstractions to provide localization options. | ||
|
||
The first uses the Umbraco translations dictionary to retrieve a value based on a provided key. | ||
|
||
The second uses the CMS `ILocalizedTextService` to retrieve a value based on area and alias. These values are supplied in the collection's fluent configuration, separated by an underscore `_` from the localization resources. | ||
|
||
## Example | ||
|
||
### Localizing a Collection | ||
|
||
For a `Students` collection, use the following fluent configuration: | ||
|
||
```csharp | ||
treeConfig.AddCollection<Student>(x => x.Id, "#CollectionStudents", "#CollectionStudents", "A list of students", "icon-umb-members", "icon-umb-members", collectionConfig => | ||
{ | ||
... | ||
}); | ||
``` | ||
|
||
 | ||
|
||
Alternatively, you can use the lowercase version: | ||
|
||
```csharp | ||
treeConfig.AddCollection<Student>(x => x.Id, "#collection_students", "#collection_students", "A list of students", "icon-umb-members", "icon-umb-members", collectionConfig => | ||
{ | ||
... | ||
}); | ||
``` | ||
|
||
Define the translation in your localization dictionary file: | ||
``` | ||
import type { UmbLocalizationDictionary } from "@umbraco-cms/backoffice/localization-api"; | ||
|
||
export default { | ||
collection: { | ||
students: "Studerende" | ||
} | ||
... | ||
} | ||
``` | ||
|
||
 | ||
|
||
### Localizing a Section | ||
For a custom section, use the following configuration: | ||
|
||
```csharp | ||
.AddSection("#UmbracoTraining", sectionConfig => | ||
{ | ||
... | ||
} | ||
``` | ||
|
||
 | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.