This week in Orchard - 05/03/2019

Gábor Domonkos's avatar
Permissions, JavaScript, Localization, Crowdin, Documentation, This week in Orchard

The content localization for Orchard Core reached a huge milestone! Don't hesitate to read our post about the newest awesome features of the CMS!

On Orchard Core

Apply dynamic content type permissions to Admin Menu

The dynamic content type permissions are now implemented. In the past they were not supported in the navigation (you clicked on the menu and got a permission error message), now the admin menu reflects the permissions.

You can see an example of this in the following GIF. There is a user who logged in with a contributor role. If the admin adds or removes permissions, the admin menu reflects the changes and hides/shows the options in the New, Content Types and List Admin Node menu.

Features bulk actions

Now you can enable multiple features at the same time. In the past, we had the checkboxes, but we were not taking them into consideration.

If you navigate to Configuration -> Modules and open the select list near the Actions, you can see that now you can enable, disable and toggle the features that you have selected using the checkboxes before them.

Use Bootstrap modal instead of browser confirm

When you have to confirm an action (like Delete), we're using a Bootstrap modal instead of the native browser popup, so it looks nicer. And of course it's also localizable in the following way:

<div id="confirmRemoveModalMetadata" data-title="@T["Delete"]" data-message="@T["Are you sure you want to remove this element?"]" data-ok="@T["Ok"]" data-cancel="@T["Cancel"]"></div>

This div has data attributes in it (for example title and message) and we localize the text here that we want to include to JavaScript. From JavaScript, we load the element by ID and get its data which is the localized text. You don't inject localization in JavaScript, you inject it in HTML for encoding and security reasons.

Orchard Core Translations repository

By using this repository, we will automatically get all the localizations from Crowdin. There will be an AppVeyor script, that will automatically list all the localizations from Crowdin and generate a NuGet package for each of the languages and then push it to NuGet. So, the AppVeyor script will download the files, create a package and publish it to NuGet. This package will contain the AppData with the exact structure, so it will contain the pot files for the language.

ASP.NET Core - App Building Workshop

There was an app building workshop, where developers created something using ASP.NET Core. The demo is about building a conference agenda website. Sébastien did it also in Orchard Core to be sure you can do the same thing in Orchard. In our documentation, we have a Guides section and there is a tutorial called Building a Website from a Web Template (TBD). With the help of this conference, we could write this section soon.

RTL support for TheAdmin theme

The latest issue was to merge this PR was to do not manage two different files and then to have some condition in the theme to check the current culture and then switch between the CSS files. The goal is to have only one single CSS file and thanks to Hisham Bin Ateya this PR now merged.


Content localization

If you would like to make your content items localizable you have to enable the Content Localization module. Then you can head to the Configuration -> Settings -> General page and hit the Add or remove supported cultures for the site link and add supported cultures for the site. Let's add some cultures!

Now you have an enabled Content Localization module and added some supported cultures to your site. Time to do some content localization!

By enabling the Content Localization module, you can attach a new content part, called Localization to the content type that you would like to localize. Let's edit the Blog Post content definition and add the Localization part to it!

When you install your site using the Blog recipe, you have one predefined blog post. If you would like to edit your blog post, you will get the following screen.

You will notice that you cannot add a new localized instance of your content item until you do not save the existing one. By saving a content item that exists before, you will create the localized version of the content item, in our case the Hungarian version will be created, because this is the default culture of our site.

After saving the content item you will notice that the editor has changed.

The list of the cultures this site supports appears with a little plus sign before each culture. By clicking one of the plus signs, a new localized version of the content will create, keeping the content of the item.

If you navigate back to Blog, you will see a little badge icon under each blog post showing the culture of the content item. Notice the new Localizations button. By clicking on it, you can create a new localized version of the content item or edit an existing one.

Now if you edit the Hungarian version of this blog post, you will see the changed icon before the Qafar. That's because a content item with that culture already exists and by selecting the Qafar version, you can edit the existing content item instead of creating a new one.

Thanks to JP Tissot, this feature will be merged to dev soon and with this PR, we will reach a huge milestone towards supporting localization in Orchard Core!

On Lombiq

Orchard Dojo Newsletter

Now we have 59 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