Note that there are some explanatory texts on larger screens.

plurals
  1. POResourceManager falls back to default resources instead of reading from satellite assembly
    primarykey
    data
    text
    <p>I've the following folder structure for three projects:</p> <pre class="lang-none prettyprint-override"><code>MyClassLibrary1 Class1.cs Resources\ en-GB\ Strings.en-GB.txt Strings.resx Strings.designer.cs (auto-generated) MyClassLibrary2 (references MyClassLibrary1) Class1.cs MyAppExe (references MyClassLibrary1 and MyClassLibrary2) Program.cs </code></pre> <p>Under MyClassLibrary1 project:</p> <pre class="lang-none prettyprint-override"><code>In Strings.resx, I've string resources defined, let's say: &lt;data name="SchoolString"&gt;&lt;value&gt;Preschool&lt;/value&gt;&lt;/data&gt; In Strings.en-GB.txt, I have: SchoolString=Playgroup </code></pre> <p>MyClassLibrary1's Project properties -> Pre-Build, I've the following:</p> <pre><code>CD $(ProjectDir)Resources FOR /D %%1 IN (*) DO ( CD "%%1" resgen.exe "Strings.%%1.txt" if %errorlevel% 0 al.exe /t:lib /culture:"%%1" /embed:"Strings.%%1.resources" /out:MyClassLibrary1.resources.dll if not exist "$(TargetDir)%%1" md "$(TargetDir)%%1" move /Y "MyClassLibrary1.resources.dll" "$(TargetDir)%%1" CD .. ) </code></pre> <p>Under MyAppExe project, in Program.cs:</p> <pre class="lang-cs prettyprint-override"><code>static void Main() { Strings.Culture = new CultureInfo("en-GB"); Trace.WriteLine(Strings.SchoolString); } </code></pre> <p>The problem is that the ResourceManager, for some reason, keeps on falling back to the default resource file (embedded in MyAppExe). Please help me understand what I am doing wrong here.</p> <p>The output I keep getting no matter what I try is "Preschool" instead of "Playgroup". It's like the satellite assembly is not being resolved at all.</p>
    singulars
    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.
 

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