Skip to content

Commit 886d73f

Browse files
committed
chore: improve docs
1 parent 48fbcd1 commit 886d73f

File tree

7 files changed

+169
-68
lines changed

7 files changed

+169
-68
lines changed

README.md

Lines changed: 67 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,9 @@ A performance-focused and lightweight faker library for TypeScript with comprehe
1313
## Features
1414

1515
- ⚡️ **Performance-focused** - Built with speed and efficiency in mind
16-
- 🌍 **Multi-locale Support** - Complete translations for 26 languages:
17-
- Afrikaans _(af)_
18-
- Arabic _(ar)_
19-
- Azerbaijani _(az)_
20-
- Czech _(cs)_
21-
- Danish _(da)_
22-
- German _(de)_
23-
- English _(en)_
24-
- Esperanto _(eo)_
25-
- Spanish _(es)_
26-
- Persian/Farsi _(fa)_
27-
- Finnish _(fi)_
28-
- French _(fr)_
29-
- Hebrew _(he)_
30-
- Hindi _(hi)_
31-
- Italian _(it)_
32-
- Japanese _(ja)_
33-
- Korean _(ko)_
34-
- Dutch _(nl)_
35-
- Norwegian _(no)_
36-
- Polish _(pl)_
37-
- Portuguese _(pt)_
38-
- Swedish _(sv)_
39-
- Filipino _(tl)_
40-
- Turkish _(tr)_
41-
- Ukrainian _(uk)_
42-
- Chinese _(zh)_
16+
- 🌍 **Multi-locale Support** - Complete translations for 28 languages with 22+ regional variants:
17+
- Afrikaans _(af)_, Arabic _(ar)_, Azerbaijani _(az)_, Czech _(cs)_, Danish _(da)_, German _(de)_, English _(en)_, Esperanto _(eo)_, Spanish _(es)_, Persian/Farsi _(fa)_, Finnish _(fi)_, French _(fr)_, Hebrew _(he)_, Hindi _(hi)_, Italian _(it)_, Japanese _(ja)_, Korean _(ko)_, Dutch _(nl)_, Norwegian _(no)_, Polish _(pl)_, Portuguese _(pt)_, Swedish _(sv)_, Filipino _(tl)_, Turkish _(tr)_, Ukrainian _(uk)_, Chinese Simplified _(zh-cn)_, Chinese Traditional _(zh-tw)_, Zulu _(zu)_
18+
- Plus regional variants: `en-us`, `en-gb`, `en-ca`, `en-ie`, `en-in`, `en-za`, `en-gh`, `en-ng`, `en-hk`, `fr-ca`, `fr-ch`, `fr-be`, `fr-lu`, `fr-sn`, `de-at`, `de-ch`, `es-mx`, `pt-mz`, `af-za`, `zu-za`, and more!
4319
- 📦 **Lightweight** - Minimal dependencies and small bundle size
4420
- 💪 **Fully Typed** - Written in TypeScript with comprehensive type definitions
4521
- 🎯 **Comprehensive Data** - 16+ data categories including:
@@ -103,11 +79,22 @@ console.log(faker.person.fullName()) // "María García"
10379
// Or create a new instance with a specific locale
10480
const spanishFaker = new Faker({ locale: 'es' })
10581
const japaneseFaker = new Faker({ locale: 'ja' })
106-
const chineseFaker = new Faker({ locale: 'zh' })
82+
const chineseSimplifiedFaker = new Faker({ locale: 'zh-cn' })
83+
const chineseTraditionalFaker = new Faker({ locale: 'zh-tw' })
10784

10885
console.log(spanishFaker.person.fullName()) // "Carlos López"
10986
console.log(japaneseFaker.person.fullName()) // "田中太郎"
110-
console.log(chineseFaker.person.fullName()) // "王伟"
87+
console.log(chineseSimplifiedFaker.person.fullName()) // "王伟"
88+
console.log(chineseTraditionalFaker.person.fullName()) // "陳小明"
89+
90+
// Regional variants provide localized data
91+
const usFaker = new Faker({ locale: 'en-us' })
92+
const ukFaker = new Faker({ locale: 'en-gb' })
93+
const canadianFrenchFaker = new Faker({ locale: 'fr-ca' })
94+
95+
console.log(usFaker.address.city()) // "New York"
96+
console.log(ukFaker.address.city()) // "London"
97+
console.log(canadianFrenchFaker.address.city()) // "Montréal"
11198
```
11299

113100
### Available Locales
@@ -137,7 +124,56 @@ console.log(chineseFaker.person.fullName()) // "王伟"
137124
- `tl` - Filipino
138125
- `tr` - Turkish
139126
- `uk` - Ukrainian
140-
- `zh` - Chinese
127+
- `zh-cn` - Chinese (Simplified)
128+
- `zh-tw` - Chinese (Traditional)
129+
- `zu` - Zulu
130+
131+
#### Regional Variants
132+
133+
Many languages also have regional variants with localized data for specific countries:
134+
135+
**English Variants:**
136+
137+
- `en-us` - English (United States)
138+
- `en-gb` - English (United Kingdom)
139+
- `en-ca` - English (Canada)
140+
- `en-ie` - English (Ireland)
141+
- `en-in` - English (India)
142+
- `en-za` - English (South Africa)
143+
- `en-gh` - English (Ghana)
144+
- `en-ng` - English (Nigeria)
145+
- `en-hk` - English (Hong Kong)
146+
147+
**French Variants:**
148+
149+
- `fr-ca` - French (Canada)
150+
- `fr-ch` - French (Switzerland)
151+
- `fr-be` - French (Belgium)
152+
- `fr-lu` - French (Luxembourg)
153+
- `fr-sn` - French (Senegal)
154+
155+
**German Variants:**
156+
157+
- `de-at` - German (Austria)
158+
- `de-ch` - German (Switzerland)
159+
160+
**Spanish Variants:**
161+
162+
- `es-mx` - Spanish (Mexico)
163+
164+
**Portuguese Variants:**
165+
166+
- `pt-mz` - Portuguese (Mozambique)
167+
168+
**Afrikaans Variants:**
169+
170+
- `af-za` - Afrikaans (South Africa)
171+
172+
**Zulu Variants:**
173+
174+
- `zu-za` - Zulu (South Africa)
175+
176+
These regional variants include country-specific data such as local cities, addresses, phone formats, and cultural references.
141177

142178
### API Examples
143179

@@ -309,7 +345,7 @@ ts-mocker methods food
309345

310346
### Options
311347

312-
- `--locale <locale>` - Use a specific locale (af, ar, az, cs, da, de, en, eo, es, fa, fi, fr, he, hi, it, ja, ko, nl, no, pl, pt, sv, tl, tr, uk, zh)
348+
- `--locale <locale>` - Use a specific locale (af, ar, az, cs, da, de, en, eo, es, fa, fi, fr, he, hi, it, ja, ko, nl, no, pl, pt, sv, tl, tr, uk, zh-cn, zh-tw, zu)
313349
- `--count <count>` - Number of items to generate
314350
- `--seed <seed>` - Seed for reproducible results
315351
- `--json` - Output as JSON

docs/cli.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ts-mocker generate <category> <method> [options]
2828

2929
**Options:**
3030

31-
- `--locale <locale>` - Locale to use (af, ar, az, cs, da, de, en, eo, es, fa, fi, fr, he, hi, it, ja, ko, nl, no, pl, pt, sv, tl, tr, uk, zh)
31+
- `--locale <locale>` - Locale to use (af, ar, az, cs, da, de, en, eo, es, fa, fi, fr, he, hi, it, ja, ko, nl, no, pl, pt, sv, tl, tr, uk, zh-cn, zh-tw, zu)
3232
- `--count <count>` - Number of items to generate (default: 1)
3333
- `--seed <seed>` - Seed for reproducible results
3434
- `--json` - Output as JSON
@@ -116,7 +116,7 @@ List all available locales.
116116
ts-mocker locales
117117
```
118118

119-
Shows all 26 supported locales:
119+
Shows all 28 supported locales:
120120

121121
- af - Afrikaans
122122
- ar - Arabic
@@ -143,7 +143,9 @@ Shows all 26 supported locales:
143143
- tl - Filipino
144144
- tr - Turkish
145145
- uk - Ukrainian
146-
- zh - Chinese
146+
- zh-cn - Chinese (Simplified)
147+
- zh-tw - Chinese (Traditional)
148+
- zu - Zulu
147149

148150
### batch
149151

docs/config.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,36 @@ const customFaker: Faker = faker.locale('en')
4747

4848
## Available Locales
4949

50-
ts-mocker supports the following locales with complete translations across all categories:
50+
ts-mocker supports 28 locales with complete translations across all categories:
5151

52+
- `af` - Afrikaans
53+
- `ar` - Arabic
54+
- `az` - Azerbaijani
55+
- `cs` - Czech
56+
- `da` - Danish
57+
- `de` - German
5258
- `en` - English
59+
- `eo` - Esperanto
5360
- `es` - Spanish
61+
- `fa` - Persian/Farsi
62+
- `fi` - Finnish
5463
- `fr` - French
55-
- `de` - German
64+
- `he` - Hebrew
65+
- `hi` - Hindi
5666
- `it` - Italian
57-
- `pt` - Portuguese
5867
- `ja` - Japanese
59-
- `tl` - Filipino
60-
- `zh` - Chinese
61-
- `nl` - Dutch
6268
- `ko` - Korean
69+
- `nl` - Dutch
6370
- `no` - Norwegian
71+
- `pl` - Polish
72+
- `pt` - Portuguese
6473
- `sv` - Swedish
65-
- `da` - Danish
74+
- `tl` - Filipino
75+
- `tr` - Turkish
6676
- `uk` - Ukrainian
67-
- `hi` - Hindi
77+
- `zh-cn` - Chinese (Simplified)
78+
- `zh-tw` - Chinese (Traditional)
79+
- `zu` - Zulu
6880

6981
All locales have full coverage across all 16 data categories.
7082

docs/features/locales.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ts-mocker provides comprehensive locale support with **complete translations** a
44

55
## Supported Locales
66

7-
All 26 locales have full coverage across all 16 data categories:
7+
All 28 locales have full coverage across all 16 data categories:
88

99
### Afrikaans (af)
1010

@@ -332,19 +332,48 @@ console.log(faker.person.fullName()) // "Олександр Шевченко"
332332
console.log(faker.address.city()) // "Київ"
333333
```
334334

335-
### Chinese (zh)
335+
### Chinese Simplified (zh-cn)
336336

337337
- **Status**: Full coverage ✓
338338
- **Categories**: All 16 categories fully translated
339+
- **Region**: Mainland China
339340

340341
```ts
341342
import { faker } from 'ts-mocker'
342343

343-
faker.locale = 'zh'
344+
faker.locale = 'zh-cn'
344345
console.log(faker.person.fullName()) // "王伟"
345346
console.log(faker.address.city()) // "北京"
346347
```
347348

349+
### Chinese Traditional (zh-tw)
350+
351+
- **Status**: Full coverage ✓
352+
- **Categories**: All 16 categories fully translated
353+
- **Region**: Taiwan
354+
355+
```ts
356+
import { faker } from 'ts-mocker'
357+
358+
faker.locale = 'zh-tw'
359+
console.log(faker.person.fullName()) // "陳小明"
360+
console.log(faker.address.city()) // "台北"
361+
```
362+
363+
### Zulu (zu)
364+
365+
- **Status**: Full coverage ✓
366+
- **Categories**: All 16 categories fully translated
367+
- **Region**: South Africa
368+
369+
```ts
370+
import { faker } from 'ts-mocker'
371+
372+
faker.locale = 'zu'
373+
console.log(faker.person.fullName()) // "Sipho Dlamini"
374+
console.log(faker.address.city()) // "Durban"
375+
```
376+
348377
## Multi-Locale Applications
349378

350379
For applications that need to support multiple locales simultaneously, create separate instances:

docs/intro.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
# ts-mocker
88

9-
ts-mocker is a modern, lightweight TypeScript library for generating fake data. Built with performance and developer experience in mind, it provides comprehensive locale support across 16 languages with complete translations for all data categories.
9+
ts-mocker is a modern, lightweight TypeScript library for generating fake data. Built with performance and developer experience in mind, it provides comprehensive locale support across 28 languages with complete translations for all data categories.
1010

1111
## Why ts-mocker?
1212

@@ -16,24 +16,36 @@ Built with performance as a top priority, ts-mocker is optimized for speed and e
1616

1717
### Comprehensive Locale Support
1818

19-
Unlike other faker libraries with limited or incomplete translations, ts-mocker provides **complete** translations across all 16 data categories for 16 different languages:
19+
Unlike other faker libraries with limited or incomplete translations, ts-mocker provides **complete** translations across all 16 data categories for 28 different languages:
2020

21+
- **Afrikaans (af)** - Full coverage
22+
- **Arabic (ar)** - Full coverage
23+
- **Azerbaijani (az)** - Full coverage
24+
- **Czech (cs)** - Full coverage
25+
- **Danish (da)** - Full coverage
26+
- **German (de)** - Full coverage
2127
- **English (en)** - Full coverage
28+
- **Esperanto (eo)** - Full coverage
2229
- **Spanish (es)** - Full coverage
30+
- **Persian/Farsi (fa)** - Full coverage
31+
- **Finnish (fi)** - Full coverage
2332
- **French (fr)** - Full coverage
24-
- **German (de)** - Full coverage
33+
- **Hebrew (he)** - Full coverage
34+
- **Hindi (hi)** - Full coverage
2535
- **Italian (it)** - Full coverage
26-
- **Portuguese (pt)** - Full coverage
2736
- **Japanese (ja)** - Full coverage
28-
- **Filipino (tl)** - Full coverage
29-
- **Chinese (zh)** - Full coverage
30-
- **Dutch (nl)** - Full coverage
3137
- **Korean (ko)** - Full coverage
38+
- **Dutch (nl)** - Full coverage
3239
- **Norwegian (no)** - Full coverage
40+
- **Polish (pl)** - Full coverage
41+
- **Portuguese (pt)** - Full coverage
3342
- **Swedish (sv)** - Full coverage
34-
- **Danish (da)** - Full coverage
43+
- **Filipino (tl)** - Full coverage
44+
- **Turkish (tr)** - Full coverage
3545
- **Ukrainian (uk)** - Full coverage
36-
- **Hindi (hi)** - Full coverage
46+
- **Chinese Simplified (zh-cn)** - Full coverage
47+
- **Chinese Traditional (zh-tw)** - Full coverage
48+
- **Zulu (zu)** - Full coverage
3749

3850
### Rich Data Categories
3951

docs/usage.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,35 +33,45 @@ console.log(faker.person.fullName()) // "María García"
3333
// Or create a locale-specific instance
3434
const spanishFaker = faker.locale('es')
3535
const japaneseFaker = faker.locale('ja')
36-
const chineseFaker = faker.locale('zh')
36+
const chineseSimplifiedFaker = faker.locale('zh-cn')
37+
const chineseTraditionalFaker = faker.locale('zh-tw')
3738

3839
console.log(spanishFaker.person.fullName()) // "Carlos López"
3940
console.log(japaneseFaker.person.fullName()) // "田中太郎"
40-
console.log(chineseFaker.person.fullName()) // "王伟"
41+
console.log(chineseSimplifiedFaker.person.fullName()) // "王伟"
42+
console.log(chineseTraditionalFaker.person.fullName()) // "陳小明"
4143
```
4244

4345
## Available Locales
4446

47+
- `af` - Afrikaans
48+
- `ar` - Arabic
49+
- `az` - Azerbaijani
50+
- `cs` - Czech
51+
- `da` - Danish
52+
- `de` - German
4553
- `en` - English
54+
- `eo` - Esperanto
4655
- `es` - Spanish
56+
- `fa` - Persian/Farsi
57+
- `fi` - Finnish
4758
- `fr` - French
48-
- `de` - German
59+
- `he` - Hebrew
60+
- `hi` - Hindi
4961
- `it` - Italian
50-
- `pt` - Portuguese
5162
- `ja` - Japanese
52-
- `tl` - Filipino
53-
- `zh` - Chinese
54-
- `nl` - Dutch
5563
- `ko` - Korean
64+
- `nl` - Dutch
5665
- `no` - Norwegian
66+
- `pl` - Polish
67+
- `pt` - Portuguese
5768
- `sv` - Swedish
58-
- `da` - Danish
59-
- `uk` - Ukrainian
60-
- `hi` - Hindi
61-
- `fi` - Finnish
69+
- `tl` - Filipino
6270
- `tr` - Turkish
63-
- `pl` - Polish
64-
- `cs` - Czech
71+
- `uk` - Ukrainian
72+
- `zh-cn` - Chinese (Simplified)
73+
- `zh-tw` - Chinese (Traditional)
74+
- `zu` - Zulu
6575

6676
## API Examples
6777

packages/zh/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@mock-locale/zh",
33
"type": "module",
44
"version": "0.1.3",
5-
"description": "ZH locale data for ts-mocker",
5+
"description": "Chinese locale data for ts-mocker (base locale for zh-cn and zh-tw)",
66
"author": "Chris Breuer <chris@stacksjs.org>",
77
"license": "MIT",
88
"homepage": "https://github.com/stacksjs/ts-mocker#readme",

0 commit comments

Comments
 (0)