Skip to content

Commit

Permalink
fix(docs): fix faker v7 code example for locale migration (#2125)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmayer committed May 6, 2023
1 parent 5336334 commit b570461
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/guide/upgrading.md
Expand Up @@ -30,7 +30,7 @@ import { faker } from '@faker-js/faker';
faker.setLocale('de_CH');
// or
faker.locale = 'de_CH';
faker.fallbackLocale = 'en';
faker.localeFallback = 'en';
```

**New**
Expand All @@ -44,11 +44,12 @@ This also fixes issues where more than two locales are required:
**Old**

```ts
import { faker } from '@faker-js/faker';
import { faker, Faker } from '@faker-js/faker';

const { de_CH, de, en } = faker.locales;
const customFaker = new Faker({
locale: 'de_CH', // the expected locale
fallbackLocale: 'de', // ensure we have a German fallbacks for addresses
localeFallback: 'de', // ensure we have a German fallback for addresses
locales: { de_CH, de, en },
});
const a = customFaker.internet.email();
Expand Down

0 comments on commit b570461

Please sign in to comment.