Skip to content

Commit f70a6f7

Browse files
authored
feat(locale): add cy locale, start with date (#3462)
1 parent b2c5298 commit f70a6f7

File tree

10 files changed

+113
-0
lines changed

10 files changed

+113
-0
lines changed

docs/guide/localization.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ In this example there are 5 locales. Each of these is checked in order, and the
5656
| `base` | Base | `fakerBASE` |
5757
| `bn_BD` | Bengali (Bangladesh) | `fakerBN_BD` |
5858
| `cs_CZ` | Czech (Czechia) | `fakerCS_CZ` |
59+
| `cy` | Welsh | `fakerCY` |
5960
| `da` | Danish | `fakerDA` |
6061
| `de` | German | `fakerDE` |
6162
| `de_AT` | German (Austria) | `fakerDE_AT` |

src/locale/cy.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* This file is automatically generated.
3+
* Run 'pnpm run generate:locales' to update.
4+
*/
5+
6+
import { Faker } from '../faker';
7+
import base from '../locales/base';
8+
import cy from '../locales/cy';
9+
import en from '../locales/en';
10+
11+
/**
12+
* The faker instance for the `cy` locale.
13+
*
14+
* - Language: Welsh
15+
* - Endonym: Cymraeg
16+
*
17+
* This instance uses the following locales internally (in descending precedence):
18+
*
19+
* - `cy`
20+
* - `en`
21+
* - `base`
22+
*/
23+
export const faker = new Faker({
24+
locale: [cy, en, base],
25+
});

src/locale/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { faker as fakerAZ } from './az';
99
import { faker as fakerBASE } from './base';
1010
import { faker as fakerBN_BD } from './bn_BD';
1111
import { faker as fakerCS_CZ } from './cs_CZ';
12+
import { faker as fakerCY } from './cy';
1213
import { faker as fakerDA } from './da';
1314
import { faker as fakerDE } from './de';
1415
import { faker as fakerDE_AT } from './de_AT';
@@ -81,6 +82,7 @@ export { faker as fakerAZ } from './az';
8182
export { faker as fakerBASE } from './base';
8283
export { faker as fakerBN_BD } from './bn_BD';
8384
export { faker as fakerCS_CZ } from './cs_CZ';
85+
export { faker as fakerCY } from './cy';
8486
export { faker as fakerDA } from './da';
8587
export { faker as fakerDE } from './de';
8688
export { faker as fakerDE_AT } from './de_AT';
@@ -154,6 +156,7 @@ export const allFakers = {
154156
base: fakerBASE,
155157
bn_BD: fakerBN_BD,
156158
cs_CZ: fakerCS_CZ,
159+
cy: fakerCY,
157160
da: fakerDA,
158161
de: fakerDE,
159162
de_AT: fakerDE_AT,

src/locales/cy/date/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* This file is automatically generated.
3+
* Run 'pnpm run generate:locales' to update.
4+
*/
5+
import type { DateDefinition } from '../../..';
6+
import month from './month';
7+
import weekday from './weekday';
8+
9+
const date: DateDefinition = {
10+
month,
11+
weekday,
12+
};
13+
14+
export default date;

src/locales/cy/date/month.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
export default {
2+
wide: [
3+
'Awst',
4+
'Chwefror',
5+
'Ebrill',
6+
'Gorffennaf',
7+
'Hydref',
8+
'Ionawr',
9+
'Mai',
10+
'Mawrth',
11+
'Medi',
12+
'Mehefin',
13+
'Rhagfyr',
14+
'Tachwedd',
15+
],
16+
abbr: [
17+
'Aws',
18+
'Chwef',
19+
'Ebr',
20+
'Gorff',
21+
'Hyd',
22+
'Ion',
23+
'Mai',
24+
'Maw',
25+
'Medi',
26+
'Meh',
27+
'Rhag',
28+
'Tach',
29+
],
30+
};

src/locales/cy/date/weekday.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default {
2+
wide: ['Gwener', 'Iau', 'Llun', 'Mawrth', 'Mercher', 'Sadwrn', 'Sul'],
3+
abbr: ['Gwen', 'Iau', 'Llun', 'Maw', 'Mer', 'Sad', 'Sul'],
4+
};

src/locales/cy/index.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* This file is automatically generated.
3+
* Run 'pnpm run generate:locales' to update.
4+
*/
5+
import type { LocaleDefinition } from '../..';
6+
import date from './date';
7+
import metadata from './metadata';
8+
9+
/**
10+
* The locale data for the `cy` locale.
11+
*
12+
* - Language: Welsh
13+
* - Endonym: Cymraeg
14+
*/
15+
const cy: LocaleDefinition = {
16+
date,
17+
metadata,
18+
};
19+
20+
export default cy;

src/locales/cy/metadata.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import type { PreBuiltMetadataDefinition } from '../../definitions/metadata';
2+
3+
const metadata: PreBuiltMetadataDefinition = {
4+
title: 'Welsh',
5+
code: 'cy',
6+
language: 'cy',
7+
endonym: 'Cymraeg',
8+
dir: 'ltr',
9+
script: 'Latn',
10+
};
11+
12+
export default metadata;

src/locales/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import az from './az';
99
import base from './base';
1010
import bn_BD from './bn_BD';
1111
import cs_CZ from './cs_CZ';
12+
import cy from './cy';
1213
import da from './da';
1314
import de from './de';
1415
import de_AT from './de_AT';
@@ -81,6 +82,7 @@ export { default as az } from './az';
8182
export { default as base } from './base';
8283
export { default as bn_BD } from './bn_BD';
8384
export { default as cs_CZ } from './cs_CZ';
85+
export { default as cy } from './cy';
8486
export { default as da } from './da';
8587
export { default as de } from './de';
8688
export { default as de_AT } from './de_AT';
@@ -154,6 +156,7 @@ export const allLocales = {
154156
base,
155157
bn_BD,
156158
cs_CZ,
159+
cy,
157160
da,
158161
de,
159162
de_AT,

test/__snapshots__/locale-data.spec.ts.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ exports[`locale-data > should only have known characters 1`] = `
88
"base": " ()+,-./:;ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",
99
"bn_BD": "অআইএকগঙচজটডতধনপফবভমযরলশসহ়ািুৃেো্",
1010
"cs_CZ": " #()+-.ABCDEFGHIJKLMNOPRSTUVWXZabcdefghijklmnopqrstuvwxyzÁÍÚáéíóöúüýČčĎďěňŘřŠšťůűŽž",
11+
"cy": "ACEGHILMRSTabcdefghilnorstuwy",
1112
"da": " !"#()+,-./ABCDEFGHIJKLMNOPQRSTUVWYZabcdefghijklmnopqrstuvwxyzÅÆØãåæçéíø",
1213
"de": " #&'()+,-.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÄÖÜßàãäéíöúü",
1314
"de_AT": " #&()+,-.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÄÖÜßãäéíöúü",

0 commit comments

Comments
 (0)