#15391 closed defect (fixed)
addCustomFormats documentation is incorrect
Reported by: | freddefisk | Owned by: | Adam Peller |
---|---|---|---|
Priority: | undecided | Milestone: | 1.9 |
Component: | Documentation | Version: | 1.7.2 |
Keywords: | Cc: | Rawld Gill | |
Blocked By: | Blocking: |
Description
The live documentation http://livedocs.dojotoolkit.org/dojo/date/locale/addCustomFormats is incorrect:
require(["dojo/date/locale", "dojo/i18n!dojo/cldr/nls/gregorian"], function(locale, gregorian){ var bundle = { timeFormat-custom: "HH:mm:ss.zzzz", dateFormat-custom: "d-MMMM-y" }; locale.addCustomFormats(gregorian, bundle); });
addCustomFormats takes package name and bundle name as arguments. This is what I came up with. It works for me, but I'm not sure it's correct:
require(["dojo/_base/kernel", "dojo/date/locale", "dojo/i18n"], function(kernel, locale, i18n){ var bundle = { timeFormat-custom: "HH:mm:ss.zzzz", dateFormat-custom: "d-MMMM-y" }; i18n.cache("mypackage/nls/gregorian/" + kernel.locale, bundle); locale.addCustomFormats("mypackage", "gregorian"); });
Change History (6)
comment:1 Changed 9 years ago by
Owner: | set to Adam Peller |
---|---|
Status: | new → assigned |
comment:2 Changed 9 years ago by
comment:3 Changed 8 years ago by
I updated the live doc according to my latest comment. If this is the correct usage, this ticket can be closed.
comment:4 Changed 8 years ago by
Cc: | Rawld Gill added |
---|
comment:5 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
freddefisk, thank you for correcting the docs. I believe addCustomFormats has always taken two strings. The bundle could also be loaded using require and the i18n! plugin, but I think i18n.cache should be valid also.
comment:6 Changed 8 years ago by
Milestone: | tbd → 1.9 |
---|
Note: See
TracTickets for help on using
tickets.
Seems like i18n.cache has changed from a function to an object in [28456]. So the new example code should be