Language of aqConvert.DateTimeToFormatStr
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Language of aqConvert.DateTimeToFormatStr
Hello,
I have an application that i have to test in English and in French, at different URL-s.
One of the things i have to test is, at the last page, a string which, with words, tells me the date of an appointment, and it is of the form
Friday, December 13, 2019 ─ 08:00 pm
I have the date the form of numbers, i.e. 13 for the day, 12 for the month, and so on.
So i put these numbers in a datetime structure and use aqConvert.DateTimeToFormatStr to convert the datetime to a string with the appropriate format modifiers, and compare the obtained string with the string really displayed on the web page.
When my page is in English, everything is fine!
However, the problem arises when the application is in French. In this case, since my computer has an English language OS, so DateTimeToFormatStr converts the date to a string in an english language, as above. But my application is in French, so it displays the string as:
Vendredi 13 décembre 2019 ─ 20:00 pm
So my question is, is there any way to tell DateTimeToFormatStr to use another locale, not the default one in English?
Or alternatively, is there any way to change via the script the regional settings of my computer temporarily to French, to make the comparison, and to switch them back to English? Of course without stopping the script?
The idea is to compare the result of DateTimeToFormatStr with the string displayed by my application, regardless of the app language.
All suggestions are appreciated!
Solved! Go to Solution.
- Labels:
-
Checkpoints
-
Scripting
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, no problem, thank you for your help, it is much appreciated!
I will try later to create the string myself, without even using the aqConvert.DateTimeToFormatStr() method.
From the numbers, i will generate directly the string by myself in the correct language.
Thank you,
Kroum
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @krosav,
Do you mind sharing the progress on this issue? Did you find the solution?
Tanya Yatskovskaya
SmartBear Community and Education Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @krosav,
In case you still need some help, I've found the Setting the System Language From Scripts article in the TestComplete documentation. It says that rebooting is required after changing the system language. I think this is the key. Try applying the suggestion from this article and let us know how it works for you.
Tanya Yatskovskaya
SmartBear Community and Education Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@krosav :
Hi Kroum,
Another idea that might help is to use dotNET object in TestComplete and something like the code suggested, for example, here:
https://stackoverflow.com/questions/11214057/getting-localized-strings-for-dayofweek-values
or, maybe,
http://www.blackwasp.co.uk/NameOfDay.aspx
(https://www.google.com/search?q=.net+get+localized+day+name)
/Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

- « Previous
-
- 1
- 2
- Next »
- « Previous
-
- 1
- 2
- Next »