Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(locale)!: use singular locale definition keys #2932

Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/guide/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,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 fakers locale definition naming standard:
SaurabhXRT marked this conversation as resolved.
Show resolved Hide resolved

| old | replacement |
| Old | Replacement |
SaurabhXRT marked this conversation as resolved.
Show resolved Hide resolved
| ------------------------------------------- | -------------------------------------------- |
| `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 pnpm-lock.yaml
ST-DDT marked this conversation as resolved.
Show resolved Hide resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.
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;
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;
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;
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