Translate Method (.NET)

 

The Translate method provides a very convenient way for you to easily translate the values returned by certain properties into their meaning. This is especially handy if you wish to display a visitor’s browser settings to them for troubleshooting purposes (or for you to record the information to a log for your own troubleshooting).

 

For example, assume your Plugin_RealPlayer property has a value of 3. What does this value of ’r;3’ indicate? The Translate method would return the string "RealPlayer G2 installed" in this case. Wouldn’t that be more useful to display to your visitor or your tech support team than ’r;3’? That is where the convenience of this function comes into play.

 

As another example, assume the user’s Plugin_Flash property contained a value of -1 to indicate that Flash detection was not available for that user. Was this because their JavaScript was disabled? Or because they were using a browser that did not support Flash detection? The Translate method would tell you by returning an appropriate string (such as "Not detectable with this browser" or "Not detectable with JavaScript disabled").

 

Important note: Remember that the Translate method is designed for convenience solely for display to an end user or your own logging. The return values of the Translate method are subject to change in newer versions of BrowserHawk. Therefore you should not use IF THEN logic to compare the results of the Translate method. For example, do NOT do this:

 if (extBrowObj.Translate("Plugin_Flash") == "Version 5") …

instead do this:

 if (extBrowObj. Plugin_Flash == 5) …

 

 

Syntax:

 extBrowObj.Translate(keyAsString)

 

keyAsString - The key to tell the Translate method which information you would like it to translate for you. This must be equal to one of the names of the properties found in the ExtendedBrowserObj class.

 

Example:

See the example listed in the Plugin_TextSize (.NET) topic. That example shows both the raw return result for the text size property, and what that returned result means (translated). For example, if Plugin_TextSize equals 7, then calling the Translate method for this property will return "Normal" which is what a value of 7 means for this property.