This week in Orchard - 06/21/2019

Gábor Domonkos's avatar
Localization, This week in Orchard

In our post you could read a demo about the Localized Content Picker Field. But first, let's talk about the Orchard Core RC release for the first time! Then check the benchmarks of Orchard Core and many more!

On Orchard Core

Localized date picker

There is a new editor for the Date Field called Localized Date Field. In this case, instead of using the default jQuery date editor, it uses the jQuery UI internationalized editor that based on the current culture to display the calendar with the current culture. Just select the Localized editor option when editing the Date Field.

Orchard Core RC

We might ship the RC version of Orchard Core when the .NET Core 3 is shipped because it will be faster and will contain more features. The RC version of .NET Core 3 is scheduled for July 2019, which means we can rely on RC because it will be stable, there won't be breaking changes until the General Availability.

Here you see that the original release date for .NET Core 3.0 is scheduled for September 23, 2019.

Still need to use Json.NET for GraphQL

ASP.NET Core 3.0 is not using the Json.NET NuGet package anymore. It will use System.Text.Json, which will be part of .NET Core. But we do use Json.Net to represent the content items internally. So, when we try to do a GET API call to get a content item, then we try to serialize it using our custom serializer, and then System.Text.Json doesn't work with that, because it doesn't know how to serialize a JObject. So for that, we have to add Json.NET. There is no much difference between the two, just Json.NET has more features than System.Text.Json. Json.NET is a little bit slower, but when you have millions of other requests per seconds, you don't really care. The goal here is to be able to ship some JSON serialization without having to rely on third-party dependencies.

Benchmarks of Orchard Core

If you navigate to this URL (that is a benchmark page where Microsoft tracks all ASP.NET Core applications) and click on the pager you can find a page called Custom. In this list you have many scenarios. You can select the OrchardBlog option from the checkbox list. If you select this, you will see the benchmarks of an Orchard Core site using the Blog recipe. In the list there are two sets of machines, these are represented by the Cloud and the Physical checkboxes under the Hardware option. The cloud one is a machine in Azure using the D3 instance with 4 cores and 14 GB RAM. The physical machine is the same.

In both machines, you can see the benchmarks with Linux and Windows operating systems. The red line in the diagrams belongs to the Windows OS, the black one is for Linux. As you can see, ASP.NET Core is a little bit faster (the difference is about 10 percent) when you run it in a machine that uses Windows. Here you can see the latencies and the startup time. The Startup Main (ms) means the time of the actual startup, from command dotnet run to application is started state.

The memory usage is also tracked, where you can see how much memory is Orchard Core using. The CPU usage is lower on Linux and higher on Windows. On Windows, it's close to 100%, which is what we want. You can see the history of bad responses, for instance, 500 or something like this.

This page also tracks the GC stats. Time in GC is a very important number. This is the percentage of time that the CPU spent in GC instead of processing stuff. So it's just collecting stuff instead of doing operations. We need to look into that and lower the number.

Content Culture Picker

The Content Culture Picker module helps you manage cultures for the frontend. This uses a dropdown listing all the supported cultures and you select which culture you want to see when you are on the website.

The Content Culture Picker selects the URL to redirect to like:

  • if the ContentItem has a related ContentItem for the selected culture, it redirects to that Item
  • if a HomePage is specified, finds the ContentItem that is set as the Homepage and attempt to find a Localization of this ContentItem for the current culture
  • or a NotFound() page

This feature is still under development, but you can see the code in this PR!


Localized Content Picker Field

Let's imagine a content type that is localized to different cultures. When using a localized content picker field you can get the localized text of the attached content item and by using this field you can only attach one type of localization of the selected content type. For example, let's add the LocalizationPart to the Article content type and create different localizations for the Article. Now let's do the interesting stuff!

Create another content type (in our case call it ArticlePicker) and adds the Localized Content Picker to it that allows you to pick from Article content types.

Now when you create a new ArticlePicker, you can select the Á-Propos (means About) article, but you cannot add another localization of this content item.

On Lombiq

Lombiq Orchard Visual Studio Extension now supports VS 2019

Our Orchard CMS and Orchard Core Visual Studio extension just got an update: it's now compatible with Visual Studio 2019! Check it out in the MarketPlace to get it, if you haven't used it already!

Orchard Dojo Newsletter

Now we have 75 subscribers of the Lombiq's Orchard Dojo Newsletter! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail every time when a new post published to Orchard Dojo, including This week in Orchard of course.

Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here!

If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting!

No Comments

Add a Comment