Why is only the first translation in the VarFileInfoBlock of the Win32 resource file being used?

Aaron 51 Reputation points
2023-05-01T22:04:43.49+00:00

I have created a resource script file(.rc) for my application in order to fill out the file properties of the app, like the description, file version, etc. To do this I filled out the VERSIONINFO resource in the .rc file. My VERSIONINFO resource includes a StringFileInfo block that contains a block of strings for each language I want. It also includes the VarFileInfo block which specifies a translation pair (of the form language key, charset key) corresponding to each block of strings within the StringFileInfo block.

So, the VERSIONINFO resource of my .rc file looks something like this:

1 VERSIONINFO
 FILEVERSION 0,2,0,0
 PRODUCTVERSION 0,2,0,0
 FILEFLAGSMASK 0x0L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x40000L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
{
    BLOCK "StringFileInfo"
    {
        BLOCK "040904b0"
        {
            VALUE "FileDescription", "English Title"
            VALUE "FileVersion", "0.2.0.0"
        }
        BLOCK "040a04b0"
        {
			VALUE "FileDescription", "Titulo Español"
			VALUE "FileVersion", "0.2.0.0"
		}
	}	
	BLOCK "VarFileInfo"
	{
		VALUE "Translation", 0x409, 1200, 0x40A, 1200
	}
}

Now, the problem is that the first pair listed after VALUE "Translation" is what's always used for the app's file properties. The language that Windows is set to has no effect--I tried changing my Windows language from English to Spanish and then I rebuilt the application, and the properties were still in English. If I then moved the Spanish translation pair--or any other translation like Chinese--to the front, that language was used in the properties.

So how do I get the file properties to show in the language that Windows is set to? If the properties only ever show the first language from the VALUE "Translation", what's the point of being able to have multiple translations in the "StringFileInfo" block and "VarFileInfo" block?

Windows development | Windows API - Win32
Developer technologies | C++
{count} votes

Accepted answer
  1. RLWA32 49,636 Reputation points
    2023-05-03T07:35:19.8833333+00:00

    The way that I was able to get File Explorer's details property page to display resource data based on Windows display language was to use multiple VERSIONINFO resources in my test executable.

    .exe resources

    enter image description here

    VERSIONINFOs in .rc file

    enter image description here

    Windows default language is English

    English

    Windows default language is Spanish

    Spanish

    As far as multiple StringFileInfo blocks are concerned I'll guess that they are used by the tools that create language-specific MUI dlls.

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Xiaopo Yang - MSFT 12,731 Reputation points Microsoft External Staff
    2023-05-02T01:06:26.55+00:00

    Hello,

    Welcome to Microsoft Q&A!

    VERSIONINFO resource is used with an installation program. See About Version Information.

    The preferred topic is Multilingual User Interface. See Adding Multilingual User Interface Support to an Application for an example.

    Thank you.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.