Heroes.LocaleText
1.0.0-beta.9
dotnet add package Heroes.LocaleText --version 1.0.0-beta.9
NuGet\Install-Package Heroes.LocaleText -Version 1.0.0-beta.9
<PackageReference Include="Heroes.LocaleText" Version="1.0.0-beta.9" />
<PackageVersion Include="Heroes.LocaleText" Version="1.0.0-beta.9" />
<PackageReference Include="Heroes.LocaleText" />
paket add Heroes.LocaleText --version 1.0.0-beta.9
#r "nuget: Heroes.LocaleText, 1.0.0-beta.9"
#:package Heroes.LocaleText@1.0.0-beta.9
#addin nuget:?package=Heroes.LocaleText&version=1.0.0-beta.9&prerelease
#tool nuget:?package=Heroes.LocaleText&version=1.0.0-beta.9&prerelease
Heroes Locale Text
Heroes Locale Text is a .NET library used to parse Heroes of the Storm gamestrings and provide readable friendly verbiage. Gamestrings must already have their data references parsed.
Valid gamestring are from heroes-data.
Usage
Parse a provided gamestring using GameStringText and call one of the properties.
GameStringText gameStringText = new("Spawn a mine that becomes active after a short time. Deals <c val=\"bfd4fd\">153~~0.04~~</c> damage and reveals the enemy for <c val=\"bfd4fd\">4</c> seconds. Lasts <c val=\"bfd4fd\">90</c> seconds.<n/><n/>Stores up to <c val=\"bfd4fd\">3</c> charges.");
string a = gameStringText.RawDescription;
string b = gameStringText.PlainText;
string d = gameStringText.PlainTextWithNewlines;
string c = gameStringText.PlainTextWithScaling;
string e = gameStringText.PlainTextWithScalingWithNewlines;
string f = gameStringText.ColoredText;
string g = gameStringText.ColoredTextWithScaling;
// a: "Spawn a mine that becomes active after a short time. Deals <c val=\"bfd4fd\">153~~0.04~~</c> damage and reveals the enemy for <c val=\"bfd4fd\">4</c> seconds. Lasts <c val=\"bfd4fd\">90</c> seconds.<n/><n/>Stores up to <c val=\"bfd4fd\">3</c> charges."
// b: "Spawn a mine that becomes active after a short time. Deals 153 damage and reveals the enemy for 4 seconds. Lasts 90 seconds. Stores up to 3 charges."
// c: "Spawn a mine that becomes active after a short time. Deals 153 damage and reveals the enemy for 4 seconds. Lasts 90 seconds.<n/><n/>Stores up to 3 charges."
// d: "Spawn a mine that becomes active after a short time. Deals 153 (+4% per level) damage and reveals the enemy for 4 seconds. Lasts 90 seconds. Stores up to 3 charges."
// e: "Spawn a mine that becomes active after a short time. Deals 153 (+4% per level) damage and reveals the enemy for 4 seconds. Lasts 90 seconds.<n/><n/>Stores up to 3 charges."
// f: "Spawn a mine that becomes active after a short time. Deals <c val=\"bfd4fd\">153</c> damage and reveals the enemy for <c val=\"bfd4fd\">4</c> seconds. Lasts <c val=\"bfd4fd\">90</c> seconds.<n/><n/>Stores up to <c val=\"bfd4fd\">3</c> charges."
// g: "Spawn a mine that becomes active after a short time. Deals <c val=\"bfd4fd\">153 (+4% per level)</c> damage and reveals the enemy for <c val=\"bfd4fd\">4</c> seconds. Lasts <c val=\"bfd4fd\">90</c> seconds.<n/><n/>Stores up to <c val=\"bfd4fd\">3</c> charges."
Localization
The localization of the gamestring can also be passed in using StormLocale. By default it is ENUS. The localization is used only for the scaling text (e.g. (+4% per level)). If the scaling text is not needed, then the StormLocale may be left as the default.
GameStringText gameStringText = new("Feuert drei Geschosse auf ein Zielgebiet, die dem ersten getroffenen Gegner jeweils <c val=\"bfd4fd\">147~~0.035~~</c> Schaden zuf�gen. Die Geschosse f�gen Geb�uden <c val=\"bfd4fd\">50%</c> des Schadens zu.", StormLocale.DEDE);
string result = gameStringText.PlainTextWithScaling;
// result: "Feuert drei Geschosse auf ein Zielgebiet, die dem ersten getroffenen Gegner jeweils 147 (+3,5% pro Stufe) Schaden zuf�gen. Die Geschosse f�gen Geb�uden 50% des Schadens zu."
Font Styles
To get all the values of the constant tags <c val=""/> and style tags <s val=""/>, pass in true to the extractFontValues parameter.
GameStringText gameStringText = new("Every <c val=\"#TooltipNumbers\">18</c> seconds, deals <c val=\"#TooltipNumbers\">125~~0.045~~</c><n/> extra damage every <s val=\"StandardTooltipHeader\">2.75</s> seconds.", extractFontValues: true);
if (gameStringText.IsFontValuesExtracted)
{
IEnumerable<string>? constantValues = gameStringText.FontStyleConstantValues;
IEnumerable<string>? styleValues = gameStringText.FontStyleValues;
// constantValues: { "#TooltipNumbers" }
// styleValues: { "StandardTooltipHeader" }
}
To replace the values of the constant tags and style tags, use the AddFontValueReplacements methods. Specify the key, the val that should be replaced, and the value which is the new value.
// note: extractFontValues does not need to be set
GameStringText gameStringText = new("Every <c val=\"#TooltipNumbers\">18</c> seconds, deals <c val=\"#TooltipNumbers\">125~~0.045~~</c><n/> extra damage every <s val=\"StandardTooltipHeader\">2.75</s> seconds.");
Dictionary<string, string> constantKeyValuePairs = [];
constantKeyValuePairs.Add("#TooltipNumbers", "123456");
gameStringText.AddFontValueReplacements(FontTagType.Constant, false, constantKeyValuePairs);
Dictionary<string, string> styleKeyValuePairs = [];
styleKeyValuePairs.Add("StandardTooltipHeader", "789012");
gameStringText.AddFontValueReplacements(FontTagType.Style, false, styleKeyValuePairs);
string result = gameStringText.ColoredText;
// result: "Every <c val="123456">18</c> seconds, deals <c val="123456">125</c><n/> extra damage every <s val="789012">2.75</s> seconds."
To keep the original value of the constant tags or style tags while replacing the value, set the preserveValues parameter to true. This will create a new attribute hlt-name with the original value.
GameStringText gameStringText = new("<s val=\"StandardTooltipHeader\">Archon </s><n/><s val=\"StandardTooltipDetails2\">Cooldown: </s>");
Dictionary<string, string> keyValuePairs = [];
keyValuePairs.Add("StandardTooltipHeader", "123456");
keyValuePairs.Add("StandardTooltipDetails2", "222222");
gameStringText.AddFontValueReplacements(FontTagType.Style, true, keyValuePairs);
string result = gameStringText.ColoredText;
// result: "<s val=\"123456\" hlt-name=\"StandardTooltipHeader\">Archon </s><n/><s val=\"222222\" hlt-name=\"StandardTooltipDetails2\">Cooldown: </s>"
Developing
To build and compile the code, it is recommended to use the latest version of Visual Studio 2022 or Visual Studio Code.
Another option is to use the dotnet CLI tools from the latest .NET SDK.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Heroes.LocaleText:
| Package | Downloads |
|---|---|
|
Heroes.XmlData
Library to directly parse the Heroes of the Storm game data. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-beta.9 | 379 | 9/3/2025 |
| 1.0.0-beta.8 | 136 | 9/2/2025 |
| 1.0.0-beta.7 | 191 | 6/16/2025 |
| 1.0.0-beta.6 | 92 | 6/7/2025 |
| 1.0.0-beta.5 | 224 | 5/26/2025 |
| 1.0.0-beta.4 | 102 | 5/24/2025 |
| 1.0.0-beta.3 | 579 | 11/21/2024 |
| 1.0.0-beta.2 | 519 | 6/17/2024 |
| 1.0.0-beta.1 | 121 | 2/29/2024 |