in a UFT script (formerly QTP) I am trying to change the locale to a given value before starting script execution. Our scripts run on virtual machines, which sometimes have different locales defined which results in errors being reported (eg different date formatting). By setting the locale at he start of the script, I want to avoid these errors.
I know how to change the locale in the script, this is pretty straightforward:
If Currentlocale <> 2057 Then
SetLocale "2057"
End If
If I include this code into my UFT script, the locale is changed at runtime into 2057 and remains so until the script has finished. Perfect! We have dozens of scripts though, so I do not want to have to include this piece of code in every single script.
Each script has to login though, the login procedure resides as a single function in a function library which is linked to all these scripts. If I include the simple code into that single login function, what I see is : locale is changed when the login procedure is being executed (so, when you are in the login function), but as soon as the login procedure was executed and the script does the next step, the locale goes back to the original. So, looks like the function library doesn't pass on the new locale to the script as soon as the login function was executed. If you know what I mean ...
Any suggestions how to fix?