ICU4N 60.1.0-alpha.436
dotnet add package ICU4N --version 60.1.0-alpha.436
NuGet\Install-Package ICU4N -Version 60.1.0-alpha.436
<PackageReference Include="ICU4N" Version="60.1.0-alpha.436" />
paket add ICU4N --version 60.1.0-alpha.436
#r "nuget: ICU4N, 60.1.0-alpha.436"
// Install ICU4N as a Cake Addin #addin nuget:?package=ICU4N&version=60.1.0-alpha.436&prerelease // Install ICU4N as a Cake Tool #tool nuget:?package=ICU4N&version=60.1.0-alpha.436&prerelease
International Components for Unicode
ICU4N is a set of .NET libraries providing Unicode and Globalization support for software applications, a .NET port of the popular ICU4J project.
This is a port of ICU4J, version 60.1. We have ported about 50% of the code, and while we aren't planning to add any additional features it is still a work in progress.
Features
Here are some of the major features that have been ported:
- BreakIterator
- RuleBasedBreakIterator
- Normalizer
- Normalizer2
- FilteredNormalizer2
- UnicodeSet
- Collator
- RuleBasedCollator
- Transliterator
- RuleBasedTransliterator
- RuleBasedNumberFormat - only formatting from number > string is supported by calling members of the
ICU4N.Text.FormatNumberRuleBased
class or by using them as extension methods from System.Byte, System.Int16, System.Int32, System.Int64, System.Int128, System.Numerics.BigInteger, System.SByte, System.IntPtr, System.UInt16, System.UInt32, System.UInt64, System.UInt128, System.Half, System.Single, System.Double, or System.Decimal.
There are several other features too numerous to mention, but APIs are currently in flux between releases. We have over 4200 passing tests, most failures are just due to missing dependencies.
NuGet Packages
Install-Package ICU4N -Pre
The package structure is as follows:
- ICU4N (main package)
- ICU4N.Resources - See the documentation for Managing Resources
- ICU4N.Resources.NETFramework4.0 - See the documentation for Managing Resources
Documentation
We have converted most of the documentation comments so Visual Studio Intellisense works. However, for full API docs the best source at the moment is the ICU4J API Reference. There is also a lot of other great info on the ICU project's web site, such as the Feature Comparison Page.
Managing Resources
IMPORTANT: The version of resources that is used must be at the same version as ICU4N.
There are 2 ways to deploy resources with ICU4N.
Using Satellite Assemblies
This is the default and recommended way to use ICU4N resources. Using satellite assemblies to manage resources allows you to include specific neutral cultures or include them all by default.
Using Resource Files
Using resource files allows you to finely tune the amount of data that is distributed with your project by including/excluding specific features as well as cultures.
NOTE: ICU4N does not shadow copy these files. It is not recommended to use resource files to deploy resources if you are using an "always up" service (such as ASP.NET) and intend to use xCopy deployment, since the resource files may be locked by your application when you try to overwrite them.
Default Satellite Assemblies
By default, ICU4N includes a dependency on ICU4N.Resources, which includes satellite assemblies for all features and languages. For most projects, this should suffice.
For class libraries that are deployed in public systems such as NuGet, it is recommended to use the default set of resource data (the full set) to allow end users to utilize built in features of the .NET SDK to exclude resources that don't apply to them.
NOTE: For projects that target .NET Framwork prior to version
net462
, the dependency is on ICU4N.Resources.NETFramework4.0 instead. This package contains exactly the same files as ICU4N.Resources and only exists to work around the fact that NuGet doesn't support a single target framework to deploy satellite assemblies to targets belownet45
as well as targets that supportnetstandard2.0
(which supportsnet462
and higher).
Filtering Satellite Assemblies
ICU4N contains more than 750 cultures which use more than 18MB of disk space. If you are publishing an application and wish to reduce the distribution size of your application, ICU4N supports the SatelliteResourceLanguages property. Although ICU provides support for both specific and neutral cultures at runtime, the satellite assemblies are packaged as .NET neutral culture packages to eliminate issues with ICU locale names that .NET doesn't recognize. All specific cultures (such as en-GB
or fr-CA
) are packaged in the satellite assembly with the corresponding neutral culture (in this case en
and fr
respectively).
There are 4 special cases where locale names and culture names differ between ICU4N locale names and the satellite assembly names. For these locales, the .NET culture name must be used to filter the satellite assemblies even though the ICU locale name can be specified in the constructor of the UCultureInfo
class.
Language Name | ICU4N Locale Name | .NET Culture Name |
---|---|---|
Quechua | qu | quz |
Cantonese | yue | zh |
Cantonese (Simplified) | yue-Hans | zh-Hans |
Cantonese (Traditional) | yue-Hant | zh-Hant |
Example
Using the SatelliteResourceLanguages
property to only include the languages English, Spanish, and French in your distribution.
<PropertyGroup>
<SatelliteResourceLanguages>en;es;fr</SatelliteResourceLanguages>
</PropertyGroup>
This will enable ICU4N to support all variants of these languages for all ICU features and exclude the resources for any other language from the distribution.
NOTE:
SatelliteResourceLanguages
applies to all resources for dependencies of your project, not just those in ICU4N.Resources. If another library includes support for a specific culture and you want to use it in your application, you should include that specific culture name inSatelliteResourceLanguages
even though it does not specifically apply to ICU4N.
Custom Satellite Assemblies
In addition to filtering out cultures, ICU4N supports adding new cultures by compiling and packaging a new set of satellite assemblies to deploy with your application. The tools to do this are still a work in progress and there is not yet an official procedure for compiling custom satellite assemblies. You must follow the same naming conventions for resource files for ICU4N to discover any new files that are added, but do note these are still in flux and may change from one release of ICU4N to the next. The version of resources used must exactly match the version of ICU4N. Unfortunately, Microsoft's documentation on creating custom satellite assemblies is extremely out-of-date so it is recommended to use an LLM such as ChatGPT to get some direction on how to accomplish this using the .NET SDK rather than the old way of using al.exe.
Excluding ICU4N.Resources
To replace the satellite assemblies that are shipped with ICU4N, use the ExcludeAssets
feature of MSBuild to exclude the default set of satellite assemblies from the build.
<PackageReference Include="ICU4N.Resources"
Version="<the specific version of ICU4N.Resources>"
ExcludeAssets="all" />
NOTE: At the time of this writing, all versions of MSBuild have a bug where satellite assemblies that use 3-letter language codes are not copied to the build and/or publish output. ICU4N.Resources includes a patch in the
ICU4N.Resources.CopyPatch.targets
file. It is recommended that you use a NuGet package and include this file along with a.targets
file named$(PackageId).targets
that includesICU4N.Resources.CopyPatch.targets
and the properties it requires in itsbuildTransitive
folder.
Custom Resource Files
Resource files can be used to reduce the total amount of resource data even further by excluding both features and cultures that are not being used. Resource files are automatically detected if they are in the <assembly_directory>/data/<icuversion>/<feature>
directory. The default set of resource files can be downloaded from Maven for the ICU4J version corresponding to this version of ICU4N. Simply download the main icu4j.jar
file. This file can be extracted with a Zip utility. The resource data can be found in the /com/ibm/icu/impl/data/
directory.
Reducing resource data is an advanced topic. See the ICU Data topic to decide the best approach for which resources to include.
Resources will be detected automatically if they are in the /data/
directory. Note that including the versioned subdirectory (such as icudt60b
) is required.
When including custom resource data with ICU4N, be sure to exclude the ICU4N.Resources assets from the build as described in Excluding ICU4N.Resources.
Building and Testing
To build the project from source, see the Building and Testing documentation.
Saying Thanks
If you find this library to be useful, please star us on GitHub and consider a sponsorship so we can continue bringing you great free tools like this one. It really would make a big difference!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net40 is compatible. net403 was computed. net45 was computed. net451 is compatible. net452 was computed. net46 was computed. net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.0
- ICU4N.Resources.NETFramework4.0 (= 60.1.0-alpha.436)
- J2N (>= 2.1.0 && < 3.0.0)
-
.NETFramework 4.5.1
- ICU4N.Resources.NETFramework4.0 (= 60.1.0-alpha.436)
- J2N (>= 2.1.0 && < 3.0.0)
- Microsoft.Extensions.Caching.Memory (>= 1.1.2)
- System.Memory (>= 4.5.5)
- System.Net.Http (>= 4.3.4)
- System.Reflection.Metadata (>= 1.8.1)
- System.Text.RegularExpressions (>= 4.3.1)
-
.NETFramework 4.6.2
- ICU4N.Resources (= 60.1.0-alpha.436)
- J2N (>= 2.1.0 && < 3.0.0)
- Microsoft.Extensions.Caching.Memory (>= 6.0.2)
- System.Memory (>= 4.5.5)
- System.Reflection.Metadata (>= 6.0.1)
-
.NETStandard 2.0
- ICU4N.Resources (= 60.1.0-alpha.436)
- J2N (>= 2.1.0 && < 3.0.0)
- Microsoft.Extensions.Caching.Memory (>= 6.0.2)
- System.Memory (>= 4.5.5)
- System.Reflection.Metadata (>= 6.0.1)
-
net6.0
- ICU4N.Resources (= 60.1.0-alpha.436)
- J2N (>= 2.1.0 && < 3.0.0)
- Microsoft.Extensions.Caching.Memory (>= 6.0.2)
-
net8.0
- ICU4N.Resources (= 60.1.0-alpha.436)
- J2N (>= 2.1.0 && < 3.0.0)
- Microsoft.Extensions.Caching.Memory (>= 6.0.2)
NuGet packages (11)
Showing the top 5 NuGet packages that depend on ICU4N:
Package | Downloads |
---|---|
ICU4N.Transliterator
Transliteration support (phonetic conversion from one script to another) for ICU4N. ICU (International Components for Unicode) is a set of libraries providing Unicode and Globalization support for software applications. ICU4N is a .NET port of ICU4J. |
|
ICU4N.LanguageData
International language compiled resources for ICU4N. ICU (International Components for Unicode) is a set of libraries providing Unicode and Globalization support for software applications. ICU4N is a .NET port of ICU4J. |
|
ICU4N.CurrencyData
International currency compiled resources for ICU4N. ICU (International Components for Unicode) is a set of libraries providing Unicode and Globalization support for software applications. ICU4N is a .NET port of ICU4J. |
|
ICU4N.Collation
Rule-based collation support for ICU4N. ICU (International Components for Unicode) is a set of libraries providing Unicode and Globalization support for software applications. ICU4N is a .NET port of ICU4J. |
|
ICU4N.RegionData
International region compiled resources for ICU4N. ICU (International Components for Unicode) is a set of libraries providing Unicode and Globalization support for software applications. ICU4N is a .NET port of ICU4J. |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on ICU4N:
Repository | Stars |
---|---|
apache/lucenenet
Apache Lucene.NET
|
|
DigitalPlatform/dp2
Integrated Library System / 图书馆集成系统
|
Version | Downloads | Last updated | |
---|---|---|---|
60.1.0-alpha.436 | 2,634 | 10/21/2024 | |
60.1.0-alpha.402 | 106,852 | 4/2/2023 | |
60.1.0-alpha.401 | 186 | 3/4/2023 | |
60.1.0-alpha.400 | 128 | 3/3/2023 | |
60.1.0-alpha.356 | 221,835 | 1/15/2022 | |
60.1.0-alpha.355 | 16,969 | 10/24/2021 | |
60.1.0-alpha.354 | 218,976 | 3/11/2021 | |
60.1.0-alpha.353 | 10,825 | 9/21/2020 | |
60.1.0-alpha.352 | 1,157 | 7/28/2020 | |
60.1.0-alpha.351 | 7,599 | 7/15/2020 | |
60.1.0-alpha.350 | 8,872 | 6/25/2020 | |
60.1.0-alpha.300 | 461 | 6/1/2020 | |
60.1.0-alpha.238 | 31,820 | 4/10/2020 | |
60.1.0-alpha.231 | 419 | 4/5/2020 | |
60.1.0-alpha.225 | 33,329 | 3/13/2020 | |
60.1.0-alpha.203 | 523 | 2/7/2020 | |
60.1.0-alpha.197 | 456 | 1/23/2020 | |
60.1.0-alpha.193 | 5,207 | 12/24/2019 | |
60.1.0-alpha.192 | 499 | 12/13/2019 | |
60.1.0-alpha.187 | 11,700 | 10/18/2019 | |
60.1.0-alpha.53 | 32,609 | 8/9/2019 | |
60.1.0-alpha.52 | 409 | 8/6/2019 | |
60.1.0-alpha.46 | 562 | 7/27/2019 |
https://github.com/NightOwl888/ICU4N/releases/tag/v60.1.0-alpha.436
This is an early prerelease. Not all features are fully functional yet, and there may still be some gaps in functionality that haven't been accounted for. See https://github.com/NightOwl888/ICU4N for more info about what is functioning and what is not.