Skip to content

feat(person): use fake patterns for jobTitle#2528

Merged
ST-DDT merged 2 commits into
faker-js:nextfrom
matthewmayer:job_title_pattern
Nov 7, 2023
Merged

feat(person): use fake patterns for jobTitle#2528
ST-DDT merged 2 commits into
faker-js:nextfrom
matthewmayer:job_title_pattern

Conversation

@matthewmayer

Copy link
Copy Markdown
Contributor

Currently faker.person.jobTitle is hardcoded to use the order:

{{person.jobDescriptor}} {{person.jobArea}} {{person.jobType}}

e.g. Senior Marketing Executive

However in some languages, like Spanish or French, typically the adjectives would follow the noun ie type area descriptor

And in some languages like Thai or Chinese although they follow an English word order, there should be no spaces between the parts.

This PR permits better localization by allowing a fake pattern for the job title. I just added English and Spanish for now as demos, other languages could be added as needed. If no job_title_pattern is found it would fall back to en, keeping current behavior.

@matthewmayer matthewmayer requested a review from a team as a code owner November 5, 2023 09:22
@codecov

codecov Bot commented Nov 5, 2023

Copy link
Copy Markdown

Codecov Report

Merging #2528 (0913030) into next (e4865df) will increase coverage by 0.01%.
The diff coverage is 86.66%.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #2528      +/-   ##
==========================================
+ Coverage   99.56%   99.57%   +0.01%     
==========================================
  Files        2779     2781       +2     
  Lines      249303   249317      +14     
  Branches     1075     1082       +7     
==========================================
+ Hits       248221   248266      +45     
+ Misses       1054     1023      -31     
  Partials       28       28              
Files Coverage Δ
src/locales/en/person/index.ts 100.00% <100.00%> (ø)
src/locales/en/person/job_title_pattern.ts 100.00% <100.00%> (ø)
src/locales/es/person/index.ts 100.00% <100.00%> (ø)
src/locales/es/person/job_title_pattern.ts 100.00% <100.00%> (ø)
src/modules/person/index.ts 97.99% <100.00%> (+0.01%) ⬆️
src/definitions/person.ts 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

@matthewmayer matthewmayer self-assigned this Nov 5, 2023
@matthewmayer matthewmayer added m: person Something is referring to the person module c: feature Request for new feature p: 1-normal Nothing urgent labels Nov 5, 2023
@matthewmayer matthewmayer changed the title feat(person): allow job_title to use fake pattern for better l10n feat(person): allow jobTitle to use fake pattern for better l10n Nov 5, 2023
@ST-DDT ST-DDT added this to the vAnytime milestone Nov 5, 2023
@ST-DDT ST-DDT requested review from a team November 5, 2023 17:35
@ST-DDT ST-DDT changed the title feat(person): allow jobTitle to use fake pattern for better l10n feat(person): use fake patterns for jobTitle Nov 7, 2023
@ST-DDT ST-DDT enabled auto-merge (squash) November 7, 2023 20:47
@ST-DDT ST-DDT merged commit b40ad45 into faker-js:next Nov 7, 2023
@ST-DDT ST-DDT modified the milestones: vAnytime, v8.x Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: feature Request for new feature m: person Something is referring to the person module p: 1-normal Nothing urgent

3 participants