Admin Culture Picker, Health Checks Module - This week in Orchard (31/03/2023)

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

Add Culture Picker for the Admin Site; a new version of Fluid, and a demo about the Health Checks Module! Check out our post for the details!

Orchard Core updates

Add Culture Picker for the Admin Site

Unless you have a language switcher on website pages you cannot switch a language in the admin panel. This can be solved by having a dropdown in the admin panel header to switch languages. If you head to Configuration -> Features and type "culture", you will see two features:

  • Admin Culture Picker which provides a culture picker shape for the admin area.
  • Content Culture Picker which provides a culture picker shape for the frontend.

The first one is the new one, so enable the Admin Culture Picker feature! After you enable this feature, probably nothing will change. But why? Well, that's because if your site only supports one culture, there is no need to display a culture picker to choose from the different cultures. So, let's navigate to Configuration -> Settings -> Localization and have at least two different supported cultures. After that, you will see the new dropdown in the NavbarTop zone of the admin theme which you can use to switch between cultures.

Admin Culture Picker

Fluid 2.4.0

Fluid is an open-source .NET templating engine that is as close as possible to the Liquid template language. It's a secure template language that is also very accessible to non-programmer audiences. It also contains an ASP.NET Core MVC View Engine. And of course, Orchard Core is using Fluid too to generate templates. Fluid 2.4.0 has been released this month, so let's see some of the changes that this release contains!

This release contains the implementation of some missing strftime formats. You can write: var source = "date:"{{Date | date:'%F %T.%3N'}}""; which results date:"2022-12-19 14:23:02. %3N". And as you can see, the %3N does not take effect. So, now all of these formatting parameters are implemented in Fluid meaning you can have more ways to print formatted dates. Like adding support for formats that will depend based on the first day of the week. Or if you ask for the number of weeks of the current day, then it might depend on what is the first day of the week. And there is a standard like Monday but sometimes you say that Sunday is the first day of the week.

Tests for the missing strftime formats

Another change is to introduce a "local" time zone for the time_zone filter. Meaning if you want to use a time zone that is the local time zone of the configuration (in Orchard it would be configured as the standard time zone), then you can use "local". Because you might get a UTC date and you want to display it with the local time zone. To do that, you can do: {{ now | date | time_zone: 'local' }}.

ShouldChangeToLocalTimeZone test


Health Checks Module

For this demo, we will clone the following GitHub repository which contains a set of modules for Orchard Core CMS that is driven by the community members who love Orchard Core. This will encourage all the passionate developers to build modules that aren't included in Orchard Core. Such modules may be necessary for the community or essential for any sort of CMS.

This repository contains several modules, this time we will check out the one called Health Checks Module, which provides health checks for the website. Orchard Core has a built-in Health Check module, the goal of this one is the extend the functionality of the built-in one.

If you run this repository and enter the admin site using the admin username and admin@OCC123 password, you can navigate to Configuration -> Features and enable the Health Checks module. And while we are here, let's also ensure that the SendGrid module is enabled. But why? Because the Health Checks module is capable of checking the status of the SendGrid module. If you navigate to /health/sendgrid, you will see an Unhealthy message. Meaning that the SendGrid module is available and could be used without any issues but you have to configure its settings to make that service available for the users.

Try to enable the Multitenancy feature as well and create a new tenant but do not set it up, just create it. After, head to the /health URL and see what it shows.

Using the Health Checks module

Here you can find the status of SendGrid as before and another one called Tenants Health Check. As you can see, the name of the tenant that we have just created is Blog, but we haven't set it up (just created it), that's why you can see an Unhealthy status here. You can see the System Updates Health Check here as well because we enabled the System Module last week.

And as always, if you would like to learn more about this module, don't forget to check out this recording on YouTube!

News from the community

Orchard Dojo Newsletter

Lombiq's Orchard Dojo Newsletter has 434 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course.

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

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

No Comments

Add a Comment