Language Property

Applies to TestComplete 15.0, last modified on October 14, 2021

Description

A file can contain multiple version information blocks translated in different languages. The Language property lets you get the language of a particular version information block.

Declaration

aqFileVersionInfoObj.Language(Index)

Read-Only Property String
aqFileVersionInfoObj An expression, variable or parameter that specifies a reference to an aqFileVersionInfo object
Index [in]    Optional    Integer Default value: 0   

Applies To

The property is applied to the following object:

Parameters

The property has the following parameter:

Index

A zero-based index of the desired version information block. Default is 0. To get the total number of version information translations in the file, use the Languages property.

Property Value

A string that holds the language description. For example, “English (United States)”, “Language Neutral”, and so on. For a full list of language strings, see the Language Identifiers and Locales article in the MSDN library.

Remarks

If you use Python or DelphiScript, you should enclose the parameter of the Language property in square brackets: Language[Index].

Example

The following example posts information about Notepad’s version information translations to the test log:

JavaScript, JScript

function VersionInfoSample()
{
  var FileName = Sys.OSInfo.WindowsDirectory + "\\notepad.exe";
  var VerInfo = aqFileSystem.GetFileInfo(FileName).VersionInfo;

  for (var i = 0; i < VerInfo.Languages; i++)
    Log.Message("Language: " + VerInfo.Language(i) + ", Code page: " + VerInfo.CodePage(i));
  Log.Message("Total number of languages: " + VerInfo.Languages);
}

Python

def VersionInfoSample():
  FileName = Sys.OSInfo.WindowsDirectory + "\\notepad.exe"
  VerInfo = aqFileSystem.GetFileInfo(FileName).VersionInfo
  for i in range(0, VerInfo.Languages):
    Log.Message("Language: " + VerInfo.Language[i] + ", Code page: " + str(VerInfo.CodePage[i]))
  Log.Message("Total number of languages: " + str(VerInfo.Languages))

VBScript

Sub VersionInfoSample
  Dim FileName, VerInfo, i

  FileName = Sys.OSInfo.WindowsDirectory & "\notepad.exe"
  Set VerInfo = aqFileSystem.GetFileInfo(FileName).VersionInfo

  For i = 0 To VerInfo.Languages - 1
    Log.Message "Language: " & VerInfo.Language(i) & ", Code page: " & VerInfo.CodePage(i)
  Next
  Log.Message "Total number of languages: " & VerInfo.Languages
End Sub

DelphiScript

procedure VersionInfoSample;
var FileName, VerInfo, i;
begin
  FileName := Sys.OSInfo.WindowsDirectory + '\notepad.exe';
  VerInfo := aqFileSystem.GetFileInfo(FileName).VersionInfo;

  for i := 0 to VerInfo.Languages - 1 do
    Log.Message('Language: ' + VerInfo.Language[i] + ', Code page: ' + VerToStr(VerInfo.CodePage[i]));
  Log.Message('Total number of languages: ' + VarToStr(VerInfo.Languages));
end;

C++Script, C#Script

function VersionInfoSample()
{
  var FileName = Sys["OSInfo"]["WindowsDirectory"] + "\\notepad.exe";
  var VerInfo = aqFileSystem["GetFileInfo"](FileName)["VersionInfo"];

  for (var i = 0; i < VerInfo["Languages"]; i++)
    Log["Message"]("Language: " + VerInfo["Language"](i) + ", Code page: " + VerInfo["CodePage"](i));
  Log["Message"]("Total number of languages: " + VerInfo["Languages"]);
}

See Also

CodePage Property
Languages Property

Highlight search results