Skip to content

joakimriedel/dotnet-cldr-resx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotnet-cldr-resx

Dotnet tool that generates RESX files based on CLDR data. The resulting files could be used in a .NET Core project to display localized names of languages or countries.

Installation

dotnet tool install -g dotnet-cldr-resx

Usage

Prerequirements: a local copy of the cldr-localenames-modern package. If you do not already have it installed, do npm i cldr-localenames-modern --save-dev first.

In your .NET Core project root, executing

cldr-resx --source territories -l da en fi nb sv -o .\Resources\_Countries

will generate five files

  • .\Resources\_Countries.da.resx
  • .\Resources\_Countries.en.resx
  • .\Resources\_Countries.fi.resx
  • .\Resources\_Countries.nb.resx
  • .\Resources\_Countries.sv.resx

Each resource file will contain the ISO code as key, and localized name as value.

A project set up with services.AddLocalization(options => options.ResourcesPath = "Resources") could then inject IStringLocalizer<_Countries> _countryLocalizer into a controller.

_countryLocalizer[countryCode] would then return a localized name of the country specified by countryCode.

Uninstall

dotnet tool uninstall -g dotnet-cldr-resx

About

Dotnet tool that generates RESX files based on CLDR data.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages