Closed drma-tech closed 3 years ago
There were some changes to the pt_BR
locale in the most recent locale update from faker.js
. Please see: https://github.com/Marak/faker.js/pull/966
If you think these changes are in error, please let the upstream maintainer know or perhaps reach out to the PR contributor to revert any changes.
As little as I could understand, it is standard to return names of people, but the prefix and suffix of cities helped to look like city names, but as it was taken away, then it was just the name of people.
module["exports"] = [
"#{city_prefix} #{Name.first_name}#{city_suffix}",
"#{city_prefix} #{Name.first_name}",
"#{Name.first_name}#{city_suffix}",
"#{Name.last_name}#{city_suffix}"
];
Hi @drma-dev,
Thank you for the response. You are correct. I think @vivianeflowt removed the city_prefix
and city_suffix
in faker.js with PR 966 here: https://github.com/Marak/faker.js/pull/966
She mentions that city prefix and suffix are not used in Brazil for city names. The PR was merged into faker.js; so Bogus follows the merge too.
I do not live in Brazil. I do not know what is more accurate for Brazil. It might be helpful to discuss with @vivianeflowt or others in Brazil regarding the PR to help find a resolution.
We can revert the PR, but we need to know what is more correct for Brazil: with prefix/suffix or without prefix/suffix. Alternatively, we can look into using an actual list of real Brazil city names instead but we would diverge from faker.js.
I need help from someone in Brazil :brazil: that understands the area because I don't know what to do. I live in the USA :us:. :confused:
I don't think it matters anymore. I thought I was being listed real names of cities, but it was just an ugly hack. So leave it at that.
Hi @drma-dev, ok no problem. Correct. Bogus and faker.js never used real city names. City names were derived from an internal name list.
Also, if you need more accurate country/place data, you might want to look at Simon Cropp's Bogus data extensions here: https://github.com/SimonCropp/CountryData
void Main()
{
var br = CountryData.CountryLoader.LoadBrazilLocationData();
var personFaker = new Faker<User>()
.RuleFor(p => p.State, f => f.Country().Brazil().State().Name);
personFaker.Generate(10).Dump();
}
public class User{
public string State{get;set;}
}
Hope that helps, Brian
Re: #328
@drma-dev , try v32.0.2: https://www.nuget.org/packages/Bogus/32.0.2
void Main()
{
var faker = new Faker("pt_BR");
faker.Address.City().Dump();
}
This should resolve the issue with pt_BR
city names. Using the top 100 cities in BR: https://en.wikipedia.org/wiki/List_of_cities_in_Brazil_by_population
I'd rather having the old city name generator with prefixes and suffixes for pt_BR
. The new one is buggy:
And replacing undefined
with ""
(emtpy string) would make address.city
to return just plain names.
Yeah, one of our contributors for pt_BR
seems to have removed some city data that probably should have stayed.
We'll add it back so we don't get undefined
errors in faker.js