bchavez / Bogus

:card_index: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.
Other
8.73k stars 496 forks source link

First and Full names are incorrectly generated with locale "sv" #503

Closed RexTremendae closed 9 months ago

RexTremendae commented 1 year ago

Version Information

Software Version(s)
Bogus NuGet Package 34.0.2
.NET Core? 7.0.401
.NET Full Framework?
Windows OS? 11
Linux OS?
Visual Studio?

What locale are you using with Bogus?

sv

What is the expected behavior?

When using Swedish locale, Swedish names are expected to be generated.

What is the actual behavior?

Names listed in the swedish locale json file are these: "first_name_women": ["Astrid","Anna","Alice","Amanda","Ann","Agneta","Anette","Anneli","Alexandra","Agnes","Anne","Alva","Alma","Angelica","Ann-Marie","Maria","Margareta","Elisabeth","Eva","Birgitta","Kristina","Karin","Elisabet","Marie","Lotta","Ronja","Veronica"], "first_name_men": ["Erik","Lars","Karl","Anders","Per","Johan","Nils","Lennart","Emil","Hans"], "last_name": ["Johansson","Andersson","Karlsson","Nilsson","Eriksson","Larsson","Olsson","Persson","Svensson","Gustafsson"]

Example of generated names: Sincere Karlsson Scarlett Svensson Quinten Gustafsson

Please provide a stack trace.

Any possible solutions?

How do you reproduce the issue?

var fkr = new Faker("sv"); Console.WriteLine(fkr.Name.FullName()); Console.WriteLine($"{fkr.Name.FirstName()} {fkr.Name.LastName()}");

Do you have a unit test that can demonstrate the bug?

No, but see sample code above.

Can you identify the location in Bogus' source code where the problem exists?

No, I don't really understand how the locale data is selected.

If the bug is confirmed, would you be willing to submit a PR?

Yes

bchavez commented 12 months ago

Seems the sv locale is using name.first_name_women vs the standard name.female_first_name (which is what Bogus is looking for):

So that's why female names aren't being picked up. I'll have to check if this is fixed in the upstream version of faker.js.

bchavez commented 9 months ago

@RexTremendae and @EBD232 ,

New release Bogus v35.0.1 - https://www.nuget.org/packages/Bogus/35.0.1

Thanks again for the PR @EBD232