setLocal(LC_ALL,"Dutch") a clash expected?
Posted: Fri Apr 15, 2016 5:51 am
Reading the setLocal() fn manual and in comments section I found this
By the way isnt the locale short code for dutch is nl_BE, nl_NL, nl maybe its the older version where strings were allowed to be passed instead of one of constant values.
So my question is does it mean that each locale has its way of treating numbers for example here if a "Dutch" locale is used and it rounds the fraction value from 1.50 to 1.00 because Dutch locale wants a comma (,) instead of a point (.) before the decimals?be careful with the LC_ALL setting, as it may introduce some unwanted conversions. For example, I used
setlocale (LC_ALL, "Dutch");
to get my weekdays in dutch on the page. From that moment on (as I found out many hours later) my floating point values from MYSQL where interpreted as integers because the Dutch locale wants a comma (,) instead of a point (.) before the decimals. I tried printf, number_format, floatval.... all to no avail. 1.50 was always printed as 1.00
When I set my locale to :
setlocale (LC_TIME, "Dutch");
my weekdays are good now and my floating point values too.
By the way isnt the locale short code for dutch is nl_BE, nl_NL, nl maybe its the older version where strings were allowed to be passed instead of one of constant values.