Skip to content

Commit

Permalink
Merge branch 'next' into da-locale-person
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT authored Aug 26, 2023
2 parents b2a80ee + d91057d commit 8586e23
Show file tree
Hide file tree
Showing 65 changed files with 2,155 additions and 39 deletions.
5 changes: 4 additions & 1 deletion docs/about/team/members.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@
"name": "Matt Mayer",
"title": "Contributor",
"desc": "",
"links": [{ "icon": "github", "link": "https://github.com/matthewmayer" }]
"links": [
{ "icon": "github", "link": "https://github.com/matthewmayer" }
],
"sponsor": "https://github.com/sponsors/matthewmayer"
},
{
"avatar": "https://github.com/pkuczynski.png",
Expand Down
10 changes: 5 additions & 5 deletions docs/guide/frameworks.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { faker } from '@faker-js/faker/locale/en';

describe('reverse array', () => {
it('should reverse the array', () => {
const title = faker.name.jobTitle();
const name = faker.name.fullName();
const title = faker.person.jobTitle();
const name = faker.person.fullName();
const animal = faker.animal.bear();

const array = [title, name, animal];
Expand All @@ -36,7 +36,7 @@ These are especially useful in tests that are meant to be deterministic, such as
- [Snapshots in Jest](https://jestjs.io/docs/snapshot-testing)

```ts
import { describe, it, expect } from 'vitest';
import { afterEach, describe, it, expect } from 'vitest';
import { faker } from '@faker-js/faker/locale/en';

// We might want other tests to *not* be seeded. This will re-seed our faker instance after each test.
Expand All @@ -48,8 +48,8 @@ describe('reverse array', () => {
it('should reverse the array', () => {
// Seed our faker instance with some static number.
faker.seed(1234);
const title = faker.name.jobTitle();
const name = faker.name.fullName();
const title = faker.person.jobTitle();
const name = faker.person.fullName();
const animal = faker.animal.bear();

const array = [title, name, animal];
Expand Down
7 changes: 4 additions & 3 deletions docs/guide/localization.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

Did you know Faker supports many different locales?
When using our default instance `import { faker } from '@faker-js/faker'` you get English data.
However, we also provide pre-built instances for more than 50 other locales.
However, we also provide pre-built instances for [more than 60 available locales](#available-locales).

`import { fakerDE as faker } from '@faker-js/faker'`
For example, you can import the German locale:

See below for a list of available locales.
`import { fakerDE as faker } from '@faker-js/faker'`

::: tip Note
You can also build your own Faker instances, with custom locales/overwrites.
Expand Down Expand Up @@ -98,6 +98,7 @@ In this example there are 5 locales. Each of these is checked in order, and the
| `en_NG` | English (Nigeria) | `fakerEN_NG` |
| `en_US` | English (United States) | `fakerEN_US` |
| `en_ZA` | English (South Africa) | `fakerEN_ZA` |
| `eo` | Esperanto | `fakerEO` |
| `es` | Spanish | `fakerES` |
| `es_MX` | Spanish (Mexico) | `fakerES_MX` |
| `fa` | Farsi/Persian | `fakerFA` |
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@
"@actions/github": "~5.1.1",
"@algolia/client-search": "~4.19.1",
"@types/markdown-it": "~13.0.0",
"@types/node": "~20.5.0",
"@types/node": "~20.5.4",
"@types/sanitize-html": "~2.9.0",
"@types/semver": "~7.5.0",
"@types/validator": "~13.11.1",
"@typescript-eslint/eslint-plugin": "~6.4.0",
"@typescript-eslint/parser": "~6.4.0",
"@vitest/coverage-v8": "~0.34.1",
"@vitest/coverage-v8": "~0.34.2",
"@vitest/ui": "~0.34.2",
"@vueuse/core": "~10.3.0",
"conventional-changelog-cli": "~3.0.0",
Expand All @@ -107,7 +107,7 @@
"eslint-define-config": "~1.23.0",
"eslint-gitignore": "~0.1.0",
"eslint-plugin-deprecation": "~1.5.0",
"eslint-plugin-jsdoc": "~46.4.6",
"eslint-plugin-jsdoc": "~46.5.0",
"eslint-plugin-prettier": "~5.0.0",
"eslint-plugin-vitest": "~0.2.8",
"glob": "~10.3.3",
Expand Down
52 changes: 26 additions & 26 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/locale/eo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* This file is automatically generated.
* Run 'pnpm run generate:locales' to update.
*/

import { Faker } from '../faker';
import base from '../locales/base';
import en from '../locales/en';
import eo from '../locales/eo';

export const faker = new Faker({
locale: [eo, en, base],
});
3 changes: 3 additions & 0 deletions src/locale/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { faker as fakerEN_IN } from './en_IN';
import { faker as fakerEN_NG } from './en_NG';
import { faker as fakerEN_US } from './en_US';
import { faker as fakerEN_ZA } from './en_ZA';
import { faker as fakerEO } from './eo';
import { faker as fakerES } from './es';
import { faker as fakerES_MX } from './es_MX';
import { faker as fakerFA } from './fa';
Expand Down Expand Up @@ -94,6 +95,7 @@ export {
fakerEN_NG,
fakerEN_US,
fakerEN_ZA,
fakerEO,
fakerES,
fakerES_MX,
fakerFA,
Expand Down Expand Up @@ -162,6 +164,7 @@ export const allFakers = {
en_NG: fakerEN_NG,
en_US: fakerEN_US,
en_ZA: fakerEN_ZA,
eo: fakerEO,
es: fakerES,
es_MX: fakerES_MX,
fa: fakerFA,
Expand Down
10 changes: 10 additions & 0 deletions src/locales/eo/animal/bear.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default [
'amerika nigra urso',
'azia nigra urso',
'blanka urso',
'bruna urso',
'granda pando',
'longlipa urso',
'malaja urso',
'okulvitra urso',
];
18 changes: 18 additions & 0 deletions src/locales/eo/animal/crocodilia.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export default [
'amerika krokodilo',
'aŭstralia krokodilo',
'ĉina aligatoro',
'filipina krokodilo',
'gavialo',
'kuba krokodilo',
'mara krokodilo',
'marĉa krokodilo',
'meksika krokodilo',
'misisipa aligatoro',
'nana krokodilo',
'nigra kajmano',
'nila krokodilo',
'okcidentafrika krokodilo',
'orinoka krokodilo',
'siama krokodilo',
];
18 changes: 18 additions & 0 deletions src/locales/eo/animal/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* This file is automatically generated.
* Run 'pnpm run generate:locales' to update.
*/
import type { AnimalDefinition } from '../../..';
import bear from './bear';
import crocodilia from './crocodilia';
import lion from './lion';
import type_ from './type';

const animal: AnimalDefinition = {
bear,
crocodilia,
lion,
type: type_,
};

export default animal;
9 changes: 9 additions & 0 deletions src/locales/eo/animal/lion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default [
'azia leono',
'berbera leono',
'kaba leono',
'masaja leono',
'okcidentafrika leono',
'senegala leono',
'transvala leono',
];
15 changes: 15 additions & 0 deletions src/locales/eo/animal/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export default [
'birdo',
'bovo',
'cetaco',
'ĉevalo',
'fiŝo',
'hundo',
'insekto',
'kato',
'krokodilulo',
'kuniklo',
'leono',
'serpento',
'urso',
];
Loading

0 comments on commit 8586e23

Please sign in to comment.