Remark:
I’m afraid the answer won’t help yo much because I don’t know a way to get the Format fucntion of BASIC to apply locale specific format codes in a locale specific way. I post the answer nonetheless to encourage you or somone else to add the missing part. Sorry! The present state of the localization field (formatting and recognition of numbers and “special numbers”) is a mess, imo. One clearly worded related question I found here. The thread did not lead to a usable answer in the end.
Based on the comments by @mikekaganski I reworked the answer below.
The incomplete recharged answer now:
Your code line sText = Format(Now(),"D MMMM YYYY") needs to be replaced by code where the format code depends on the current language. I cannot test with Thai.
_...
currentLoc = getCurrentCharLocale(ThisComponent)
If TypeName(currentLoc)="Empty" Then Exit Sub
REM Otherwise the next statement would throw an error.
Select Case currentLoc.Language REM You may concatenate additional attributes if needed.
Case "en" : fmtC = "D MMMM YYYY"
Case "th" : fmtC = "[$-41E]__Whatever you need__"
REM I cannot test with Thai. Credits to Mike Kaganski.
Case Else : fmtC = "YYYY-MM-DD"
REM We should always use ISO 8601 except in historical texts.
End Select
sText = Format(Now(),fmtC)
..._
To get the needed language information for the decision when selecting the case there is used a function you will also need to add to the respective BASIC module:
Function getCurrentCharLocale(pDoc)
theCtrl = pDoc.CurrentController
theVC = theCtrl.GetViewCursor
theLoc = theVC.CharLocale
REM If the current selection is not unambiguous regarding the Locale then
REM TypeName(theLoc) = "Empty".
REM Otherwise a CharLocale has three attributes: .Language .Country .Variant
REM A cursor with nothing selected ("Caret") should always return
REM non-empty CharLocale except it was actually set empty (no language).
getCurrentCharLocale = theLoc
End Function
Please report everybody about ideas concerning the formatting for different locales not depending on the general UI and locale settings. Comments welcome anyway.