Skip to content

Commit 5dc6519

Browse files
authored
Merge branch 'umbraco:main' into main
2 parents b109cbe + ba1d868 commit 5dc6519

File tree

227 files changed

+4528
-3021
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+4528
-3021
lines changed

10/umbraco-cms/legacy-documentation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ This documentation platform covers only major versions of the Umbraco CMS since
88

99
The documentation for Umbraco 7 and 8 lives on [our.umbraco.com](https://our.umbraco.com/documentation/).
1010

11-
<table data-card-size="large" data-view="cards"><thead><tr><th align="center"></th><th data-hidden></th><th data-hidden></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><strong>Umbraco 7 Documentation</strong></td><td></td><td></td><td></td><td><a href="https://our.umbraco.com/documentation/">https://our.umbraco.com/documentation/</a></td></tr><tr><td align="center"><strong>Umbraco 8 Documentation</strong></td><td></td><td></td><td></td><td><a href="https://our.umbraco.com/documentation/">https://our.umbraco.com/documentation/</a></td></tr><tr><td align="center"><strong>Umbraco 11 Documentation</strong></td><td></td><td></td><td></td><td><a href="https://github.com/umbraco/UmbracoDocs/tree/umbraco-eol-versions">https://github.com/umbraco/UmbracoDocs/tree/umbraco-eol-versions</a></td></tr></tbody></table>
11+
<table data-card-size="large" data-view="cards"><thead><tr><th align="center"></th><th data-hidden></th><th data-hidden></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><strong>Umbraco 7 Documentation</strong></td><td></td><td></td><td></td><td><a href="https://our.umbraco.com/documentation/">https://our.umbraco.com/documentation/</a></td></tr><tr><td align="center"><strong>Umbraco 8 Documentation</strong></td><td></td><td></td><td></td><td><a href="https://our.umbraco.com/documentation/">https://our.umbraco.com/documentation/</a></td></tr><tr><td align="center"><strong>Umbraco EOL Documentation</strong></td><td></td><td></td><td></td><td><a href="https://github.com/umbraco/UmbracoDocs/tree/umbraco-eol-versions">https://github.com/umbraco/UmbracoDocs/tree/umbraco-eol-versions</a></td></tr></tbody></table>

10/umbraco-cms/tutorials/multilanguage-setup.md

Lines changed: 107 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
---
2-
meta.Title: Multilanguage setup in Umbraco
3-
product: CMS
42
description: A guide to multilanguage setup in Umbraco
53
---
64

75
# Creating a Multilingual Site
86

9-
You can use **language variants** to setup a multilingual site. **Language Variants** allow you to have variants of the same content all under the same project. So, if you open a page and a language variant is enabled, you will see the option to switch the language from the drop-down list. Additionally, you can view or input the translated content.
7+
You can use **language variants** to set up a multilingual site. **Language Variants** allow you to have variants of the same content all under the same project. So, if you open a page and a language variant is enabled, you will see the option to switch the language from the drop-down list. Additionally, you can view or input the translated content.
108

11-
This tutorial explains how to set-up a basic multilingual website.
9+
This tutorial explains how to set up a basic multilingual website.
1210

1311
## Adding a New language
1412

@@ -226,3 +224,108 @@ For viewing purposes, I've added a stylesheet to my website. The final result sh
226224
**German Version:**
227225

228226
<figure><img src="images/final-result-da.png" alt=""><figcaption></figcaption></figure>
227+
228+
## Using Multiple languages across APIs
229+
230+
When requesting content over an API, the culture will fall back to the default, unless explicitly set.
231+
232+
To do this, you can use the IVariationContextAccessor.
233+
234+
```csharp
235+
public class ExampleController : SurfaceController
236+
{
237+
private readonly ILocalizationService _localizationService;
238+
private readonly IVariationContextAccessor _variationContextAccessor;
239+
240+
public ExampleController(IUmbracoContextAccessor umbracoContextAccessor, IUmbracoDatabaseFactory databaseFactory, ServiceContext services, AppCaches appCaches, IProfilingLogger profilingLogger, IPublishedUrlProvider publishedUrlProvider, ILocalizationService localizationService, IVariationContextAccessor variationContextAccessor) : base(umbracoContextAccessor, databaseFactory, services, appCaches, profilingLogger, publishedUrlProvider)
241+
{
242+
_localizationService = localizationService;
243+
_variationContextAccessor = variationContextAccessor;
244+
}
245+
246+
public IActionResult Index(string culture = null)
247+
{
248+
IEnumerable<ILanguage> UmbracoLanguages = _localizationService.GetAllLanguages(); //a helpful method to get all configured languages
249+
var requestedCulture = UmbracoLanguages.FirstOrDefault(l => l.IsoCode == culture);
250+
251+
if (requestedCulture != null)
252+
{
253+
_variationContextAccessor.VariationContext = new VariationContext(requestedCulture.IsoCode);
254+
}
255+
256+
//this will now be in the requested culture
257+
var content = UmbracoContext.Content.GetAtRoot();
258+
259+
//Content requested in this View Component will now be in the requested culture
260+
return ViewComponent();
261+
}
262+
}
263+
```
264+
265+
### Creating a Language Switching Navigation
266+
267+
To navigate between languages, we need to do two key things:
268+
269+
1. Get all the languages that the site can provide
270+
2. Identify the language used on the current page
271+
272+
Once you have these, you need to loop through the languages and provide links to each home node.
273+
274+
### Getting all the languages for a site
275+
276+
There are two ways to achieve this. One is to use `localizationService.GetAllLanguages();` to call the database, which is expensive and ideally includes caching.
277+
278+
The alternative is to get the Home node and find all cultures associated with it. This has a few benefits including speed and providing us with a link to show the user. It is the process you will use when following this guide.
279+
280+
### Identify the language for the current page
281+
282+
This is achieved in `cs.html` files using `umbracoHelper.AssignedContentItem.GetCultureFromDomains();`.
283+
284+
#### Steps
285+
286+
Now that you have what you need, take the following steps to create a working example.
287+
288+
1. Create a new view called `Navigation.cshtml`
289+
2. Paste in the following code:
290+
291+
```cshtml
292+
@using Umbraco.Cms.Web.Common
293+
@inject IUmbracoHelperAccessor _umbracoHelperAccessor;
294+
295+
@{
296+
_umbracoHelperAccessor.TryGetUmbracoHelper(out var umbracoHelper);
297+
298+
var homePage = umbracoHelper.ContentAtRoot().FirstOrDefault(c => c.ContentType.Alias == "{{homeNodeContentAlias}}");
299+
var cultures = homePage?.Cultures;
300+
}
301+
302+
@if (cultures.Count > 1)
303+
{
304+
<ul aria-label="Language switcher">
305+
@foreach (var cult in cultures)
306+
{
307+
//get the settings for this culture
308+
System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo(cult.Key);
309+
//if the current page has a language variant, otherwise link to the homepage language variant
310+
string langUrl = umbracoHelper.AssignedContentItem.Url(cult.Key, UrlMode.Relative) ?? homePage.Url(cult.Key, UrlMode.Relative);
311+
312+
<li>
313+
@if (cult.Key.ToLower() == umbracoHelper.AssignedContentItem.GetCultureFromDomains().ToLower())
314+
{
315+
<span aria-current="true" >@culture.NativeName</span>
316+
}
317+
else
318+
{
319+
<a href="@langUrl" hreflang="@cult.Key" lang="@cult.Key" >@culture.NativeName</a>
320+
}
321+
</li>
322+
}
323+
</ul>
324+
}
325+
```
326+
327+
3. Replace `{{homeNodeContentAlias}}` with the Document Type alias of your Home node.
328+
329+
This will render links to either the language variant of the current page or the home node for the language variant.
330+
331+
Additionally, `System.Globalization.CultureInfo` is used to obtain the native name of the language being rendered. This is useful if a user does not speak the default language.

10/umbraco-commerce/installation/licensing-model.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ This is an add-on domain for existing licenses. Refunds will not be given for th
4545

4646
## Configuring your license
4747

48-
You can look at the pricing, features, and purchase a license on the [Umbraco Commerce](https://umbraco.com/products/add-ons/commerce/) page. A member of the [sales team](mailto:[email protected]) will manage this process. In the process, you will need to provide all domains you wish to have covered by the license such as primary and development/staging/QA domains. You should then receive a license code to be installed in your solution.
48+
You can look at the pricing, features, and purchase a license on the [Umbraco Commerce](https://umbraco.com/products/add-ons/commerce/) page. A member of the sales team will manage this process. You will need to provide all domains you wish to have covered by the license such as primary and development/staging/QA domains. You should then receive a license code to be installed in your solution.
4949

5050
### Add additional domains
5151

52-
If you require to add addition domains to the license, please reach out to a member of the [SUITS team](mailto:suits@umbraco.com) with your request and they will manage this process.
52+
If you require to add addition domains to the license, [reach out the sales team](https://umbraco.com/products/add-ons/commerce/) with your request and they will manage this process.
5353

5454
## Installing your license
5555

10/umbraco-ui-builder/installation/licensing-model.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ This is an add-on domain for existing licenses. Refunds will not be given for th
4545

4646
## Configuring your license
4747

48-
You can look at the pricing, features, and purchase a license on the [Umbraco UI Builder](https://umbraco.com/products/add-ons/ui-builder/) page. On this page, you can fill out the form with your project details and requirements. A member of the [Sales team](mailto:[email protected]) will manage this process. In the process, you will need to provide all domains you wish to have covered by the license such as primary and staging/QA domains. You should then receive a license code to be installed in your solution.
48+
You can look at the pricing, features, and purchase a license on the [Umbraco UI Builder](https://umbraco.com/products/add-ons/ui-builder/) page. On this page, you can fill out the form with your project details and requirements. A member of the Sales team will manage this process. In the process, you will need to provide all domains you wish to have covered by the license such as primary and staging/QA domains. You should then receive a license code to be installed in your solution.
4949

5050
### Add additional domains
5151

52-
If you require to add additional domains to the license, please reach out to a member of the [Sales team](mailto:suits@umbraco.com). They will manage your request and take care of the process.
52+
If you require to add additional domains to the license, [reach out to the sales team](https://umbraco.com/products/add-ons/ui-builder/). They will manage your request and take care of the process.
5353

5454
## Installing your license
5555

10/umbraco-workflow/installation/licensing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Umbraco Workflow is a licensed product that does not require a purchase. New ins
44

55
## Purchasing an Umbraco Workflow License
66

7-
You can look at the pricing, plans, and features on the [Umbraco Workflow](https://umbraco.com/products/add-ons/workflow/) page. If you want to buy an Umbraco Workflow license, reach out to the sales team at [**[email protected]**](mailto:suits@umbraco.com). Existing Plumber license holders who wish to upgrade to Umbraco Workflow should contact [**[email protected]**](mailto:suits@umbraco.com).
7+
You can look at the pricing, plans, and features on the [Umbraco Workflow](https://umbraco.com/products/add-ons/workflow/) page. If you want to buy an Umbraco Workflow license, use [the contact form to get in touch](https://umbraco.com/products/add-ons/workflow/). Existing Plumber license holders who wish to upgrade to Umbraco Workflow should contact us using the contact from on the [Workflow product page](https://umbraco.com/products/add-ons/workflow/).
88

99
## Installing your license
1010

13/umbraco-cms/fundamentals/setup/server-setup/azure-web-apps.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ You can also copy the following JSON directly into your Azure Web App configurat
5555
}
5656
</code></pre>
5757

58+
Remember to add an `ASPNETCORE_ENVIRONMENT` variable with values `Development`, `Staging`, or `Production`.
59+
5860
The minimum recommended Azure SQL Tier is "S2", however noticeable performance improvements are seen in higher Tiers
5961

6062
If you are load balancing or require the scaling ("scale out") ability of Azure Web Apps then you need to consult the [Load Balancing documentation](load-balancing/). This is due to the fact that a lot more needs to be configured to support scaling/auto-scaling.

13/umbraco-cms/legacy-documentation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ This documentation platform covers only major versions of the Umbraco CMS since
88

99
The documentation for Umbraco 7 and 8 lives on [our.umbraco.com](https://our.umbraco.com/documentation/).
1010

11-
<table data-card-size="large" data-view="cards"><thead><tr><th align="center"></th><th data-hidden></th><th data-hidden></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><strong>Umbraco 7 Documentation</strong></td><td></td><td></td><td></td><td><a href="https://our.umbraco.com/documentation/">https://our.umbraco.com/documentation/</a></td></tr><tr><td align="center"><strong>Umbraco 8 Documentation</strong></td><td></td><td></td><td></td><td><a href="https://our.umbraco.com/documentation/">https://our.umbraco.com/documentation/</a></td></tr><tr><td align="center"><strong>Umbraco 11 Documentation</strong></td><td></td><td></td><td></td><td><a href="https://github.com/umbraco/UmbracoDocs/tree/umbraco-eol-versions">https://github.com/umbraco/UmbracoDocs/tree/umbraco-eol-versions</a></td></tr></tbody></table>
11+
<table data-card-size="large" data-view="cards"><thead><tr><th align="center"></th><th data-hidden></th><th data-hidden></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><strong>Umbraco 7 Documentation</strong></td><td></td><td></td><td></td><td><a href="https://our.umbraco.com/documentation/">https://our.umbraco.com/documentation/</a></td></tr><tr><td align="center"><strong>Umbraco 8 Documentation</strong></td><td></td><td></td><td></td><td><a href="https://our.umbraco.com/documentation/">https://our.umbraco.com/documentation/</a></td></tr><tr><td align="center"><strong>Umbraco EOL Documentation</strong></td><td></td><td></td><td></td><td><a href="https://github.com/umbraco/UmbracoDocs/tree/umbraco-eol-versions">https://github.com/umbraco/UmbracoDocs/tree/umbraco-eol-versions</a></td></tr></tbody></table>

13/umbraco-cms/reference/configuration/contentsettings.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,15 @@ See [Content Version Cleanup](../../fundamentals/data/content-version-cleanup.md
200200
}
201201
```
202202

203-
If you don't wish to retain any content versions except for the current draft and currently published you can set both of the "keep" settings values to 0. After doing this, the next time the scheduled job runs (hourly) all non-current versions (except those marked "prevent cleanup") will be removed.
203+
To retain only the current draft and published version, set both the "keep" settings values to 0. The next time the scheduled job runs (hourly) all non-current versions (except those marked "prevent cleanup") will be removed.
204204

205205
### EnableCleanup
206206

207-
When `true` a scheduled job will delete historic content versions that are not kept according to the policy every hour.
207+
When set to `true`, a scheduled job will delete historic content versions that are not retained according to the policy every hour.
208208

209-
When `false`, the scheduled job will never delete any content versions regardless of overridden settings for a Document Type.
209+
When set to `false`, the scheduled job will not delete any content versions, regardless of any overridden settings for a Document Type.
210210

211-
This defaults to `false` when not set in the configuration which will be the case for those upgrading from v9.0.0. However, the dotnet new template will supply an appsettings.json with the value set to true for all sites starting from Umbraco 9.1.0.
211+
The dotnet new template provides an `appsettings.json` file with the default value set to `true` for all sites.
212212

213213
### KeepAllVersionsNewerThanDays
214214

13/umbraco-cms/reference/templating/modelsbuilder/understand-and-extend.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ public partial class TextPage : PublishedContentModel
4545
What is important is the `Header` property. The rest is (a) a constructor and (b) some static helpers to get the `PublishedContentType` and the `PublishedPropertyType` objects:
4646

4747
```csharp
48-
var contentType = TextPage.GetModelContentType(); // is a PublishedContentType
49-
var propertyType = TextPage.GetModelPropertyType(x => x.Header); // is a PublishedPropertyType
48+
var contentType = TextPage.GetModelContentType(_publishedSnapshotAccessor); // is a PublishedContentType
49+
var propertyType = TextPage.GetModelPropertyType(_publishedSnapshotAccessor, x => x.Header); // is a PublishedPropertyType
50+
51+
// Where _publishedSnapshotAccessor is an injected IPublishedSnapshotAccessor service
5052
```
5153

5254
## Composition and Inheritance

13/umbraco-commerce/installation/the-licensing-model.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ This is an add-on domain for existing licenses. Refunds will not be given for th
4545

4646
## Configuring your license
4747

48-
You can look at the pricing, features, and purchase a license on the [Umbraco Commerce](https://umbraco.com/products/add-ons/commerce/) page. A member of the [sales team](mailto:[email protected]) will manage this process. In the process, you will need to provide all domains you wish to have covered by the license such as primary and development/staging/QA domains. You should then receive a license code to be installed in your solution.
48+
You can look at the pricing, features, and purchase a license on the [Umbraco Commerce](https://umbraco.com/products/add-ons/commerce/) page. A member of the sales team will manage this process. You will need to provide all domains you wish to have covered by the license such as primary and development/staging/QA domains. You should then receive a license code to be installed in your solution.
4949

5050
### Add additional domains
5151

52-
To add additional domains to your license, reach out to a member of the [Sales team](mailto:suits@umbraco.com) with your request and they will manage this process.
52+
If you require to add addition domains to the license, [reach out the sales team](https://umbraco.com/products/add-ons/commerce/) with your request and they will manage this process.
5353

5454
## Installing your license
5555

0 commit comments

Comments
 (0)