Forum Discussion

roy_van_der_pij's avatar
roy_van_der_pij
New Contributor
11 years ago

How to get French or Dutch date in English environment?

Hi,



I am running a test for a webapplication.

My environment is english (locale)



A date field must be pre-filled with a localized current date in the format

dd Month yyyy



so in English

04 march 2014



in french

04 mars 2014



in Dutch

04 maart 2014



So I like to do something like

- set language to dutch

- curdate = aqDateTime.Today()

- aqConvert.datetimetoformastr(curdate, "%A %#d %B")



The first step is still a mystery. How do I script my testset to be english, french or dutch.?



Regards

  • simon_glet's avatar
    simon_glet
    Regular Contributor
    Hi Roy,



    As a proof of concept you could use project variables (table type maybe ?) to store localized constants (here) and implement a simple function to get the data based on the current language.



    You will find the table data project variables are not easy to edit/maintain so, in our case, we use excel files to store our localized data for 5 languages (here). It required implementing more elaborate functions to get the data but we found it was worth it.



    As we use scripts, I wouldn't know how to do it with Keyword Testing.



    Sincerely


  • I can't believe that there are no 'simple' functions to override my system language setting.



    I tried to play with aqEnvironment.SetLocaleInfo and SetKeyboardLayout but that doesn't seem to do anything.

    The testcomplete helpfiles don't help at all.



    Making some functions with some own translation tables is not something I expected to do with a testtool like testcomplete.
  • simon_glet's avatar
    simon_glet
    Regular Contributor
    Roy,



    Lets be clear about what you are trying to do. You want to change your test machine's local and have TestComplete and the webapplication act accordingly ?



    I am not sure that it is the right approach. As you are testing a web application, you might want to check into the browser's language settings (attached screenshot). It would be much easier to simulate locals that way.



    In any case, that does not change localization is handled by TC. If you use NameMapping, you might want to look into Name Mapping configuration (here).



    Sincerely





  • Hi,



    I think you are trying to move me away from the real problem (I appreciate the help though :-))

    I want ONE script which does

    - set language to french

    - get date in the format Mercredi 5 Mars 2014

    - do mystuff

    - set language to dutch

    - get date in the format Woensdag 5 Maart 2014

    - do mystuff

    - set language to German

    - get date in the format Mittwoch 5 Marz 2014

    - do mystuff



    and NOT

    - set locale to french in windows control panel

    - run script

    - set local to Ducth in windows control panel

    - run script

    and so on....



    For such an expensive product like TestComplete I really expected this to be trivial function.

    We are on version 9 btw.

  • simon_glet's avatar
    simon_glet
    Regular Contributor
    Hi Roy,



    Our TC solution proceeds like your desired scenario but in order to get localized string to compare, input or apply, we had to implement some kind of script localized value selection functionality.



    Yes TC could have it's own localized value solution like what they have with Name Mapping Configurations.



    @Tanya: is a localized value feature planned for TC ?



    Sincerely