aboutsummaryrefslogtreecommitdiff
path: root/docs/guide
diff options
context:
space:
mode:
authorShinigami <[email protected]>2023-03-29 10:22:57 +0200
committerGitHub <[email protected]>2023-03-29 08:22:57 +0000
commitf890d627164c5436e2b2a3ac05239a1a1634015e (patch)
tree93d77a9f2c8dcf105b4e45e44ea9fb0c85b30a3d /docs/guide
parentde47aaa56892621a0088ac63386cfaf06c560f16 (diff)
downloadfaker-f890d627164c5436e2b2a3ac05239a1a1634015e.tar.xz
faker-f890d627164c5436e2b2a3ac05239a1a1634015e.zip
feat: add base locale (#1748)
Diffstat (limited to 'docs/guide')
-rw-r--r--docs/guide/localization.md13
-rw-r--r--docs/guide/upgrading.md4
2 files changed, 13 insertions, 4 deletions
diff --git a/docs/guide/localization.md b/docs/guide/localization.md
index c563b25c..4b0738dc 100644
--- a/docs/guide/localization.md
+++ b/docs/guide/localization.md
@@ -44,7 +44,7 @@ If our built-in faker instances don't satisfy your needs, you can build your own
```ts
import type { LocaleDefinition } from '@faker-js/faker';
-import { Faker, de_CH, de, en } from '@faker-js/faker';
+import { Faker, de_CH, de, en, base } from '@faker-js/faker';
const customLocale: LocaleDefinition = {
title: 'My custom locale',
@@ -54,10 +54,18 @@ const customLocale: LocaleDefinition = {
};
export const customFaker = new Faker({
- locale: [customLocale, de_CH, de, en, global],
+ locale: [customLocale, de_CH, de, en, base],
});
```
+In this example there are 5 locales. Each of these is checked in order, and the first locale which contains the requested data will be used:
+
+- `customLocale` is your custom locale definition which will override all other fallback definitions.
+- `de_CH` is a specific locale definition that overrides some German definitions with `CH` (Switzerland) data.
+- `de` is a generic `de` (German) locale definition.
+- `en` is a generic `en` (English) locale definition. This is our most complete locale, so we add it to fill some gaps. Depending on your needs, you might want or not want to have it as a fallback.
+- `base` is the base locale definition which contains definitions that can be used in every language (e.g. emojis).
+
## Available locales
<!-- LOCALES-AUTO-GENERATED-START -->
@@ -69,6 +77,7 @@ export const customFaker = new Faker({
| `af_ZA` | Afrikaans | `fakerAF_ZA` |
| `ar` | Arabic | `fakerAR` |
| `az` | Azerbaijani | `fakerAZ` |
+| `base` | Base | `fakerBASE` |
| `cz` | Czech | `fakerCZ` |
| `de` | German | `fakerDE` |
| `de_AT` | German (Austria) | `fakerDE_AT` |
diff --git a/docs/guide/upgrading.md b/docs/guide/upgrading.md
index 82bfd2ac..1fa392f8 100644
--- a/docs/guide/upgrading.md
+++ b/docs/guide/upgrading.md
@@ -60,12 +60,12 @@ const b = customFaker.internet.emoji();
**New**
```ts
-import { Faker, de_CH, de, en, global } from '@faker-js/faker';
+import { Faker, de_CH, de, en, base } from '@faker-js/faker';
// same as fakerDE_CH
export const customFaker = new Faker({
// Now multiple fallbacks are supported
- locale: [de_CH, de, en, global],
+ locale: [de_CH, de, en, base],
});
const a = customFaker.internet.email();
const b = customFaker.internet.emoji();