aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2023-01-29 16:27:47 +0100
committerGitHub <[email protected]>2023-01-29 16:27:47 +0100
commit0bc6c2fbe65de9a9f706aa6f78f3b07940038461 (patch)
treef7d044507b74a38106760af9fc4d4938a21191d5
parent6772b00cf19ccdbebefe023dc0f96c6576234b5b (diff)
downloadfaker-0bc6c2fbe65de9a9f706aa6f78f3b07940038461.tar.xz
faker-0bc6c2fbe65de9a9f706aa6f78f3b07940038461.zip
refactor(locale)!: remove unused separator entry (#1731)
-rw-r--r--scripts/generateLocales.ts8
-rw-r--r--src/definitions/definitions.ts1
-rw-r--r--src/faker.ts5
-rw-r--r--src/locales/ar/index.ts1
-rw-r--r--src/locales/az/index.ts1
-rw-r--r--src/locales/el/index.ts1
-rw-r--r--src/locales/en/index.ts1
-rw-r--r--src/locales/es_MX/index.ts1
-rw-r--r--src/locales/ge/index.ts1
-rw-r--r--src/locales/he/index.ts1
-rw-r--r--src/locales/hy/index.ts1
-rw-r--r--src/locales/lv/index.ts1
-rw-r--r--src/locales/mk/index.ts1
-rw-r--r--src/locales/ru/index.ts1
-rw-r--r--src/locales/ur/index.ts1
-rw-r--r--test/faker.spec.ts14
16 files changed, 3 insertions, 37 deletions
diff --git a/scripts/generateLocales.ts b/scripts/generateLocales.ts
index 07cf47e7..ce7bce60 100644
--- a/scripts/generateLocales.ts
+++ b/scripts/generateLocales.ts
@@ -132,7 +132,7 @@ function tryLoadLocalesMainIndexFile(pathModules: string): LocaleDefinition {
let localeDef: LocaleDefinition;
// This call might fail, if the module setup is broken.
// Unfortunately, we try to fix it with this script
- // Thats why have a fallback logic here, we only need the title and separator anyway
+ // Thats why have a fallback logic here, we only need the title anyway
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
localeDef = require(pathModules).default;
@@ -147,7 +147,6 @@ function tryLoadLocalesMainIndexFile(pathModules: string): LocaleDefinition {
);
localeDef = {
title: localeIndex.match(/title: '(.*)',/)[1],
- separator: localeIndex.match(/separator: '(.*)',/)?.[1],
};
} catch {
console.error(`Failed to load ${pathModules} or manually parse it.`, e);
@@ -287,7 +286,6 @@ for (const locale of locales) {
const localeDef = tryLoadLocalesMainIndexFile(pathModules);
// We use a fallback here to at least generate a working file.
const localeTitle = localeDef?.title ?? `TODO: Insert Title for ${locale}`;
- const localeSeparator = localeDef?.separator;
localeIndexImports += `import ${locale} from './${locale}';\n`;
localeIndexType += ` | '${locale}'\n`;
@@ -298,14 +296,12 @@ for (const locale of locales) {
generateLocaleFile(locale);
// src/locales/**/index.ts
- const separator = localeSeparator ? `\nseparator: '${localeSeparator}',` : '';
-
generateRecursiveModuleIndexes(
pathModules,
locale,
'LocaleDefinition',
1,
- `title: '${localeTitle}',${separator}`
+ `title: '${localeTitle}',`
);
}
diff --git a/src/definitions/definitions.ts b/src/definitions/definitions.ts
index 59c133eb..b4afae1b 100644
--- a/src/definitions/definitions.ts
+++ b/src/definitions/definitions.ts
@@ -56,5 +56,4 @@ export type LocaleDefinition = {
* The name of the language.
*/
title: string;
- separator?: string;
} & LocaleEntry<Definitions>;
diff --git a/src/faker.ts b/src/faker.ts
index 7224c501..dadb79df 100644
--- a/src/faker.ts
+++ b/src/faker.ts
@@ -42,10 +42,7 @@ export interface FakerOptions {
localeFallback?: UsableLocale;
}
-const metadataKeys: ReadonlyArray<keyof LocaleDefinition> = [
- 'title',
- 'separator',
-];
+const metadataKeys: ReadonlyArray<keyof LocaleDefinition> = ['title'];
export class Faker {
locales: UsedLocales;
diff --git a/src/locales/ar/index.ts b/src/locales/ar/index.ts
index 7b81efd8..cd7e590b 100644
--- a/src/locales/ar/index.ts
+++ b/src/locales/ar/index.ts
@@ -15,7 +15,6 @@ import vehicle from './vehicle';
const ar: LocaleDefinition = {
title: 'Arabic',
- separator: ' & ',
cell_phone,
color,
commerce,
diff --git a/src/locales/az/index.ts b/src/locales/az/index.ts
index fe89852b..043e35ef 100644
--- a/src/locales/az/index.ts
+++ b/src/locales/az/index.ts
@@ -14,7 +14,6 @@ import phone_number from './phone_number';
const az: LocaleDefinition = {
title: 'Azerbaijani',
- separator: ' və ',
color,
commerce,
company,
diff --git a/src/locales/el/index.ts b/src/locales/el/index.ts
index 4c235730..5c3480ab 100644
--- a/src/locales/el/index.ts
+++ b/src/locales/el/index.ts
@@ -20,7 +20,6 @@ import team from './team';
const el: LocaleDefinition = {
title: 'Greek',
- separator: ' & ',
app,
business,
cell_phone,
diff --git a/src/locales/en/index.ts b/src/locales/en/index.ts
index 3cd7a1b6..c55491cc 100644
--- a/src/locales/en/index.ts
+++ b/src/locales/en/index.ts
@@ -28,7 +28,6 @@ import word from './word';
const en: LocaleDefinition = {
title: 'English',
- separator: ' & ',
animal,
app,
business,
diff --git a/src/locales/es_MX/index.ts b/src/locales/es_MX/index.ts
index ef6ac63b..dcaebecb 100644
--- a/src/locales/es_MX/index.ts
+++ b/src/locales/es_MX/index.ts
@@ -16,7 +16,6 @@ import team from './team';
const es_MX: LocaleDefinition = {
title: 'Spanish (Mexico)',
- separator: ' & ',
cell_phone,
color,
commerce,
diff --git a/src/locales/ge/index.ts b/src/locales/ge/index.ts
index 2b7b332d..dd187ba2 100644
--- a/src/locales/ge/index.ts
+++ b/src/locales/ge/index.ts
@@ -12,7 +12,6 @@ import phone_number from './phone_number';
const ge: LocaleDefinition = {
title: 'Georgian',
- separator: ' და ',
cell_phone,
company,
internet,
diff --git a/src/locales/he/index.ts b/src/locales/he/index.ts
index 9720dce8..b54fc894 100644
--- a/src/locales/he/index.ts
+++ b/src/locales/he/index.ts
@@ -15,7 +15,6 @@ import phone_number from './phone_number';
const he: LocaleDefinition = {
title: 'Hebrew',
- separator: 'ו ',
cell_phone,
color,
commerce,
diff --git a/src/locales/hy/index.ts b/src/locales/hy/index.ts
index ae14d46d..5dda2bdd 100644
--- a/src/locales/hy/index.ts
+++ b/src/locales/hy/index.ts
@@ -13,7 +13,6 @@ import phone_number from './phone_number';
const hy: LocaleDefinition = {
title: 'Armenian',
- separator: ' և ',
color,
date,
internet,
diff --git a/src/locales/lv/index.ts b/src/locales/lv/index.ts
index e38fa60f..1886bfe2 100644
--- a/src/locales/lv/index.ts
+++ b/src/locales/lv/index.ts
@@ -16,7 +16,6 @@ import phone_number from './phone_number';
const lv: LocaleDefinition = {
title: 'Latvian',
- separator: ' un ',
cell_phone,
color,
commerce,
diff --git a/src/locales/mk/index.ts b/src/locales/mk/index.ts
index 6b1d245e..11227239 100644
--- a/src/locales/mk/index.ts
+++ b/src/locales/mk/index.ts
@@ -13,7 +13,6 @@ import phone_number from './phone_number';
const mk: LocaleDefinition = {
title: 'Macedonian',
- separator: ' и ',
cell_phone,
company,
date,
diff --git a/src/locales/ru/index.ts b/src/locales/ru/index.ts
index 966430db..651abae6 100644
--- a/src/locales/ru/index.ts
+++ b/src/locales/ru/index.ts
@@ -16,7 +16,6 @@ import phone_number from './phone_number';
const ru: LocaleDefinition = {
title: 'Russian',
- separator: ' и ',
color,
commerce,
company,
diff --git a/src/locales/ur/index.ts b/src/locales/ur/index.ts
index 6b4cd3a3..48128afd 100644
--- a/src/locales/ur/index.ts
+++ b/src/locales/ur/index.ts
@@ -20,7 +20,6 @@ import vehicle from './vehicle';
const ur: LocaleDefinition = {
title: 'Urdu',
- separator: ' اور ',
animal,
app,
business,
diff --git a/test/faker.spec.ts b/test/faker.spec.ts
index 50579f60..75d515f7 100644
--- a/test/faker.spec.ts
+++ b/test/faker.spec.ts
@@ -76,20 +76,6 @@ describe('faker', () => {
});
});
- describe('separator', () => {
- it.each(Object.keys(faker.locales))('separator (%s)', (locale) => {
- faker.locale = locale;
- expect(faker.definitions.separator).toBeTypeOf('string');
- });
-
- it('separator (with fallback)', () => {
- // Use a language that doesn't have a separator specified
- expect(faker.locales['en_US'].separator).toBeUndefined();
- // Check that the fallback works
- expect(faker.definitions.separator).toBe(faker.locales['en'].separator);
- });
- });
-
it('locale definition accessability', () => {
// Metadata
expect(faker.definitions.title).toBeDefined();