Skip to content

Commit 8349aa1

Browse files
committed
Quick and ugly hack to allow multiple locales.
Fixes d3#750. This isn’t the final implementation, but more of a proof of concept demonstrating how to scope any code that requires localization within a closure that has access to locale-specific variables. In the next pass, I can go through this implementation and more cleanly separate locale-dependent from locale- independent code, and only put locale-dependent code within the closure. Also, we may want to use an options object rather than passing a zillion arguments to d3.locale, because a many-argument method is hard to use and may make it harder to extend the API in the future. This commit also breaks the ability to change the default locale during the build process, but this should be easy to restore.
1 parent 3234f47 commit 8349aa1

24 files changed

+1095
-1082
lines changed

Makefile

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
LOCALE ?= en_US
2-
31
GENERATED_FILES = \
42
d3.js \
53
d3.min.js \
6-
src/format/format-localized.js \
7-
src/time/format-localized.js \
84
bower.json \
95
component.json
106

@@ -15,12 +11,6 @@ all: $(GENERATED_FILES)
1511
test:
1612
@npm test
1713

18-
src/format/format-localized.js: bin/locale src/format/format-locale.js
19-
LC_NUMERIC=$(LOCALE) LC_MONETARY=$(LOCALE) locale -ck LC_NUMERIC LC_MONETARY | bin/locale src/format/format-locale.js > $@
20-
21-
src/time/format-localized.js: bin/locale src/time/format-locale.js
22-
LC_TIME=$(LOCALE) locale -ck LC_TIME | bin/locale src/time/format-locale.js > $@
23-
2414
src/start.js: package.json bin/start
2515
bin/start > $@
2616

0 commit comments

Comments
 (0)