Skip to content

Latest commit

 

History

History
79 lines (59 loc) · 2.36 KB

File metadata and controls

79 lines (59 loc) · 2.36 KB

How to use source generator

The HawkN.Iso.Currencies project uses a Source Generator to generate currency code files based on Unicode CLDR data.

Steps

  1. Open the HawkN.Iso.Currencies.csproj file.
  2. Enable code generation by setting the following property:
<GenerateCurrencyFiles>true</GenerateCurrencyFiles>
  1. Save the changes.
  2. Rebuild the solution.
  3. Review the generated files:
  • CurrencyCode.cs
  • LocalCurrencyDatabase.cs
  1. After verification, disable generation:
<GenerateCurrencyFiles>false</GenerateCurrencyFiles>
  1. Save changes and rebuild the solution again.

Generation is disabled by default to avoid unstable builds, network access during CI, and to keep builds reproducible.


How to update currencies data (CLDR-based)

Currency data is sourced exclusively from Unicode CLDR.
ISO XML files, SIX Group resources, and third-party JSON repositories are not used.

Data sources

Replace <release> with the desired CLDR release version (for example: release-48).

Update process

  1. Update the CLDR version if needed:
<CldrVersion>release-48</CldrVersion>
  1. Temporarily enable CLDR downloads and code generation:
<DownloadCldrFiles>true</DownloadCldrFiles>
<GenerateCurrencyFiles>true</GenerateCurrencyFiles>
  1. Rebuild the project.
  2. Verify that:
  • CLDR XML files were downloaded
  • CurrencyCode.cs and LocalCurrencyDatabase.cs were regenerated
  1. Commit the generated changes to the repository.
  2. Disable the flags again:
<DownloadCldrFiles>false</DownloadCldrFiles>
<GenerateCurrencyFiles>false</GenerateCurrencyFiles>
  1. Rebuild the project once more.

Notes

  • Historical currencies are excluded. Only currently active currencies from CLDR are included.
  • All data is distributed under the Unicode License Agreement, which is MIT-compatible.
  • The final NuGet package does not contain XML files or runtime parsers.
  • Code generation is intended to be run manually and committed, not executed on every build.