Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between "Neutral", "Neutral(Default)", and "Neutral(Sys. Default)"?

I want to distribute an application to many different countries, so I have to embed multilingual strings into its resource.

Visual Studio provides a list of mainstream languages in the world like Japanese, English, Chinese, etc. However, besides those, there are also other three options:

  1. "Neutral";

  2. "Neutral(Default)";

  3. "Neutral(Sys. Default)".

What are the differences between them?

like image 543
xmllmx Avatar asked Sep 02 '26 00:09

xmllmx


1 Answers

Assuming you are talking about native resources here (managed resource is another beast)

  • neutral=LANG_NEUTRAL|SUBLANG_NEUTRAL. FindResourceEx fallback to thread local. see GetThreadLocale
  • neutral (default)=LANG_NEUTRAL|SUBLANG_DEFAULT fallback to user's default language. see GetUserDefaultLCID
  • neutral (sys. default)=LANG_NEUTRAL|SUBLANG_SYS_DEFAULT. see GetSystemDefaultUILanguage

Those language ids can be useful at different times if the user is running an English version of Windows with MUI pack, has a default language of Simplified Chinese, then open a file that expects a Japanese thread local via istream.

There are many cases when resource loader does not have a preferred language (e.g. CString::LoadString/LoadStringW). The caller specifies one of the neutral flags and hope FindResourceEx would find something close enough. If there's an exact match (even for the neutral language) in the resource file then the resource is returned (uh, I guess LoadStringW is a bad example for the neutral language, LoadIcon is probably better), if an exact match is not found and a language is not specified then a complex fallback process is started. Here's the XP edition and here's the Vista edition.

Sometimes it pays to be neutral, if your resources are globally reviewed to be not offensive and not too similar to something belonged to one of the local entities around the world (especially a local party flag, see the swastika symbol used by Nazi), you can share the resources across all languages and save some space. But sticking to neutral resource becomes harder once the team switches to a localized satellite dll as the default resource source (see AfxSetResourceHandle). Oh, and global review is expensive.

reference: Format for LANGUAGE Statement in .RES Files

like image 52
Sheng Jiang 蒋晟 Avatar answered Sep 03 '26 15:09

Sheng Jiang 蒋晟



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!