Skip to content

Commit 1c5abf6

Browse files
authored
Merge pull request #5955 from umbraco/migrate-articles-from-v13-to-v14
update v14 folder with recent v13 changes
2 parents 1e1e95a + 98bbf30 commit 1c5abf6

27 files changed

+459
-179
lines changed

14/umbraco-cms/extending-cms/key-vault.md

Lines changed: 58 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,70 @@ The next step is to add the Azure Key Vault endpoint to the `appsettings.json` f
3939
}
4040
```
4141

42-
After adding the Key Vault endpoint you have to update the `CreateHostBuilder` method which you can find in the `Program.cs` file.
42+
After adding the endpoint in the appsettings, it's time to add configuration so that the KeyVault is used. One way to achieve this is to write an extension method for the `WebApplicationBuilder`:
4343

4444
```csharp
45-
Host.CreateDefaultBuilder(args)
46-
.ConfigureUmbracoDefaults()
47-
.ConfigureAppConfiguration((context, config) =>
45+
using System;
46+
using Azure.Identity;
47+
using Microsoft.AspNetCore.Builder;
48+
using Microsoft.Extensions.Configuration;
49+
using Umbraco.Cms.Core.DependencyInjection;
50+
using Umbraco.Extensions;
51+
52+
namespace My.Website;
53+
54+
public static class WebApplicationBuilderExtensions
55+
{
56+
public static WebApplicationBuilder ConfigureKeyVault(this WebApplicationBuilder builder)
57+
{
58+
var keyVaultEndpoint = builder.Configuration["AzureKeyVaultEndpoint"];
59+
if (!string.IsNullOrWhiteSpace(keyVaultEndpoint) && Uri.TryCreate(keyVaultEndpoint, UriKind.Absolute, out var validUri))
60+
{
61+
builder.Configuration.AddAzureKeyVault(validUri, new DefaultAzureCredential());
62+
}
63+
64+
return builder;
65+
}
66+
}
67+
```
68+
69+
After creating the extension method, it's possible to call it from the `Program.cs` class, like so:
70+
71+
```csharp
72+
using Microsoft.AspNetCore.Builder;
73+
using My.Project;
74+
using Umbraco.Cms.Core.DependencyInjection;
75+
using Umbraco.Extensions;
76+
77+
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
78+
79+
builder.ConfigureKeyVault();
80+
81+
builder.CreateUmbracoBuilder()
82+
.AddBackOffice()
83+
.AddWebsite()
84+
.AddDeliveryApi()
85+
.AddComposers()
86+
.Build();
87+
88+
WebApplication app = builder.Build();
89+
90+
await app.BootUmbracoAsync();
91+
92+
app.UseUmbraco()
93+
.WithMiddleware(u =>
4894
{
49-
var settings = config.Build();
50-
var keyVaultEndpoint = settings["AzureKeyVaultEndpoint"];
51-
if (!string.IsNullOrEmpty(keyVaultEndpoint) && Uri.TryCreate(keyVaultEndpoint, UriKind.Absolute, out var validUri))
52-
{
53-
config.AddAzureKeyVault(validUri, new DefaultAzureCredential());
54-
}
95+
u.UseBackOffice();
96+
u.UseWebsite();
5597
})
56-
.ConfigureWebHostDefaults(webBuilder =>
98+
.WithEndpoints(u =>
5799
{
58-
webBuilder.UseStaticWebAssets();
59-
webBuilder.UseStartup<Startup>();
100+
u.UseInstallerEndpoints();
101+
u.UseBackOfficeEndpoints();
102+
u.UseWebsiteEndpoints();
60103
});
104+
105+
await app.RunAsync();
61106
```
62107

63108
### Authentication

14/umbraco-cms/extending-cms/language-files.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@ description: >-
77
# Language Files & Localization
88

99
Language files are XML files used to translate:
10-
- The Umbraco backoffice user interface so that end users can use Umbraco in their native language. This is particularly important for content editors who do not speak English.
11-
- The member identity errors in an Umbraco website enabling end users to use Umbraco in the website language.
12-
- Read [Add translations for your packages](packages/language-files-for-packages.md) to see how to include translations for your own package.
13-
- Override existing language files
10+
11+
* The Umbraco backoffice user interface so that end users can use Umbraco in their native language. This is particularly important for content editors who do not speak English.
12+
* The member identity errors in an Umbraco website enabling end users to use Umbraco in the website language.
13+
* Read [Add translations for your packages](packages/language-files-for-packages.md) to see how to include translations for your own package.
14+
* Override existing language files.
15+
16+
{% hint style="info" %}
17+
You can use localization files for Document and Media Types as well. You can find more information about this in the [Document Type Localization](../fundamentals/data/defining-content/document-type-localization.md) article.
18+
{% endhint %}
1419

1520
This is an example of such a language file, the most important parts are the `alias` fields of the `<area>` and `<key>` elements. This is what you need to retrieve the values from .NET or Angular.
21+
1622
```xml
1723
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
1824
<language alias="en" intName="English (UK)" localName="English (UK)" lcid="" culture="en-GB">
@@ -91,6 +97,10 @@ If you want to override Umbraco core translations or translations shipped with p
9197
/config/lang/{language}.user.xml
9298
```
9399

100+
{% hint style="info" %}
101+
The `/config/lang/` folders do not exist on a clean installation of the CMS. You will need to create them at the root of your `src` project.&#x20;
102+
{% endhint %}
103+
94104
By default, these files are empty but you can add any new keys you want or override existing ones with your own translations. The nice part about the user files is that they will not get overwritten by the installer when you upgrade your Umbraco versions.
95105

96106
In order for these files to deploy when you do a `dotnet publish`, you need to add the following to your `.csproj` file:

14/umbraco-cms/fundamentals/data/creating-media/default-media-types.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,7 @@ The `UmbracoMediaVideo` media type has the following properties:
7373
* `umbracoBytes` - Label (bigint)
7474

7575
![MediaVideo](../../../../../10/umbraco-cms/fundamentals/data/creating-media/images/umbraco-media-video-media-type.png)
76+
77+
{% hint style="info" %}
78+
You can also create localization files for Media Types. You can read more about this in the [Document Type Localization](../defining-content/document-type-localization.md) article.
79+
{% endhint %}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
description: Here you will learn how to apply localization for Document Types in Umbraco.
3+
---
4+
5+
# Document Type Localization
6+
7+
The Umbraco backoffice is fully localized to match the user's [configured language](../users.md). When defining Document Types, you can apply localization to:
8+
9+
* Document Type names and descriptions.
10+
* Property names and descriptions.
11+
* Custom property validation messages.
12+
* Tab and group names.
13+
14+
Setting up localization for Document Types is a two-step process:
15+
16+
* Create the localizations in [user defined language files](../../../extending/language-files.md).
17+
* Apply the localizations to the Document Types.
18+
19+
{% hint style="info" %}
20+
Everything in this article also applies to defining [Media Types](../creating-media/).
21+
{% endhint %}
22+
23+
## Creating localizations
24+
25+
User defined language files are created in `/config/lang` and must be named `{language}.user.xml`. For example: `en-us.user.xml`.
26+
27+
There are no specific requirements as to how localizations should be structured for use in Document Types. The following localizations have been used for the samples in this article:
28+
29+
{% code title="en-us.user.xml" lineNumbers="true" %}
30+
```xml
31+
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
32+
<language>
33+
<area alias="contentTypes">
34+
<key alias="article">Article page</key>
35+
<key alias="article-desc">A textual, article-like page on the site. Use this as the main type of content.</key>
36+
<key alias="landing">Landing page</key>
37+
<key alias="landing-desc">An inviting, very graphical page. Use this as an entry point for a campaign, and supplement with Articles.</key>
38+
</area>
39+
<area alias="tabs">
40+
<key alias="content">Page content</key>
41+
<key alias="seo">SEO configuration</key>
42+
</area>
43+
<area alias="groups">
44+
<key alias="titles">Page titles</key>
45+
</area>
46+
<area alias="properties">
47+
<key alias="title">Main title</key>
48+
<key alias="title-desc">This is the main title of the page.</key>
49+
<key alias="title-message">The main title is required for this page.</key>
50+
<key alias="subTitle">Sub title</key>
51+
<key alias="subTitle-desc">This is the sub title of the page.</key>
52+
</area>
53+
</language>
54+
```
55+
{% endcode %}
56+
57+
{% hint style="info" %}
58+
Umbraco must be restarted to pick up on changes to language files.
59+
{% endhint %}
60+
61+
## Applying localizations
62+
63+
The localizations are applied by using the syntax `#{area alias}_{key alias}`.
64+
65+
1. Create a **Document Type with template** called `#contentTypes_article` with **alias**: `articlePage`.
66+
2. Under the newly created document type follow these steps:
67+
68+
* Name the **description** to `#contentTypes_article-desc`.
69+
* Create a new **tab** called `#tabs_content`.
70+
* Add a new **group** called `#groups_titles`.
71+
* Add a **property** called `#properties_title` with **alias** `title`.
72+
* Set description to `#properties_title-desc`.
73+
* Use a `TextString` editor.
74+
* Enable to `Set this field as mandatory`.
75+
* Under validation add `#properties_title-message`.
76+
77+
![Applying localization to a property](../images/localization-document-type-editor-validation.png)
78+
79+
* Add a **property** called `#properties_subTitle` with **alias** `subTitle`.
80+
* Set description to `#properties_subTitle-desc`.
81+
* Use a `TextString` editor.
82+
* Enable to `Allow as root` in the **Permissions** tab.
83+
84+
![Applying localization to a Document Type](../images/localization-document-type-editor.png)
85+
86+
3. When creating and editing the content, you will see that the backoffice now uses the configured localizations.&#x20;
87+
88+
![Localized document creation dialog](../images/localization-document-editor-create.png)
89+
90+
4. Create a new "Article" content:
91+
92+
![Localized document editing](../images/localization-document-editor.png)
93+
94+
4. When trying to save the content without adding the mandatory content, you will see a warning as expected:
95+
96+
![Localized property validation](../images/localization-document-editor-validation.png)
77.4 KB
Loading
87.8 KB
Loading
73.7 KB
Loading
149 KB
Loading
117 KB
Loading

14/umbraco-cms/implementation/composing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Below is a list of collections with their corresponding 'collection type' and ho
192192

193193
### Example - Modifying Collections
194194

195-
This example shows how to control which Healthchecks are available to run in the Umbraco backoffice. Create a C# class which implements IUserComposer, the Compose method gives access to the HealthChecks collection of the Umbraco Composition - first we clear all HealthChecks from the collection, then add back in the ones we want to keep:
195+
This example shows how to control which Healthchecks are available to run in the Umbraco backoffice. Create a C# class which implements IComposer, the Compose method gives access to the HealthChecks collection of the Umbraco Composition - first we clear all HealthChecks from the collection, then add back in the ones we want to keep:
196196

197197
```csharp
198198
using Umbraco.Cms.Core.Composing;
@@ -390,7 +390,7 @@ public static class WebCompositionExtensions
390390
=> builder.WithCollectionBuilder<MyThingsCollectionBuilder>();
391391
}
392392

393-
public class MyThingComposer : IUserComposer
393+
public class MyThingComposer : IComposer
394394
{
395395
public void Compose(IUmbracoBuilder builder)
396396
{
@@ -482,7 +482,7 @@ public static class WebCompositionExtensions
482482
=> builder.WithCollectionBuilder<MyThingsCollectionBuilder>();
483483
}
484484

485-
public class MyThingComposer : IUserComposer
485+
public class MyThingComposer : IComposer
486486
{
487487
public void Compose(IUmbracoBuilder builder)
488488
{

0 commit comments

Comments
 (0)