Culture picker on the Setup page, CodeMirror editor for TextField - This week in Orchard (28/03/2020)

This week you could see a demo about the brand new culture picker on the Setup page! We will also check the new CodeMirror editor for the TextField, the new EmailAddressValidator service, a new Orchard Nuggets blog post and Lombiq's Open-Source Orchard Core Extensions! And that's not all!

Orchard Core updates

CodeMirror editor for TextField

There is a new editor for the TextField, where you can use CodeMirror. To try this just install your site using the Blog recipe and edit the content definition of the BlogPost content type. Set the editor type of the Subtitle TextField to Code Mirror, then hit Save.

And now if you edit the predefined blog post or create a new one, you will see the changed editor for the Subtitle TextField. It uses a text area, and of course, supports to write code here by different kinds of highlighting.

Add DataAnnotation default error messages

There is an issue filed that the DataAnnotation attributes are not localized correctly, because the actual strings to be localized are taken from resources or hard-coded in the DataAnnotation classes. In these cases, we don't have them in the PO files, so they can't be translated because the PO extractor doesn't find them. To solve that there is a new DataAnnotationsDefaultErrorMessages class, that defines all the strings that are currently in the resx files of ASP.NET, but as a custom class with calls to the StringLocalizer. This way the PO file extractor can find them and we can localize them in Crowdin and provide the missing PO files for that.

The second step is actually to use them and ensure it works, but also be able to extract custom messages that you would put in the DataAnnotation. In a DataAnnotation like EmailOrRequired you might say Email but provide a custom string. In this case, in the custom string, we still need to extract it. At least the default messages that are nowhere in the code should be registered somewhere like this. So, we can have a reference list of things to translate and then the localizer will be able to pick the correct translation. That's a good first step.

Prevent anonymous users from performing GET on content item API

You want anonymous users to be able to view your site, view your page/content item and it would just show what the layout is or the view is. But you might not want anonymous users to retrieve the full content item JSON payload, because it might show some properties and metadata that you don't want to expose. Now there is custom permission that is called GetApiContent that you can assign to specific roles and this is not assigned to anonymous users by default.

Update Documentation for non-Visual Studio users

Getting started with an Orchard Core Theme page of the Orchard Core Documentation has been updated with guides about how to create a new theme if you are using other IDE then Visual Studio.

Add EmailAddressValidator service

This one is to make a new IEmailAddressValidator service that is available by default in Orchard.Infrastructure.Abstractions. It's using MailKit so that's a new service that you can use to validate email. And if you would like to replace it, you can add your own logic for email validation.

Add tenant description

Now you can define a description of the views for each tenant. If you add a new tenant by navigating to Configuration -> Tenants -> Add Tenant, see the list of tenants or use the Create Tenant Task in your workflows, you will meet with this new option.

Demos

Culture picker on the Setup page

When you have the latest dev you have this Setup screen where the new thing is the culture picker at the top right. Note that the Change language string not has been localized yet, so the default behavior is that it will show up using whatever language has been selected, the default one comes from the browser. Or if there is no match from your system, the default will be English. That won't configure the site for the same language because it's just the setup experience, so it won't enable localization by default. Because we have a quite much language translated and supported, the UI will adapt automatically to the selected one. If you take a language that would be an RTL language like Arabic, the direction of the text will also change.

If you are interested in the full demo, don't hesitate to go to YouTube and view the recording!

News from the community

Orchard Nuggets: How to localize content items?

So you want to create an Orchard Core website that presents its content in multiple languages. There are many parts of this, but what about content items? How do you make them ready for localization? In our newest Orchard Nuggets post, we give you the answers! Check out the other posts for more such bite-sized Orchard tips and let us know if you'd have another question!

Lombiq's Open-Source Orchard Core Extensions

An Orchard Core CMS Visual Studio solution that contains most of Lombiq's open-source Orchard modules and themes. Only those extensions are included which use the latest released version of Orchard (i.e. ones depending on a nightly build are not yet here). Since the extensions are included as git submodules when cloning this repo set git to initialize submodules

Bug reports, feature requests, comments, questions, and code contributions are warmly welcome, please do so via GitHub issues and pull requests. Please adhere to our open-source guidelines while doing so.

Orchard Dojo Newsletter

Now we have 129 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 whenever 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!

Send us new blog feeds

Noticed that a blog's feed is missing from the list? 

We would love to add that to the feed list, so please don't hesitate to inform us on the following e-mail adress:

crew@lombiq.com

See our privacy policy.