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

fix(person): fix duplicate last names in full name generation #1822

Closed
wants to merge 1 commit into from

Conversation

0916dhkim
Copy link

Fixes #1817

As Is

faker.person.fullName uses mustache templates from each locale to generate a full name. When the template contains multiple last names, the same last name is repeated. Same bug happens to multiple first names. This is because firstName and lastName are generated before the template replacement unlike middleName or suffix which are generated on demand.

To Be

Make firstName and lastName get generated on demand similar to middleName. Only fallback to options.firstName and options.lastName when those are supplied.

@0916dhkim 0916dhkim requested a review from a team as a code owner February 12, 2023 02:42
@0916dhkim 0916dhkim mentioned this pull request Feb 12, 2023
10 tasks
@codecov
Copy link

codecov bot commented Feb 12, 2023

Codecov Report

Merging #1822 (e49a0a1) into next (d5b78c7) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #1822      +/-   ##
==========================================
- Coverage   99.64%   99.63%   -0.01%     
==========================================
  Files        2347     2347              
  Lines      235657   235657              
  Branches     1145     1142       -3     
==========================================
- Hits       234811   234788      -23     
- Misses        824      847      +23     
  Partials       22       22              
Impacted Files Coverage Δ
src/modules/person/index.ts 99.72% <100.00%> (ø)
src/modules/internet/user-agent.ts 89.64% <0.00%> (-6.81%) ⬇️

@ST-DDT
Copy link
Member

ST-DDT commented Feb 12, 2023

Could you please share your insights on the last name matter a bit?
Do these languages have two distinct last names (e.g. mothers and fathers last name) or one last name consisting of multiple parts (space or hyphen separated)?
E.g. in Germany you can decide to add your spouses name to your name, but then you have a new single last name that you have use then.
The individual parts are no longer relevant excepts for personal reasons.

@ST-DDT ST-DDT added p: 1-normal Nothing urgent s: needs decision Needs team/maintainer decision m: person Something is referring to the person module labels Feb 12, 2023
@ST-DDT ST-DDT added the c: bug Something isn't working label Feb 12, 2023
@madcampos
Copy link

Hi @ST-DDT just chiming in to give an insight for Brazilian Portuguese.

It is a tradition that the children get both parents last names, but it varies from place to place and is not a hard rule.

For example, my mother has a super simple name, Lucrécia Dilda. When my parents were married, she had my father's last name too.

On the other hand, my father has the same name of my grandfather, Francisco Aurélio da Silva Campos Filho. His first name would be "Francisco Aurélio", then the rest is his last name, and "Filho" means "son" to mark he has his father's name.

I got both last names, so my full name is Marco Aurélio Dilda Campos.

So yeah, it can be multiple different names.

@ST-DDT
Copy link
Member

ST-DDT commented Feb 13, 2023

Thanks @madcampos for your input.

I got both last names, so my full name is Marco Aurélio Dilda Campos.

So yeah, it can be multiple different names.

Just for clarification, is "Dilda Campos" your last name or "Dilda" AND "Campos"? Is it possible for you to flip them the other way round e.g. "Campos Dilda"?
How is it handled in web forms? Do you have two inputs for the last name or do you put both in one?

@madcampos
Copy link

@ST-DDT So, to be super semantic here...

In Brazil the whole thing is considered your surname, in that case "Dilda Campos", and last name would be your very last name, in this case only "Campos". I cannot flip them around.

In web forms outside of Brazil I use my very first and very last name and omit everything else, so my name would be only "Marco Campos".

For forms in Brazil it is common to have a single field for full name, if it happens to be two fields, then I would input "Marco Aurélio" as first name/given name and "Dilda Campos" as last name/surname

@matthewmayer
Copy link
Contributor

Note that the naming of the Faker methods isn't perfect anyway, "lastName" should probably be familyName and "firstName" should be givenName as for example in Chinese the family name comes first.

@ST-DDT
Copy link
Member

ST-DDT commented Feb 16, 2023

Team Decision

Closing in favor of #1819.

@ST-DDT ST-DDT closed this Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: bug Something isn't working m: person Something is referring to the person module p: 1-normal Nothing urgent s: needs decision Needs team/maintainer decision
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Double last names in some locales
4 participants