4D view format cells only supports only a few locale

Hi,

I am living in The Netherlands where the date format is DD-MM-YYYY and the decimal separator a comma
I understand that it is possible to format cells with custom formats, but I thought I could just manually set the locale to Dutch / The Netherlands
Oops, it looks like there are only 4 locale i.e. English (US), Japanese, Chinese and Korean
Is this correct?

Gr,
Piotr

Have you tried the SpreadJS function setFormatter()?

https://help.grapecity.com/spread/SpreadJSWeb/cellformat.html

Perhaps not all locales would require a set of dedicated support files. CJK locales are very different from western European (we don’t use the latin alphabet).

Hi Miyako,

I think setFormatter() is a function to set the format, right?
I want a function to set the locale to nl-NL
I could set a format, but I guess when using a date format with “Month name, long” for example I get English / Japanese strings instead of Dutch

Am I missing something?

Well, I can only tell you that View Pro does not support the Japanese locale. In theory, one could do

WA EXECUTE JAVASCRIPT FUNCTION(*;"ViewProArea";"GC.Spread.Common.CultureManager.culture(\"nl-nl\");")

or something like that (I don’t know the exact syntax or function name).

Case of 
	: (Form event code=On VP Ready)
		WA EXECUTE JAVASCRIPT FUNCTION(*;"ViewProArea";"GC.Spread.Common.CultureManager.culture(\"nl-nl\");")
End case

I have tried this, but without success, I think
When I set the format of a column I still have only the 4 locales mentioned earlier (see below) :pensive:

Hi Piotr,

If you don’t want to use the format each time you add a new date with a VP command, you can create a custom culture :

$js:="var myCulture=new GC.Spread.Common.CultureInfo();"
$js:=$js+"myCulture.NumberFormat.currencySymbol='€';"
$js:=$js+"myCulture.NumberFormat.numberDecimalSeparator=',';"
$js:=$js+"myCulture.NumberFormat.numberGroupSeparator='.';"
$js:=$js+"myCulture.NumberFormat.arrayGroupSeparator=';';"
$js:=$js+"myCulture.NumberFormat.arrayListSeparator=' << ';"
$js:=$js+"myCulture.NumberFormat.listSeparator=';';"
$js:=$js+"myCulture.DateTimeFormat.amDesignator='';"
$js:=$js+"myCulture.DateTimeFormat.pmDesignator='';"
$js:=$js+"myCulture.DateTimeFormat.abbreviatedMonthNames=['jan','feb','mrt','apr','mei','jun','jul','aug','sep','okt','nov','dec',''];"
$js:=$js+"myCulture.DateTimeFormat.abbreviatedDayNames=['zo','ma','di','wo','do','vr','za'];"
$js:=$js+"myCulture.DateTimeFormat.abbreviatedMonthGenitiveNames=['jan','feb','mrt','apr','mei','jun','jul','aug','sep','okt','nov','dec',''];"
$js:=$js+"myCulture.DateTimeFormat.dayNames=['zondag','maandag','dinsdag','woensdag','donderdag','vrijdag','zaterdag'];"
$js:=$js+"myCulture.DateTimeFormat.fullDateTimePattern='dddd d MMMM yyyy HH:mm:ss';"
$js:=$js+"myCulture.DateTimeFormat.longDatePattern='dddd, d.MMMM yyyy';"
$js:=$js+"myCulture.DateTimeFormat.longTimePattern='HH:mm:ss';"
$js:=$js+"myCulture.DateTimeFormat.monthDayPattern='dd MMMM';"
$js:=$js+"myCulture.DateTimeFormat.monthNames=['januari','februari','maart','april','mei','juni','juli','augustus','september','oktober','november','december',''];"
$js:=$js+"myCulture.DateTimeFormat.monthGenitiveNames=['januari','februari','maart','april','mei','juni','juli','augustus','september','oktober','november','december',''];"
$js:=$js+"myCulture.DateTimeFormat.shortDatePattern='d-M-yyyy';"
$js:=$js+"myCulture.DateTimeFormat.shortTimePattern='HH:mm';"
$js:=$js+"myCulture.DateTimeFormat.yearMonthPattern='MMMM yyyy';"
  //add one culture
$js:=$js+"GC.Spread.Common.CultureManager.addCultureInfo('nl-NL',myCulture);"
  //switch to 'de-DE' culture
$js:=$js+"GC.Spread.Common.CultureManager.culture('nl-NL');"

WA Evaluate JavaScript(*;"ViewProArea";$js)

Just a little warning that custom culture is not used automatically by formatter in the toolbar.

Hi,

Thanks for the script
I think i have to read more about this culture thing because I don’t understand where to use it
I have put it in the “On VP Ready” event

Just a little warning that custom culture is not used automatically by formatter in the toolbar

I don’t see an extra locale in my format cells, is this what you mean?
How can I use this in my 4D View Pro commands?

Thanks in advance,
Piotr

I don’t see an extra locale in my format cells, is this what you mean?

Yes it is

How can I use this in my 4D View Pro commands?

The command uses by default the custom culture you have defined. If you need a specifical format, use the constants ‘vk pattern’ like ‘vk pattern long date’ (https://doc.4d.com/4Dv18/4D/18/VP-SET-DATE-VALUE.301-4522277.fe.html). They use the format defined in your custom culture.

1 Like