Skip to main content
AI/MLCrestApps

orchardcore-localization

Skill for configuring localization and multi-language support in Orchard Core. Covers culture settings, content localization, PO file translations, and localization configuration. Use this skill when requests mention Orchard Core Localization, Configure Localization and Multi-Language Support, Enabling Localization Features, Localization Settings via Recipe, PO File Format, PO File Location Convention, or closely related Orchard Core implementation, setup, extension, or troubleshooting work. Strong matches include work with OrchardCore.Localization, OrchardCore.ContentLocalization, IStringLocalizer, LocalizationSettings, IActionResult, IViewLocalizer, LocalizationPart, AlterTypeDefinition, WithPart, IStringLocalizer<T>. It also helps with localization examples, PO File Format, PO File Location Convention, Using Localization in C# Code, plus the code patterns, admin flows, recipe steps, and referenced examples captured in this skill.

Stars
13
Source
CrestApps/CrestApps.AgentSkills
Updated
2026-05-29
Slug
CrestApps--CrestApps.AgentSkills--orchardcore-localization
View on GitHubRaw SKILL.md

// install — copy + paste into any project

mkdir -p .claude/skills && curl -fsSL https://raw.githubusercontent.com/CrestApps/CrestApps.AgentSkills/HEAD/plugins/orchardcore/skills/orchardcore-localization/SKILL.md -o .claude/skills/orchardcore-localization.md

Drops the SKILL.md into .claude/skills/orchardcore-localization.md. Works with Claude Code, Cursor, and any agent that loads SKILL.md files from .claude/skills/.

Orchard Core Localization - Prompt Templates

Configure Localization and Multi-Language Support

You are an Orchard Core expert. Generate localization configuration for multi-language Orchard Core sites.

Guidelines

  • Enable OrchardCore.Localization for basic localization support.
  • Enable OrchardCore.ContentLocalization for content item translation.
  • PO files (.po) are used for string translations.
  • Place PO files in the module's Localization/ folder.
  • Use IStringLocalizer<T> in C# code for localizable strings.
  • Use {% t %} tag in Liquid templates for translations.
  • Content localization links translated content items together.
  • Culture picker allows users to switch between languages.

Enabling Localization Features

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "OrchardCore.Localization",
        "OrchardCore.ContentLocalization",
        "OrchardCore.ContentLocalization.ContentCulturePicker"
      ],
      "disable": []
    }
  ]
}

Localization Settings via Recipe

{
  "steps": [
    {
      "name": "Settings",
      "LocalizationSettings": {
        "DefaultCulture": "{{DefaultCulture}}",
        "SupportedCultures": [
          "{{Culture1}}",
          "{{Culture2}}",
          "{{Culture3}}"
        ]
      }
    }
  ]
}

PO File Format

Place PO files in Localization/{culture}.po (e.g., Localization/fr.po):

# French translations
msgid "Hello"
msgstr "Bonjour"

msgid "Welcome to {0}"
msgstr "Bienvenue à {0}"

msgid "Blog Post"
msgstr "Article de blog"

# Context-specific translation
msgctxt "MyModule"
msgid "Title"
msgstr "Titre"

PO File Location Convention

MyModule/
├── Localization/
│   ├── fr.po
│   ├── es.po
│   ├── de.po
│   └── ja.po

Using Localization in C# Code

using Microsoft.Extensions.Localization;

public sealed class MyController : Controller
{
    private readonly IStringLocalizer S;

    public MyController(IStringLocalizer<MyController> localizer)
    {
        S = localizer;
    }

    public IActionResult Index()
    {
        ViewData["Title"] = S["Welcome to my site"];
        ViewData["Message"] = S["Hello, {0}!", User.Identity.Name];
        return View();
    }
}

Using Localization in Views (Razor)

@inject IViewLocalizer Localizer

<h1>@Localizer["Welcome"]</h1>
<p>@Localizer["This site has {0} articles.", articleCount]</p>

Using Localization in Liquid

{% t "Welcome to our site" %}
{% t "Hello, {0}!" User.Identity.Name %}

Content Localization

Content localization connects translated versions of the same content item:

// Add LocalizationPart to a content type
_contentDefinitionManager.AlterTypeDefinition("Article", type => type
    .WithPart("LocalizationPart")
);

Culture Picker Widget

Add the culture picker to your layout:

{% shape "ContentCulturePicker" %}

Configuring Request Culture Providers

{
  "OrchardCore": {
    "OrchardCore_Localization_CultureProvider": {
      "CookieName": ".AspNetCore.Culture",
      "UseUserOverrideCulture": true
    }
  }
}

Date and Number Formatting

Localized date formatting in Liquid:

{{ Model.ContentItem.PublishedUtc | local | date: "%x" }}
{{ Model.ContentItem.PublishedUtc | local | date: "%B %d, %Y" }}

Plural Forms in PO Files

msgid "One item"
msgid_plural "{0} items"
msgstr[0] "Un élément"
msgstr[1] "{0} éléments"