Giter Site home page Giter Site logo

localize's Introduction

Localize

IIS module that enables granular control of culture-specific formats via the config file.

By default, ASP.NET only supports globalization in the web.config file, ie: forcing the application to a specific culture eg: en-US, en-FR, en-RU etc. The application then uses the regional settings of the host for displaying currency, number and date time information. Issues can arise with how currency, number and date/time information is handled if these regional settings differ between hosts (eg: migrating sites/services from one server to another). This IIS module allows the developer to override the format of the individual NumberFormatInfo and DateTimeFormatInfo properties in the web.config file.

Features

  • Granular control of currency, number and date/time formats for multiple cultures.
  • Global override (apply speciifc format regardless of culture).
  • Multi-process support (worker threads also honour your specified formats).
  • Override values of all public properties of the NumberFormatInfo and DateTimeFormatInfo objects.
  • No code changes required - all controlled via the web.config file.

Getting Started

Add the Localize.dll file to the bin directory of your ASP.NET web application or web service. Add config (see below). Test. Smile.

Add Config

Register the module with IIS via your web.config file:

<!-- Required -->
<system.webServer>
    <modules>
        <add name="Localize" type="Localize.CultureHelper" />            
    </modules>        
</system.webServer>

Override the hosts regional settings with custom values defined in your web.config file, eg:

<!-- Force a specific culture (optional) -->
<add key="culture.cultureName" value="en-FR" />

<!-- Global override -->
<add key="culture..NumberDecimalSeparator" value="!" />
<add key="culture..NumberGroupSizes" value="2,3,2" />
<add key="culture..CurrencySymbol" value="Z" />

<!-- Override culture-specific settings (optional, case-insensitive) -->
<add key="culture.en-za.NumberDecimalSeparator" value="." />
<add key="culture.en-za.numberdecimalDigits" value="99" />
<add key="culture.en-za.currencySymbol" value="#" />
<add key="culture.en-za.ShortDatePattern" value="MM-dd-yyyy" />
<add key="culture.en-za.ShortTimePattern" value="HHmm" />
<add key="culture.en-za.MonthDayPattern" value="MMM d" />

<add key="culture.en-US.currencySymbol" value="#" />

<add key="culture.en-fr.currencySymbol" value="@" />

Logging:

Exceptions are handled gracefully and logged to the Windows Event Log.

Additional documentation

Feedback

I welcome comments, suggestions, feature requests and honest criticism :)

Want to show your appreciation?

That's mighty generous - thank you!
Buy me a coffee

localize's People

Contributors

thurstonford avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.