title: LoadString works only if I don't have an English string table
body: <p>I want to be able to modify the application's language programatically, or at least use the language specified in Control Panel -&gt; Regional and Language Options -&gt; Formats.</p>
  <p>If I add an english string table, make a french and a german copy of it, and delete the english one, I can programatically switch between loading the french and the german strings.
  If I keep the english copy, the english strings get loaded, no matter what, when I try to load the german or the french ones.</p>
  <p>I think that this is a resource loader bug, and that the resource loader ignores SetThreadLocale, if it finds a string table in the same language as the windows ui language (the language of the windows explorer menus for example).</p>
  <p>I tried to change Control Panel -&gt; Regional and Language Options -&gt; Formats to French, but that has no effect. The resource editor shows the french string table without the language appended, but my program still always loads the english strings. Copying this change to the system account has no effect either.</p>
  <p>Here is the code I tried this with:</p>
  <pre><code>#include &quot;stdafx.h&quot;
  #include &lt;iostream&gt;
  #include &quot;windows.h&quot; // this should go to stdafx.h
  #include &quot;resource.h&quot; // this should not go to stdafx.h
  using namespace std;
  
  int _tmain(int argc, _TCHAR* argv[])
  {
      // 1036 = french, 1031 = german
      SetThreadLocale(MAKELCID(1036, SORT_DEFAULT));
      const int maxSize = 100;
      wchar_t c[maxSize];
      LoadString(GetModuleHandle(NULL), IDS_STRING101, c, maxSize);
      std::cout &lt;&lt; c;
      return 0;
  }
  </code></pre>
  <p><a href="http://msdn.microsoft.com/en-us/goglobal/bb688160.aspx" rel="nofollow noreferrer">Here</a> is a half wrong, incomplete explanation (in the second half of Method 2). The second workaround proposed there, using only country-neutral string tables is useless, because I have separate portuguese-Portugal and portuguese-Brazil string tables.</p>
  <p>The first workaround proposed there does not work. With the code below, I get error 1814.</p>
  <pre><code>HRSRC r = FindResource(
      GetModuleHandle(NULL),
      MAKEINTRESOURCE(IDS_STRING101),
      RT_STRING);
  DWORD e = GetLastError();
  </code></pre>
  <p>So, what should I do ? What's the explanation of this strange &quot;bug&quot; ?</p>
  <p>LATER EDIT:</p>
  <p>After some more tests I found out that:</p>
  <ol>
  <li>GetThreadLocale() returns what is
  set in Control Panel -&gt; Regional and
  Language Options -&gt; Formats.</li>
  <li>The resource loader bug is essentially that if my program has US English resources too, those resources will be loaded, no matter what is set at Formats. If it does not have US English resources, the language set at Formats will be used.</li>
  <li>If I have a French (Neutral) and a German (Neutral) string table, and I set Formats to French (France), the german strings are loaded. If I add an English (Neutral) string table, the english strings are loaded. So, the neutral culture fallback does not work for what is set at Formats.</li>
  <li>If I add a Neutral string table, that one will be used, even if I have another English (Neutral) or an English (United States) string table.</li>
  </ol>