Translate date to French

Discussion, questions and support.
Post Reply
jcfastkeys
Posts: 15
Joined: Sep 4th, ’21, 23:26

Post by jcfastkeys » Oct 2nd, ’21, 17:44

As anyone written a script to translate the English date %DATETIME_Today% which gives October 2, 2021 to French when using the French key board?
User avatar
Marko
Posts: 1719
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Oct 2nd, ’21, 20:03

Date and Time macro uses the language as configured in the Windows OS regional settings.

You could use the following script (Type: Command):

Code: Select all

KBLayout := DllCall("user32.dll\GetKeyboardLayout") & 0xFFFF
FormatTime, CurrentDateTime, L%KBLayout%, MMMM d, yyyy
send, % CurrentDateTime
The code first detects the user keyboard layout, sets the date format to this layout and then send the date.
jcfastkeys
Posts: 15
Joined: Sep 4th, ’21, 23:26

Post by jcfastkeys » Oct 2nd, ’21, 23:50

I switch my keyboard to French & run this script and get the English date October 2, 2021

Text Expander Command
KBLayout := DllCall("user32.dll\GetKeyboardLayout") & 0xFFFF
FormatTime, CurrentDateTime, L%KBLayout%, MMMM d, yyyy
send, % CurrentDateTime
User avatar
Marko
Posts: 1719
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Oct 3rd, ’21, 09:05

Ok, this should work without reloading FastKeys

Code: Select all

SetFormat, Integer, H
WinGet, WinID,, A
ThreadID:=DllCall("GetWindowThreadProcessId", "UInt", WinID, "UInt", 0)
KBLayout:=DllCall("GetKeyboardLayout", "UInt", ThreadID, "UInt") & 0xFFFF
FormatTime, CurrentDateTime, L%KBLayout%, MMMM d, yyyy
send, % CurrentDateTime
jcfastkeys
Posts: 15
Joined: Sep 4th, ’21, 23:26

Post by jcfastkeys » Oct 3rd, ’21, 16:14

Thanks Marko. That works!
Post Reply