Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In an application my team developed we handle this by first creating a OverridenResourceManager that inherits the ResourceManager (System.Resources) sample code provided below:</p> <pre><code> /// &lt;summary&gt; /// Resource manager that uses resources found in the exceptions folder before falling back to the built-in resource file. /// &lt;/summary&gt; public class OverridenResourceManager : ResourceManager { #region Constructors and Destructors /// &lt;summary&gt; /// Initializes a new instance of the &lt;see cref="OverridenResourceManager "/&gt;lass. /// &lt;/summary&gt; /// &lt;param name="name"&gt; /// The name of the resource file. /// &lt;/param&gt; /// &lt;param name="culture"&gt; /// The string culture to find resources for. /// &lt;/param&gt; public OverridenResourceManager(string name, Assembly culture) : base(name, culture) { this.Name = name.Replace("AssemblyName.Localization.", string.Empty); } #endregion #region Public Properties /// &lt;summary&gt; /// Gets or sets a function that return a dictionary of overrides for the currentsite /// &lt;/summary&gt; public static Func&lt;Dictionary&lt;string, string&gt;&gt; TextOverridesDictionary { get; set;} /// &lt;summary&gt; /// Gets or sets the name of the resources class to handle. /// &lt;/summary&gt; public string Name { get; set; } #endregion #region Public Methods and Operators /// &lt;summary&gt; /// Gets the resource named &lt;paramref name="name"/&gt; for the given &lt;paramref name="culture"/&gt;. /// Tries to use the value in an exceptions file (through a pre-built dictionary), if any, /// otherwise uses the built-in method. /// &lt;/summary&gt; /// &lt;param name="name"&gt; /// The name of the resource to get. /// &lt;/param&gt; /// &lt;param name="culture"&gt; /// The string culture to get the resource for. /// &lt;/param&gt; /// &lt;returns&gt; /// The &lt;see cref="string"/&gt; containing the value of the resource. /// &lt;/returns&gt; public override string GetString(string name, CultureInfo culture) { if (TextOverridesDictionary != null) { // As we are only giving one file we need to fully qualify the name we are looking for var resourceName = this.Name + '.' + name; // TextOverridesDictionary contains a closure to get the dictionary // from the session's website configuration object var overrides = TextOverridesDictionary(); if (overrides != null &amp;&amp; overrides.ContainsKey(resourceName)) { return overrides[resourceName]; } } return base.GetString(name, culture); } } </code></pre> <p>When the application launches, we then set the </p> <pre><code>TextOverridesDictionary = () =&gt; Session.Site.TextResourceOverrides; </code></pre> <p>Which in short calls a method that grabs the dictionary key/value pair of the resources provided. You would need to implement a method that grabbed the correct key/value from your .config file which is pretty sample. I could provide sample code if needed.</p> <p>With this OverridenResourceManager any resources within the same namespace, for us "AssemblyName.Localization", will be checked for against our dictionary first then the existing resources. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload