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): avoid repeated double last name in some locales #1818

Closed
wants to merge 2 commits into from

Conversation

matthewmayer
Copy link
Contributor

@matthewmayer matthewmayer commented Feb 8, 2023

fix #1817

Since faker.mustache will always replace the same placeholder with the same name, tried introducing lastName2

If you have any better ideas for this let me know.

Note this affects #691 (the hyphenated patterns discussed there are already used in some locales)

@matthewmayer matthewmayer changed the title fix(person): avoid repeated double last name in en_SG, es, es_MX, lv, nb_NO, sv fix(person): avoid repeated double last name in some locales Feb 8, 2023
@matthewmayer matthewmayer marked this pull request as ready for review February 8, 2023 15:49
@matthewmayer matthewmayer requested a review from a team as a code owner February 8, 2023 15:49
@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Merging #1818 (7aea367) into next (8766fd7) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #1818      +/-   ##
==========================================
+ Coverage   99.62%   99.63%   +0.01%     
==========================================
  Files        2346     2346              
  Lines      235646   235650       +4     
  Branches     1135     1145      +10     
==========================================
+ Hits       234754   234793      +39     
+ Misses        870      835      -35     
  Partials       22       22              
Impacted Files Coverage Δ
src/locales/en_GH/person/name.ts 100.00% <100.00%> (ø)
src/locales/es/person/name.ts 100.00% <100.00%> (ø)
src/locales/es_MX/person/name.ts 100.00% <100.00%> (ø)
src/locales/lv/person/name.ts 100.00% <100.00%> (ø)
src/locales/nb_NO/person/name.ts 100.00% <100.00%> (ø)
src/locales/sv/person/name.ts 100.00% <100.00%> (ø)
src/modules/person/index.ts 99.73% <100.00%> (+<0.01%) ⬆️
src/modules/internet/user-agent.ts 93.19% <0.00%> (+10.35%) ⬆️

@ejcheng ejcheng added c: locale Permutes locale definitions m: person Something is referring to the person module labels Feb 8, 2023
@ejcheng ejcheng added this to the v8.0 - Module Re-Shuffling milestone Feb 8, 2023
Copy link
Member

@ST-DDT ST-DDT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR tries to fix a problem, without taking the cause of the problem into consideration.

There are two problems here:

  1. The patterns seem to express an additional context to the last names that they are unable to express: The person doesn't have a single last name, but two.
  2. Some of the patterns seem to modify the exontext of last name to express complex last names such as combined/joined last names.

IMO the real solution to this problem is removing the repeated lastNames from the pattern and actually pass the entire last name to the method directly. (Where would the other last name come from anyway in legal documents? "John" + "Smith" ⇏ "John Smith Foobar")

If there is a locale that actually has two separate last names, then it has to use a different/not yet existing method or parameter set for it. If a locale has some kind of double last name, then it should have them in the locale data itself. Similar to thetussenvoegsel (#1778).

What do you think?

@@ -8,11 +8,11 @@ export default [
weight: 1,
},
{
value: '{{person.firstName}} {{person.firstName}} {{person.lastName}}',
value: '{{person.firstName}} {{person.firstName}} {{person.lastName2}}',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern only has a single last name.

@ST-DDT ST-DDT added p: 1-normal Nothing urgent s: needs decision Needs team/maintainer decision labels Feb 8, 2023
@matthewmayer
Copy link
Contributor Author

matthewmayer commented Feb 8, 2023

I don't think it's quite like tuessenvoegels because there's no "common" double or hyphenated names. In most cultures it's just your mothers and fathers surnames concatenated in some way. So if there are N simple last names there are N^2 compound last names.

I guess we could add an optional last_name_pattern. Then if provided that would affect both lastName() and fullName()

@ST-DDT
Copy link
Member

ST-DDT commented Feb 9, 2023

there's no "common" double or hyphenated names.

It doesn't has to, just have them in our sample set.

I guess we could add an optional last_name_pattern.

That might be a alternative worth exploring. (We originally planned to remove all optional data access, so we could throw a useful error message instead of returning undefined, but that is something we can keep in mind when implementing this.)

@matthewmayer
Copy link
Contributor Author

matthewmayer commented Feb 9, 2023

I guess we could add an optional last_name_pattern.

That might be a alternative worth exploring. (We originally planned to remove all optional data access, so we could throw a useful error message instead of returning undefined, but that is something we can keep in mind when implementing this.)

i tried out this strategy in #1819

@ST-DDT ST-DDT added the c: bug Something isn't working label Feb 12, 2023
@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 c: locale Permutes locale definitions 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
3 participants