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

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

Merged
merged 2 commits into from
Nov 7, 2023

Conversation

matthewmayer
Copy link
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
Copy link

codecov bot commented Nov 5, 2023

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
20 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants