Skip to content
Cigano Morrison Mendez edited this page Jul 25, 2016 · 4 revisions

Welcome to the i18n wiki! The i18n library is designed to replace the use of .NET resources in favor of an easier, globally recognized standard for localizing ASP.NET-based web applications.

Platforms Supported

i18n itself targets .NET Framework 4, and works with websites and web applications based on ASP.NET v4 and above, including:

  • ASP.NET MVC
  • ASP.NET Web API
  • ASP.NET WebMatrix / Web Pages
  • ASP.NET Web Forms

Features

  • Leverages the GetText / PO ecosystem: localize like the big kids
  • Localize everything: HTML, Razor, C#, VB, JavaScript, .NET attributes and data annotations, ...
  • SEO-friendly: language selection varies the URL, and Content-Language is set appropriately
  • Automatic: no URL/routing changes required in the app
  • High performance, minimal overhead and minimal heap allocations
  • Unit testing support
  • Smart: knows when to hold them, fold them, walk away, or run, based on i18n best practices.

Installation

In your Web project, open Package Manager Console (View > Other Windows > Package Manager Console) and type:

    PM> Install-Package i18N

This will install i18n in your solution.

Configuration

Add the following into your web.config file:

<configuration>
  ...
  <appSettings>
    ...
    <add key="i18n.DirectoriesToScan" value=".." /> <!-- Rel to web.config file -->
    <add key="i18n.WhiteList" value="*.cs;*.cshtml;*.sitemap" />
    <add key="i18n.BlackList" value=".\js\kendo;.\js\angular" />
    <add key="i18n.AvailableLanguages" value="en-US;fr-FR;pt-BR" />
    ...
  </appSettings>
  ...
  <system.web>
    ...
    <httpModules>
      ...
      <add name="i18n.LocalizingModule" type="i18n.LocalizingModule, i18n" />
      ...
    </httpModules>
  ...
  </system.web>
  ...
  <system.webServer> <!-- IIS7 'Integrated Mode'-specific config -->
    ...
    <modules>
      ...
      <add name="i18n.LocalizingModule" type="i18n.LocalizingModule, i18n" />
      ...
    </modules>
    ...
  </system.webServer>
  ...
</configuration>

Note: The <system.web> element is added for completeness and may not be required.

Clone this wiki locally