Skip to content

Commit

Permalink
refactor(locale)!: use singular locale definition keys (#2932)
Browse files Browse the repository at this point in the history
  • Loading branch information
SaurabhXRT committed Jun 13, 2024
1 parent 2a2a132 commit a5ffca1
Show file tree
Hide file tree
Showing 59 changed files with 71 additions and 70 deletions.
7 changes: 4 additions & 3 deletions docs/guide/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,14 @@ Renamed deprecated locale aliases `cz`, `en_IND`, `ge` and removed `global`.

### Renamed Locale Definitions

The following locale definitions have been renamed
The following locale definitions have been adjusted to align with Faker's locale definition naming standard:

| old | replacement |
| ------------------------------------------- | -------------------------------------------- |
| `faker.definitions.science.chemicalElement` | `faker.definitions.science.chemical_element` |
| `faker.definitions.system.directoryPaths` | `faker.definitions.system.directory_paths` |
| `faker.definitions.system.mimeTypes` | `faker.definitions.system.mime_types` |
| `faker.definitions.system.directoryPaths` | `faker.definitions.system.directory_path` |
| `faker.definitions.system.mimeTypes` | `faker.definitions.system.mime_type` |
| `faker.definitions.lorem.words` | `faker.definitions.lorem.word` |

With that now all our locale data use the following naming scheme:

Expand Down
2 changes: 1 addition & 1 deletion src/definitions/lorem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export type LoremDefinition = LocaleEntry<{
/**
* Lorem words used to generate dummy texts.
*/
words: string[];
word: string[];
}>;
4 changes: 2 additions & 2 deletions src/definitions/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export type SystemDefinition = LocaleEntry<{
/**
* Returns some common file paths.
*/
directory_paths: string[];
directory_path: string[];

/**
* The mime type definitions with some additional information.
*/
mime_types: { [mimeType: string]: SystemMimeTypeEntryDefinition };
mime_type: { [mimeType: string]: SystemMimeTypeEntryDefinition };
}>;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/locales/ar/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions src/locales/base/system/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { SystemDefinition } from '../../..';
import directory_paths from './directory_paths';
import mime_types from './mime_types';
import directory_path from './directory_path';
import mime_type from './mime_type';

const system: SystemDefinition = {
directory_paths,
mime_types,
directory_path,
mime_type,
};

export default system;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/cs_CZ/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/de/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/dv/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/el/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/en/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/en_BORK/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/es_MX/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/fa/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/fr/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/fr_CH/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/he/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/hy/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/ja/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/ko/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/lv/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/nl/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/pl/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/pt_BR/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/ru/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/sk/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/tr/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/ur/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/uz_UZ_latin/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
4 changes: 2 additions & 2 deletions src/locales/vi/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LoremDefinition } from '../../..';
import words from './words';
import word from './word';

const lorem: LoremDefinition = {
words,
word,
};

export default lorem;
File renamed without changes.
2 changes: 1 addition & 1 deletion src/modules/lorem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class LoremModule extends ModuleBase {
return this.faker.helpers.arrayElement(
filterWordListByLength({
...opts,
wordList: this.faker.definitions.lorem.words,
wordList: this.faker.definitions.lorem.word,
})
);
}
Expand Down
Loading

0 comments on commit a5ffca1

Please sign in to comment.