-
-
Notifications
You must be signed in to change notification settings - Fork 939
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
Conversation
Codecov Report
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
|
Could you please share your insights on the last name matter a bit? |
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. |
Thanks @madcampos for your input.
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"? |
@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 |
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. |
Team Decision Closing in favor of #1819. |
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 becausefirstName
andlastName
are generated before the template replacement unlikemiddleName
orsuffix
which are generated on demand.To Be
Make
firstName
andlastName
get generated on demand similar tomiddleName
. Only fallback tooptions.firstName
andoptions.lastName
when those are supplied.