localization (number, date, etc) #242
Replies: 2 comments
-
The numeric format is specified by JSON, which is not something that we can alter. Further (and discussed elsewhere), numbers as strings is not something that we currently support. In regard to the rest, for numerous reasons, we're recommending against using and/or expanding Lastly, there are many other issues/discussions that relate to the topic of localization:
|
Beta Was this translation helpful? Give feedback.
-
Thanks so much for the resources, looks like I have some reading to do. Didn't think to look at the historical issues, sorry about the re-post. |
Beta Was this translation helpful? Give feedback.
-
I've been thinking a lot around creating data standards, defined by JSON Schema - data stored in csv, that are used by multiple locales. Creating multiple schema with different patterns and external code to transform values into
en-US
orISO
to be validated against the schema is the current approach, but would be nice if the spec was more inclusive. Just want to start the discussion around what it could look like in the spec, if this is best handled at the implementation layer, and/or what are best practices people are using.Intl.NumberFormat
Currently
type:"number"
accepts1234.56
and if coercion is supported, "1234.56"Numbers can also be written like "1,234.56", "1 234.56", "1.234,56", "1 234,56", depending on the locale. Could there be a new
format
to support validating these number formats based on a locale, passed in as an option or as part of the spec?Ref: ajv-validator/ajv#2099
Intl.DateTimeFormat
Same as Intl.NumberFormat, but for dates. In this case the ISO standard is used, and not
en-US
which I think is the right approach, but should be considered for consistency.locale modifier
Ability to choose a what sub-schema to enforce based on the locale of the data. An example would be
enum
lists in different languages.For context, my locale is
en-CA
.Beta Was this translation helpful? Give feedback.
All reactions