Skip to content

Creating Locales

Brian Chavez edited this page Jun 10, 2015 · 24 revisions

Locales are simple .js JavaScript files. Bogus is using a direct copy of locales from faker.js, so keeping up with the format is necessary for comparability between both projects. Ideally, we'd like to keep both faker.js and Bogus locales in sync so both projects can benefit from the community locale contributions.

You can edit or add locales in:

Source\Bogus\locales

When Bogus is compiled, these .js files are executed in a JavaScript VM and the result locale is converted to Json saved in Source\Bogus\data which is the basis for the Bogus dataset database.

The format of a locale should look like:

var en = {};
module["exports"] = en;
en.title = "English";
en.separator = " & ";
en.address = {
      "city_prefix":[
          "North","East","South"
      ],
      "city_suffix":[
          "town","ville","fort"
       ]
   };
en.name = {
         "first_name":[
              "Brian", "Sandra", "Alex", "Dave"
         ],
         "last_name":[
              "Chavez", "Smith", "Tate", "Jones"
         ]
    }

Clone this wiki locally