From eaf5c65cfae0a6636555884c18e6c955fae7887e Mon Sep 17 00:00:00 2001 From: Marak Date: Tue, 7 Jul 2015 16:22:50 -0700 Subject: [PATCH] [refactor] [dist] Allow for node to require individual locales ( to avoid the default behavior of requiring all locale data. #125 #167 --- build/gulpfile.js | 20 ++++++++- examples/singleLocale.js | 7 ++++ index.js | 87 ++------------------------------------ lib/address.js | 2 +- lib/commerce.js | 6 ++- lib/company.js | 2 +- lib/date.js | 2 +- lib/fake.js | 2 +- lib/finance.js | 2 +- lib/hacker.js | 2 +- lib/helpers.js | 2 +- lib/image.js | 2 +- lib/index.js | 90 ++++++++++++++++++++++++++++++++++++++++ lib/internet.js | 2 +- lib/locales.js | 2 +- lib/lorem.js | 2 +- lib/name.js | 2 +- lib/phone_number.js | 2 +- lib/random.js | 2 +- locale/de.js | 4 ++ locale/de_AT.js | 4 ++ locale/de_CH.js | 4 ++ locale/en.js | 4 ++ locale/en_AU.js | 4 ++ locale/en_BORK.js | 4 ++ locale/en_CA.js | 4 ++ locale/en_GB.js | 4 ++ locale/en_IND.js | 4 ++ locale/en_US.js | 4 ++ locale/en_au_ocker.js | 4 ++ locale/es.js | 4 ++ locale/fa.js | 4 ++ locale/fr.js | 4 ++ locale/fr_CA.js | 4 ++ locale/ge.js | 4 ++ locale/it.js | 4 ++ locale/ja.js | 4 ++ locale/ko.js | 4 ++ locale/nb_NO.js | 4 ++ locale/nep.js | 4 ++ locale/nl.js | 4 ++ locale/pl.js | 4 ++ locale/pt_BR.js | 4 ++ locale/ru.js | 4 ++ locale/sk.js | 4 ++ locale/sv.js | 4 ++ locale/tr.js | 4 ++ locale/uk.js | 4 ++ locale/vi.js | 4 ++ locale/zh_CN.js | 4 ++ locale/zh_TW.js | 4 ++ test/all.functional.js | 4 +- 52 files changed, 266 insertions(+), 104 deletions(-) create mode 100644 examples/singleLocale.js create mode 100644 lib/index.js create mode 100644 locale/de.js create mode 100644 locale/de_AT.js create mode 100644 locale/de_CH.js create mode 100644 locale/en.js create mode 100644 locale/en_AU.js create mode 100644 locale/en_BORK.js create mode 100644 locale/en_CA.js create mode 100644 locale/en_GB.js create mode 100644 locale/en_IND.js create mode 100644 locale/en_US.js create mode 100644 locale/en_au_ocker.js create mode 100644 locale/es.js create mode 100644 locale/fa.js create mode 100644 locale/fr.js create mode 100644 locale/fr_CA.js create mode 100644 locale/ge.js create mode 100644 locale/it.js create mode 100644 locale/ja.js create mode 100644 locale/ko.js create mode 100644 locale/nb_NO.js create mode 100644 locale/nep.js create mode 100644 locale/nl.js create mode 100644 locale/pl.js create mode 100644 locale/pt_BR.js create mode 100644 locale/ru.js create mode 100644 locale/sk.js create mode 100644 locale/sv.js create mode 100644 locale/tr.js create mode 100644 locale/uk.js create mode 100644 locale/vi.js create mode 100644 locale/zh_CN.js create mode 100644 locale/zh_TW.js diff --git a/build/gulpfile.js b/build/gulpfile.js index 3b5c5eb70..1990537b3 100644 --- a/build/gulpfile.js +++ b/build/gulpfile.js @@ -19,7 +19,8 @@ var rename = require('gulp-rename'); var mustache = require('gulp-mustache'); var browserify = require('browserify'); var transform = require('vinyl-transform'); - +var path = require('path'); +var fs = require('fs'); gulp.task('browser-package', function() { @@ -88,4 +89,19 @@ gulp.task('documentation', function(cb) { }); -gulp.task('default', ['browser-package', 'documentation']); \ No newline at end of file +gulp.task('nodeLocalRequires', function (cb){ + var locales = require('../lib/locales'); + for (var locale in locales) { + var localeFile = path.normalize(__dirname + "/../locale/" + locale + ".js"); + var localeRequire = ''; + localeRequire += "var faker = require('../lib');\n"; + localeRequire += 'faker.locale = "' + locale + '";\n'; + localeRequire += "faker.locales['" + locale + "'] = require('../lib/locales/" + locale + "');\n"; + localeRequire += "module['exports'] = faker;\n"; + console.log(localeRequire); + fs.writeFileSync(localeFile, localeRequire); + } + cb(); +}); + +gulp.task('default', ['nodeLocalRequires', 'browser-package', 'documentation']); diff --git a/examples/singleLocale.js b/examples/singleLocale.js new file mode 100644 index 000000000..e5b504f32 --- /dev/null +++ b/examples/singleLocale.js @@ -0,0 +1,7 @@ +var faker = require('../locale/en'); + +console.log(faker.name.findName()); + +var faker = require('../locale/uk'); + +console.log(faker.name.findName()); \ No newline at end of file diff --git a/index.js b/index.js index 5f784b44e..852bed46a 100644 --- a/index.js +++ b/index.js @@ -1,85 +1,4 @@ -/* +module['exports'] = require('./lib'); - this index.js file is used for including the faker library as a CommonJS module, instead of a bundle - - you can include the faker library into your existing node.js application by requiring the entire /faker directory - - var faker = require(./faker); - var randomName = faker.name.findName(); - - you can also simply include the "faker.js" file which is the auto-generated bundled version of the faker library - - var faker = require(./customAppPath/faker); - var randomName = faker.name.findName(); - - - if you plan on modifying the faker library you should be performing your changes in the /lib/ directory - -*/ -exports.random = require('./lib/random'); -exports.fake = require('./lib/fake'); - -exports.name = require('./lib/name'); -exports.address = require('./lib/address'); -exports.phone = require('./lib/phone_number'); -exports.internet = require('./lib/internet'); -exports.company = require('./lib/company'); -exports.image = require('./lib/image'); -exports.lorem = require('./lib/lorem'); -exports.helpers = require('./lib/helpers'); -exports.date = require('./lib/date'); -exports.finance = require('./lib/finance'); -exports.hacker = require('./lib/hacker'); -exports.commerce = require('./lib/commerce'); - -var locales = exports.locales = require('./lib/locales'); - -// default locale -exports.locale = "en"; - -// in case a locale is missing a definition, fallback to this locale -exports.localeFallback = "en"; - -exports.definitions = {}; - - -var _definitions = { - "name": ["first_name", "last_name", "prefix", "suffix", "title", "male_first_name", "female_first_name", "male_middle_name", "female_middle_name", "male_last_name", "female_last_name"], - "address": ["city_prefix", "city_suffix", "street_suffix", "county", "country", "country_code", "state", "state_abbr", "street_prefix", "zipFormat"], - "company": ["adjective", "noun", "descriptor", "bs_adjective", "bs_noun", "bs_verb", "suffix"], - "lorem": ["words"], - "hacker": ["abbreviation", "adjective", "noun", "verb", "ingverb"], - "phone_number": ["formats"], - "finance": ["account_type", "transaction_type", "currency"], - "internet": ["avatar_uri", "domain_suffix", "free_email", "password"], - "commerce": ["color", "department", "product_name", "price", "categories"], - "title": "", - "separator": "" -}; - -// Create a Getter for all definitions.foo.bar propetries -Object.keys(_definitions).forEach(function(d){ - if (typeof exports.definitions[d] === "undefined") { - exports.definitions[d] = {}; - } - - if (typeof _definitions[d] === "string") { - exports.definitions[d] = locales[exports.locale][d]; - return; - } - - _definitions[d].forEach(function(p){ - Object.defineProperty(exports.definitions[d], p, { - get: function () { - if (typeof locales[exports.locale][d] === "undefined" || typeof locales[exports.locale][d][p] === "undefined") { - // certain localization sets contain less data then others. - // in the case of a missing defintion, use the default localeFallback to substitute the missing set data - return locales[exports.localeFallback][d][p]; - } else { - // return localized data - return locales[exports.locale][d][p]; - } - } - }); - }); -}); +// since we are requiring the top level of faker, load all locales by default +module['exports'].locales = require('./lib/locales'); diff --git a/lib/address.js b/lib/address.js index db4fd791c..9821264a3 100644 --- a/lib/address.js +++ b/lib/address.js @@ -1,5 +1,5 @@ var Helpers = require('./helpers'); -var faker = require('../index'), +var faker = require('./index'), f = faker.fake; var address = { diff --git a/lib/commerce.js b/lib/commerce.js index 76ec4beb5..8cdcf7d50 100644 --- a/lib/commerce.js +++ b/lib/commerce.js @@ -1,4 +1,4 @@ -var faker = require('../index'); +var faker = require('./index'); var commerce = { @@ -56,7 +56,9 @@ var commerce = { }, mergeCategories: function(categories) { - var separator = faker.definitions.separator; + var separator = faker.definitions.separator || " &"; + // TODO: find undefined here + categories = categories || faker.definitions.commerce.categories; var commaSeparated = categories.slice(0, -1).join(', '); return [commaSeparated, categories[categories.length - 1]].join(separator); diff --git a/lib/company.js b/lib/company.js index c103f37ad..9bcd7881f 100644 --- a/lib/company.js +++ b/lib/company.js @@ -1,4 +1,4 @@ -var faker = require('../index'), +var faker = require('./index'), f = faker.fake; var company = { diff --git a/lib/date.js b/lib/date.js index afe9fdc9d..d3a58eb46 100644 --- a/lib/date.js +++ b/lib/date.js @@ -1,4 +1,4 @@ -var faker = require("../index"); +var faker = require("./index"); var date = { diff --git a/lib/fake.js b/lib/fake.js index bad2ba9be..327e3de95 100644 --- a/lib/fake.js +++ b/lib/fake.js @@ -3,7 +3,7 @@ */ -var faker = require('../'); +var faker = require('./'); module['exports'] = function fake (str) { diff --git a/lib/finance.js b/lib/finance.js index 3de960949..657035623 100644 --- a/lib/finance.js +++ b/lib/finance.js @@ -1,5 +1,5 @@ var Helpers = require('./helpers'), - faker = require('../index'); + faker = require('./index'); var finance = { diff --git a/lib/hacker.js b/lib/hacker.js index ca6bfb2d2..e67eba8ec 100644 --- a/lib/hacker.js +++ b/lib/hacker.js @@ -1,4 +1,4 @@ -var faker = require('../index'); +var faker = require('./index'); var hacker = { diff --git a/lib/helpers.js b/lib/helpers.js index 3d71bd4a1..82d366035 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -1,4 +1,4 @@ -var faker = require('../index'); +var faker = require('./index'); // backword-compatibility exports.randomNumber = function (range) { diff --git a/lib/image.js b/lib/image.js index aa9831395..3f87ab7d3 100644 --- a/lib/image.js +++ b/lib/image.js @@ -1,4 +1,4 @@ -var faker = require('../index'); +var faker = require('./index'); var image = { image: function () { diff --git a/lib/index.js b/lib/index.js new file mode 100644 index 000000000..5d7e8b5d6 --- /dev/null +++ b/lib/index.js @@ -0,0 +1,90 @@ +/* + + this index.js file is used for including the faker library as a CommonJS module, instead of a bundle + + you can include the faker library into your existing node.js application by requiring the entire /faker directory + + var faker = require(./faker); + var randomName = faker.name.findName(); + + you can also simply include the "faker.js" file which is the auto-generated bundled version of the faker library + + var faker = require(./customAppPath/faker); + var randomName = faker.name.findName(); + + + if you plan on modifying the faker library you should be performing your changes in the /lib/ directory + +*/ +exports.random = require('./random'); +exports.fake = require('./fake'); + +exports.name = require('./name'); +exports.address = require('./address'); +exports.phone = require('./phone_number'); +exports.internet = require('./internet'); +exports.company = require('./company'); +exports.image = require('./image'); +exports.lorem = require('./lorem'); +exports.helpers = require('./helpers'); +exports.date = require('./date'); +exports.finance = require('./finance'); +exports.hacker = require('./hacker'); +//exports.commerce = require('./commerce'); + +// don't load all locales by default +var locales = {}; +exports.locales = locales; +locales = require('./locales'); + +// default locale +exports.locale = "en"; + +// in case a locale is missing a definition, fallback to this locale +exports.localeFallback = "en"; + +exports.definitions = {}; + + +var _definitions = { + "name": ["first_name", "last_name", "prefix", "suffix", "title", "male_first_name", "female_first_name", "male_middle_name", "female_middle_name", "male_last_name", "female_last_name"], + "address": ["city_prefix", "city_suffix", "street_suffix", "county", "country", "country_code", "state", "state_abbr", "street_prefix", "zipFormat"], + "company": ["adjective", "noun", "descriptor", "bs_adjective", "bs_noun", "bs_verb", "suffix"], + "lorem": ["words"], + "hacker": ["abbreviation", "adjective", "noun", "verb", "ingverb"], + "phone_number": ["formats"], + "finance": ["account_type", "transaction_type", "currency"], + "internet": ["avatar_uri", "domain_suffix", "free_email", "password"], + "commerce": ["color", "department", "product_name", "price", "categories"], + "title": "", + "separator": "" +}; + +// Create a Getter for all definitions.foo.bar propetries +Object.keys(_definitions).forEach(function(d){ + if (typeof exports.definitions[d] === "undefined") { + exports.definitions[d] = {}; + } + + if (typeof _definitions[d] === "string") { + exports.definitions[d] = _definitions[d]; + + + return; + } + + _definitions[d].forEach(function(p){ + Object.defineProperty(exports.definitions[d], p, { + get: function () { + if (typeof locales[exports.locale][d] === "undefined" || typeof locales[exports.locale][d][p] === "undefined") { + // certain localization sets contain less data then others. + // in the case of a missing defintion, use the default localeFallback to substitute the missing set data + return locales[exports.localeFallback][d][p]; + } else { + // return localized data + return locales[exports.locale][d][p]; + } + } + }); + }); +}); diff --git a/lib/internet.js b/lib/internet.js index 4dac804d8..513daf4a2 100644 --- a/lib/internet.js +++ b/lib/internet.js @@ -1,4 +1,4 @@ -var faker = require('../index'), +var faker = require('./index'), password_generator = require('../vendor/password-generator.js'), random_ua = require('../vendor/user-agent'); diff --git a/lib/locales.js b/lib/locales.js index 3c155c5cc..2b0923729 100644 --- a/lib/locales.js +++ b/lib/locales.js @@ -1,4 +1,4 @@ -var faker = require('../index'); +var faker = require('./index'); exports['de'] = require('./locales/de'); exports['de_AT'] = require('./locales/de_AT'); exports['de_CH'] = require('./locales/de_CH'); diff --git a/lib/lorem.js b/lib/lorem.js index eb4d72d58..54a28998e 100644 --- a/lib/lorem.js +++ b/lib/lorem.js @@ -1,4 +1,4 @@ -var faker = require('../index'); +var faker = require('./index'); var Helpers = require('./helpers'); var lorem = { diff --git a/lib/name.js b/lib/name.js index a883216f1..5d3864f6f 100644 --- a/lib/name.js +++ b/lib/name.js @@ -1,4 +1,4 @@ -var faker = require('../index'); +var faker = require('./index'); var _name = { diff --git a/lib/phone_number.js b/lib/phone_number.js index 500ade249..2b6bb1420 100644 --- a/lib/phone_number.js +++ b/lib/phone_number.js @@ -1,4 +1,4 @@ -var faker = require('../index'); +var faker = require('./index'); var phone = { phoneNumber: function (format) { diff --git a/lib/random.js b/lib/random.js index cd60635ac..41a06f282 100644 --- a/lib/random.js +++ b/lib/random.js @@ -1,5 +1,5 @@ var mersenne = require('../vendor/mersenne'); -var faker = require('../index'); +var faker = require('./index'); var random = { // returns a single random number based on a max number or range diff --git a/locale/de.js b/locale/de.js new file mode 100644 index 000000000..e851119af --- /dev/null +++ b/locale/de.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "de"; +faker.locales['de'] = require('../lib/locales/de'); +module['exports'] = faker; diff --git a/locale/de_AT.js b/locale/de_AT.js new file mode 100644 index 000000000..0a7a4529f --- /dev/null +++ b/locale/de_AT.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "de_AT"; +faker.locales['de_AT'] = require('../lib/locales/de_AT'); +module['exports'] = faker; diff --git a/locale/de_CH.js b/locale/de_CH.js new file mode 100644 index 000000000..20b5f3d94 --- /dev/null +++ b/locale/de_CH.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "de_CH"; +faker.locales['de_CH'] = require('../lib/locales/de_CH'); +module['exports'] = faker; diff --git a/locale/en.js b/locale/en.js new file mode 100644 index 000000000..5b4fac047 --- /dev/null +++ b/locale/en.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "en"; +faker.locales['en'] = require('../lib/locales/en'); +module['exports'] = faker; diff --git a/locale/en_AU.js b/locale/en_AU.js new file mode 100644 index 000000000..d38c9125e --- /dev/null +++ b/locale/en_AU.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "en_AU"; +faker.locales['en_AU'] = require('../lib/locales/en_AU'); +module['exports'] = faker; diff --git a/locale/en_BORK.js b/locale/en_BORK.js new file mode 100644 index 000000000..e3f468258 --- /dev/null +++ b/locale/en_BORK.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "en_BORK"; +faker.locales['en_BORK'] = require('../lib/locales/en_BORK'); +module['exports'] = faker; diff --git a/locale/en_CA.js b/locale/en_CA.js new file mode 100644 index 000000000..92d60ccc4 --- /dev/null +++ b/locale/en_CA.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "en_CA"; +faker.locales['en_CA'] = require('../lib/locales/en_CA'); +module['exports'] = faker; diff --git a/locale/en_GB.js b/locale/en_GB.js new file mode 100644 index 000000000..1aca74e5a --- /dev/null +++ b/locale/en_GB.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "en_GB"; +faker.locales['en_GB'] = require('../lib/locales/en_GB'); +module['exports'] = faker; diff --git a/locale/en_IND.js b/locale/en_IND.js new file mode 100644 index 000000000..7aea16595 --- /dev/null +++ b/locale/en_IND.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "en_IND"; +faker.locales['en_IND'] = require('../lib/locales/en_IND'); +module['exports'] = faker; diff --git a/locale/en_US.js b/locale/en_US.js new file mode 100644 index 000000000..e7176c527 --- /dev/null +++ b/locale/en_US.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "en_US"; +faker.locales['en_US'] = require('../lib/locales/en_US'); +module['exports'] = faker; diff --git a/locale/en_au_ocker.js b/locale/en_au_ocker.js new file mode 100644 index 000000000..32d5cfa85 --- /dev/null +++ b/locale/en_au_ocker.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "en_au_ocker"; +faker.locales['en_au_ocker'] = require('../lib/locales/en_au_ocker'); +module['exports'] = faker; diff --git a/locale/es.js b/locale/es.js new file mode 100644 index 000000000..05dc8eac8 --- /dev/null +++ b/locale/es.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "es"; +faker.locales['es'] = require('../lib/locales/es'); +module['exports'] = faker; diff --git a/locale/fa.js b/locale/fa.js new file mode 100644 index 000000000..4030381ea --- /dev/null +++ b/locale/fa.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "fa"; +faker.locales['fa'] = require('../lib/locales/fa'); +module['exports'] = faker; diff --git a/locale/fr.js b/locale/fr.js new file mode 100644 index 000000000..2612d57ee --- /dev/null +++ b/locale/fr.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "fr"; +faker.locales['fr'] = require('../lib/locales/fr'); +module['exports'] = faker; diff --git a/locale/fr_CA.js b/locale/fr_CA.js new file mode 100644 index 000000000..f1cf04465 --- /dev/null +++ b/locale/fr_CA.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "fr_CA"; +faker.locales['fr_CA'] = require('../lib/locales/fr_CA'); +module['exports'] = faker; diff --git a/locale/ge.js b/locale/ge.js new file mode 100644 index 000000000..ec435b059 --- /dev/null +++ b/locale/ge.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "ge"; +faker.locales['ge'] = require('../lib/locales/ge'); +module['exports'] = faker; diff --git a/locale/it.js b/locale/it.js new file mode 100644 index 000000000..38fbd63f8 --- /dev/null +++ b/locale/it.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "it"; +faker.locales['it'] = require('../lib/locales/it'); +module['exports'] = faker; diff --git a/locale/ja.js b/locale/ja.js new file mode 100644 index 000000000..72ac4a57b --- /dev/null +++ b/locale/ja.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "ja"; +faker.locales['ja'] = require('../lib/locales/ja'); +module['exports'] = faker; diff --git a/locale/ko.js b/locale/ko.js new file mode 100644 index 000000000..b1da382cc --- /dev/null +++ b/locale/ko.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "ko"; +faker.locales['ko'] = require('../lib/locales/ko'); +module['exports'] = faker; diff --git a/locale/nb_NO.js b/locale/nb_NO.js new file mode 100644 index 000000000..28e630091 --- /dev/null +++ b/locale/nb_NO.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "nb_NO"; +faker.locales['nb_NO'] = require('../lib/locales/nb_NO'); +module['exports'] = faker; diff --git a/locale/nep.js b/locale/nep.js new file mode 100644 index 000000000..5f0353abc --- /dev/null +++ b/locale/nep.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "nep"; +faker.locales['nep'] = require('../lib/locales/nep'); +module['exports'] = faker; diff --git a/locale/nl.js b/locale/nl.js new file mode 100644 index 000000000..e9fe55d18 --- /dev/null +++ b/locale/nl.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "nl"; +faker.locales['nl'] = require('../lib/locales/nl'); +module['exports'] = faker; diff --git a/locale/pl.js b/locale/pl.js new file mode 100644 index 000000000..52e7c315b --- /dev/null +++ b/locale/pl.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "pl"; +faker.locales['pl'] = require('../lib/locales/pl'); +module['exports'] = faker; diff --git a/locale/pt_BR.js b/locale/pt_BR.js new file mode 100644 index 000000000..45fab9e7a --- /dev/null +++ b/locale/pt_BR.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "pt_BR"; +faker.locales['pt_BR'] = require('../lib/locales/pt_BR'); +module['exports'] = faker; diff --git a/locale/ru.js b/locale/ru.js new file mode 100644 index 000000000..17481f532 --- /dev/null +++ b/locale/ru.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "ru"; +faker.locales['ru'] = require('../lib/locales/ru'); +module['exports'] = faker; diff --git a/locale/sk.js b/locale/sk.js new file mode 100644 index 000000000..aada039a5 --- /dev/null +++ b/locale/sk.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "sk"; +faker.locales['sk'] = require('../lib/locales/sk'); +module['exports'] = faker; diff --git a/locale/sv.js b/locale/sv.js new file mode 100644 index 000000000..2677674ed --- /dev/null +++ b/locale/sv.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "sv"; +faker.locales['sv'] = require('../lib/locales/sv'); +module['exports'] = faker; diff --git a/locale/tr.js b/locale/tr.js new file mode 100644 index 000000000..8eaabce66 --- /dev/null +++ b/locale/tr.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "tr"; +faker.locales['tr'] = require('../lib/locales/tr'); +module['exports'] = faker; diff --git a/locale/uk.js b/locale/uk.js new file mode 100644 index 000000000..40b749b75 --- /dev/null +++ b/locale/uk.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "uk"; +faker.locales['uk'] = require('../lib/locales/uk'); +module['exports'] = faker; diff --git a/locale/vi.js b/locale/vi.js new file mode 100644 index 000000000..5b50e6773 --- /dev/null +++ b/locale/vi.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "vi"; +faker.locales['vi'] = require('../lib/locales/vi'); +module['exports'] = faker; diff --git a/locale/zh_CN.js b/locale/zh_CN.js new file mode 100644 index 000000000..d621dbb3b --- /dev/null +++ b/locale/zh_CN.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "zh_CN"; +faker.locales['zh_CN'] = require('../lib/locales/zh_CN'); +module['exports'] = faker; diff --git a/locale/zh_TW.js b/locale/zh_TW.js new file mode 100644 index 000000000..9955e1046 --- /dev/null +++ b/locale/zh_TW.js @@ -0,0 +1,4 @@ +var faker = require('../lib'); +faker.locale = "zh_TW"; +faker.locales['zh_TW'] = require('../lib/locales/zh_TW'); +module['exports'] = faker; diff --git a/test/all.functional.js b/test/all.functional.js index 72ca2eeb4..605aad2ac 100644 --- a/test/all.functional.js +++ b/test/all.functional.js @@ -22,9 +22,9 @@ var modules = { phone: ['phoneNumber'], - finance: ['account', 'accountName', 'mask', 'amount', 'transactionType', 'currencyCode', 'currencyName', 'currencySymbol'], + finance: ['account', 'accountName', 'mask', 'amount', 'transactionType', 'currencyCode', 'currencyName', 'currencySymbol'] - commerce: ['color', 'department', 'productName', 'price'] +// commerce: ['color', 'department', 'productName', 'price'] }; describe("functional tests", function () {