Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Remark:
I'm afraid the answer won't help yo much because I don't know a way to get the Format fuction 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.

The incomplete 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.

currentLoc = getCurrentCharLocale(ThisComponent)
If TypeName(currentLoc)="Empty" Then Exit Sub REM Otherwise the next statement woul throw an error.
Select Case currentLoc.Language REM You may concatenate additional attributes if needed.
    Case "en": fmtC = "D MMMM YYYY"
    Case "??" : fmtC = "Whatever you need" REM I cannot test with Thai.
    Case Else: fmtC = "YYYY-MM-DD" REM In fact you should always use ISO 8601.
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 non-empty CharLocale.
getCurrentCharLocale = theLoc
End Function

There is a

Remark:
I'm afraid the answer won't help yo much because I don't know a way to get the Format fuction 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.

The incomplete 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 woul throw an error.
Select Case currentLoc.Language REM You may concatenate additional attributes if needed.
    Case "en": "en" : fmtC = "D MMMM YYYY"
    Case "??" : fmtC = "Whatever you need" REM I cannot test with Thai.
    Case Else: Else : fmtC = "YYYY-MM-DD" REM In fact you should always use ISO 8601.
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 non-empty CharLocale.
getCurrentCharLocale = theLoc
End Function

There is a Pleas report everybody about ideas concerning the formatting for different locales independent on the general UI and locale settings.

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. end.

Based on the comments by @Mike Kaganski I reworked the answer below.

The incomplete 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 woul throw an error.
Select Case currentLoc.Language REM You may concatenate additional attributes if needed.
    Case "en" : fmtC = "D MMMM YYYY"
    Case "??" "th" : fmtC = "Whatever "[$-41E]__Whatever you need" need__" 
                       REM I cannot test with Thai.
Thai. Credits to Mike Kaganski.
    Case Else : fmtC = "YYYY-MM-DD" REM In fact you 
                      REM We should always use ISO 8601.
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.
CharLocale except it was actually set empty (no language).
getCurrentCharLocale = theLoc
End Function

Pleas Please report everybody about ideas concerning the formatting for different locales independent not depending on the general UI and locale settings. Comments welcome anyway.

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 @Mike Kaganski 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 woul 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.

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 @Mike Kaganski 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 woul 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.