/
veer
/
Zaya.Primitives
Обзор
Документация
Войти
/
veer
/
Zaya.Primitives
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
docs/api/Zaya.Primitives.LocalizedString.html
332 строки
16 KB
Vladimir Makarov
feat: add localization and plugin settings infrastructure (v0.2.0)
16 июл 2026, 12:49
16 июл 2026, 12:49
839804f
Код
Авторство
О чём код?
<!DOCTYPE html> <!--[if IE]><![endif]--> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Class LocalizedString </title> <meta name="viewport" content="width=device-width"> <meta name="title" content="Class LocalizedString "> <meta name="description" content="Represents a string that can be localized. Supports two modes: Localized via a resolver function (typically a .resx ResourceManager).Invariant — created via and never translated. All source strings live in resource files; no English defaults are embedded in code."> <link rel="shortcut icon" href="../favicon.ico"> <link rel="stylesheet" href="../styles/docfx.vendor.min.css"> <link rel="stylesheet" href="../styles/docfx.css"> <link rel="stylesheet" href="../styles/main.css"> <meta property="docfx:navrel" content="../toc.html"> <meta property="docfx:tocrel" content="toc.html"> </head> <body data-spy="scroll" data-target="#affix" data-offset="120"> <div id="wrapper"> <header> <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="../index.html"> <img id="logo" class="svg" src="../logo.svg" alt=""> </a> </div> <div class="collapse navbar-collapse" id="navbar"> <form class="navbar-form navbar-right" role="search" id="search"> <div class="form-group"> <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off"> </div> </form> </div> </div> </nav> <div class="subnav navbar navbar-default"> <div class="container hide-when-search" id="breadcrumb"> <ul class="breadcrumb"> <li></li> </ul> </div> </div> </header> <div role="main" class="container body-content hide-when-search"> <div class="sidenav hide-when-search"> <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a> <div class="sidetoggle collapse" id="sidetoggle"> <div id="sidetoc"></div> </div> </div> <div class="article row grid-right"> <div class="col-md-10"> <article class="content wrap" id="_content" data-uid="Zaya.Primitives.LocalizedString"> <h1 id="Zaya_Primitives_LocalizedString" data-uid="Zaya.Primitives.LocalizedString" class="text-break">Class LocalizedString</h1> <div class="markdown level0 summary"><p>Represents a string that can be localized. Supports two modes:</p> <ul><li>Localized via a resolver function (typically a .resx <code>ResourceManager</code>).</li><li>Invariant — created via <a class="xref" href="Zaya.Primitives.LocalizedString.html#Zaya_Primitives_LocalizedString_Invariant_System_String_">Invariant(string)</a> and never translated.</li></ul> <p>All source strings live in resource files; no English defaults are embedded in code.</p> </div> <div class="markdown level0 conceptual"></div> <div class="inheritance"> <h5>Inheritance</h5> <div class="level0"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div> <div class="level1"><span class="xref">LocalizedString</span></div> </div> <div class="inheritedMembers"> <h5>Inherited Members</h5> <div> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a> </div> <div> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a> </div> <div> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a> </div> <div> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a> </div> <div> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a> </div> <div> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a> </div> </div> <h6><strong>Namespace</strong>: <a class="xref" href="Zaya.html">Zaya</a>.<a class="xref" href="Zaya.Primitives.html">Primitives</a></h6> <h6><strong>Assembly</strong>: Zaya.Primitives.dll</h6> <h5 id="Zaya_Primitives_LocalizedString_syntax">Syntax</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public sealed class LocalizedString</code></pre> </div> <h3 id="constructors">Constructors </h3> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/shtrasser-dev/Zaya.Primitives/new/main/apiSpec/new?filename=Zaya_Primitives_LocalizedString__ctor_System_String_System_Func_System_Globalization_CultureInfo_System_String__.md&value=---%0Auid%3A%20Zaya.Primitives.LocalizedString.%23ctor(System.String%2CSystem.Func%7BSystem.Globalization.CultureInfo%2CSystem.String%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Edit this page</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/shtrasser-dev/Zaya.Primitives/blob/main/src/Zaya.Primitives/LocalizedString.cs/#L41">View Source</a> </span> <a id="Zaya_Primitives_LocalizedString__ctor_" data-uid="Zaya.Primitives.LocalizedString.#ctor*"></a> <h4 id="Zaya_Primitives_LocalizedString__ctor_System_String_System_Func_System_Globalization_CultureInfo_System_String__" data-uid="Zaya.Primitives.LocalizedString.#ctor(System.String,System.Func{System.Globalization.CultureInfo,System.String})">LocalizedString(string, Func<CultureInfo, string>)</h4> <div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="Zaya.Primitives.LocalizedString.html">LocalizedString</a> class with a resolver.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="declaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public LocalizedString(string key, Func<CultureInfo, string> resolver)</code></pre> </div> <h5 class="parameters">Parameters</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Name</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td> <td><span class="parametername">key</span></td> <td><p>Resource key for lookup (e.g. "Ocr_EngineName"). Used as fallback when the resolver returns null or empty.</p> </td> </tr> <tr> <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a><<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.globalization.cultureinfo">CultureInfo</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a>></td> <td><span class="parametername">resolver</span></td> <td><p>Function that resolves the key to a localized string for a given culture.</p> </td> </tr> </tbody> </table> <h3 id="properties">Properties </h3> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/shtrasser-dev/Zaya.Primitives/new/main/apiSpec/new?filename=Zaya_Primitives_LocalizedString_Key.md&value=---%0Auid%3A%20Zaya.Primitives.LocalizedString.Key%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Edit this page</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/shtrasser-dev/Zaya.Primitives/blob/main/src/Zaya.Primitives/LocalizedString.cs/#L18">View Source</a> </span> <a id="Zaya_Primitives_LocalizedString_Key_" data-uid="Zaya.Primitives.LocalizedString.Key*"></a> <h4 id="Zaya_Primitives_LocalizedString_Key" data-uid="Zaya.Primitives.LocalizedString.Key">Key</h4> <div class="markdown level1 summary"><p>Gets the resource key used for localization. For invariant strings this equals the invariant text itself.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="declaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public string Key { get; }</code></pre> </div> <h5 class="propertyValue">Property Value</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td> <td></td> </tr> </tbody> </table> <h3 id="methods">Methods </h3> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/shtrasser-dev/Zaya.Primitives/new/main/apiSpec/new?filename=Zaya_Primitives_LocalizedString_GetValue_System_Globalization_CultureInfo_.md&value=---%0Auid%3A%20Zaya.Primitives.LocalizedString.GetValue(System.Globalization.CultureInfo)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Edit this page</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/shtrasser-dev/Zaya.Primitives/blob/main/src/Zaya.Primitives/LocalizedString.cs/#L53">View Source</a> </span> <a id="Zaya_Primitives_LocalizedString_GetValue_" data-uid="Zaya.Primitives.LocalizedString.GetValue*"></a> <h4 id="Zaya_Primitives_LocalizedString_GetValue_System_Globalization_CultureInfo_" data-uid="Zaya.Primitives.LocalizedString.GetValue(System.Globalization.CultureInfo)">GetValue(CultureInfo)</h4> <div class="markdown level1 summary"><p>Returns the localized value for the specified culture. Falls back to <a class="xref" href="Zaya.Primitives.LocalizedString.html#Zaya_Primitives_LocalizedString_Key">Key</a> when the resolver returns null or empty.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="declaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public string GetValue(CultureInfo culture)</code></pre> </div> <h5 class="parameters">Parameters</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Name</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.globalization.cultureinfo">CultureInfo</a></td> <td><span class="parametername">culture</span></td> <td><p>The target culture.</p> </td> </tr> </tbody> </table> <h5 class="returns">Returns</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td> <td><p>The localized or invariant string.</p> </td> </tr> </tbody> </table> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/shtrasser-dev/Zaya.Primitives/new/main/apiSpec/new?filename=Zaya_Primitives_LocalizedString_Invariant_System_String_.md&value=---%0Auid%3A%20Zaya.Primitives.LocalizedString.Invariant(System.String)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Edit this page</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/shtrasser-dev/Zaya.Primitives/blob/main/src/Zaya.Primitives/LocalizedString.cs/#L34">View Source</a> </span> <a id="Zaya_Primitives_LocalizedString_Invariant_" data-uid="Zaya.Primitives.LocalizedString.Invariant*"></a> <h4 id="Zaya_Primitives_LocalizedString_Invariant_System_String_" data-uid="Zaya.Primitives.LocalizedString.Invariant(System.String)">Invariant(string)</h4> <div class="markdown level1 summary"><p>Creates an invariant string that is never localized (e.g. log messages, internal IDs).</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="declaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public static LocalizedString Invariant(string text)</code></pre> </div> <h5 class="parameters">Parameters</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Name</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td> <td><span class="parametername">text</span></td> <td><p>The invariant text.</p> </td> </tr> </tbody> </table> <h5 class="returns">Returns</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="Zaya.Primitives.LocalizedString.html">LocalizedString</a></td> <td><p>A <a class="xref" href="Zaya.Primitives.LocalizedString.html">LocalizedString</a> that always returns <code class="paramref">text</code>.</p> </td> </tr> </tbody> </table> </article> </div> <div class="hidden-sm col-md-2" role="complementary"> <div class="sideaffix"> <div class="contribution"> <ul class="nav"> <li> <a href="https://github.com/shtrasser-dev/Zaya.Primitives/new/main/apiSpec/new?filename=Zaya_Primitives_LocalizedString.md&value=---%0Auid%3A%20Zaya.Primitives.LocalizedString%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Edit this page</a> </li> <li> <a href="https://github.com/shtrasser-dev/Zaya.Primitives/blob/main/src/Zaya.Primitives/LocalizedString.cs/#L13" class="contribution-link">View Source</a> </li> </ul> </div> <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix"> <h5>In this article</h5> <div></div> </nav> </div> </div> </div> </div> <footer> <div class="grad-bottom"></div> <div class="footer"> <div class="container"> <span class="pull-right"> <a href="#top">Back to top</a> </span> <span>Generated by <strong>DocFX</strong></span> </div> </div> </footer> </div> <script type="text/javascript" src="../styles/docfx.vendor.min.js"></script> <script type="text/javascript" src="../styles/docfx.js"></script> <script type="text/javascript" src="../styles/main.js"></script> </body> </html>