MessageFormat 0.1.3

PHP has it. Java has it. Even JavaScript has it. It's time .NET joined in with support for the ICU Message Format.

How would you format "He found 1 result in 4 categories", or "She found 3 results in 1 category" without bloating your code with a billion if-statements? And when you have to translate it, then what?

How about something like:

var pattern = @"{Gender, select,
 male {He}
 female {She}
 other {They}
} found {ResultCount, plural,
  zero {no results}
  one {one result}
  other {# results}
} in {CategoryCount, plural,
  zero {0 categories}
  one {one category}
  other {# categories}
}.";

var mf = new MessageFormatter();
var result = mf.FormatMessage(pattern, new {
 Gender = "male",
 ResultsCount = 3,
 CategoriesCount = 1
});

Check the README for more information.

There is a newer version of this package available.
See the version list below for details.
Install-Package MessageFormat -Version 0.1.3
dotnet add package MessageFormat --version 0.1.3
<PackageReference Include="MessageFormat" Version="0.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MessageFormat --version 0.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MessageFormat, 0.1.3"
For F# scripts that support #r syntax, copy this into the source code to reference the package.

Dependencies

This package has no dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on MessageFormat:

Package Downloads
BioEngine.Core
Package Description
I18Next.Net.ICU
Package Description
Tp.I18n
Targetprocess internationalization implementation.
Tp.I18n.Core
Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
4.0.0 1,289 12/5/2020
3.0.1 254,021 7/11/2018
3.0.0 606 7/10/2018
2.1.0 36,719 3/19/2018
2.0.1 18,419 6/27/2017
2.0.0 2,449 4/26/2017
1.1.0 6,315 1/12/2017
1.0.2 33,293 10/1/2015
1.0.1 762 9/8/2015
1.0.0 805 8/25/2015
0.1.7 763 8/25/2015
0.1.6 742 8/19/2015
0.1.5 1,178 4/13/2015
0.1.4 803 12/17/2014
0.1.3 754 12/6/2014
0.1.2 719 12/6/2014
0.1.1 796 12/6/2014
0.1.0 731 12/6/2014
Show less