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

city does not return localized city name #983

Closed
rosnk opened this issue May 22, 2022 · 2 comments · Fixed by #992
Closed

city does not return localized city name #983

rosnk opened this issue May 22, 2022 · 2 comments · Fixed by #992
Labels
c: locale Permutes locale definitions good first issue Good for newcomers has workaround Workaround provided or linked p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug

Comments

@rosnk
Copy link

rosnk commented May 22, 2022

Describe the bug

has set localized value to "en_CA" and i want city to return based on canada, to be more precise i would love to have city return based on province i have choosen.

Currently i am getting province from canada but city is returning USA cities.

Reproduction

import { faker } from "@faker-js/faker";
faker.setLocale("en_CA");

const province = faker.address.state(); //this gives canadian province
const city = faker.address.cityName(); //but this does not give canadian cities

console.log(province);
console.log(city);

Additional Info

No response

@rosnk rosnk added the s: pending triage Pending Triage label May 22, 2022
@ST-DDT
Copy link
Member

ST-DDT commented May 22, 2022

Currently en_CA does not have city names (city_name.ts) so the en fallback is used:

const address: AddressDefinitions = {
city,
default_country,
postcode,
state,
state_abbr,
street,
};

If you want Canadian city names you have to create a PR and provide us with a list of some.

@ST-DDT ST-DDT added good first issue Good for newcomers p: 1-normal Nothing urgent c: locale Permutes locale definitions and removed s: pending triage Pending Triage labels May 22, 2022
@ST-DDT ST-DDT added this to the v7 - Current Major milestone May 22, 2022
@ST-DDT ST-DDT added the has workaround Workaround provided or linked label May 22, 2022
@ST-DDT
Copy link
Member

ST-DDT commented May 22, 2022

Until we can add them/merge that PR you can set them yourself:
faker.definitions.en_CA.address.city_name = [...] for faker.address.cityName()
But please consider creating a PR (or just giving us that list).

@ST-DDT ST-DDT added the s: accepted Accepted feature / Confirmed bug label May 22, 2022
wingleungchoi pushed a commit to wingleungchoi/faker that referenced this issue May 24, 2022
Shinigami92 pushed a commit that referenced this issue May 24, 2022
Co-authored-by: Wing Leung Choi <wchoi@and.digital>
Minozzzi pushed a commit to Minozzzi/faker that referenced this issue Jul 19, 2022
Co-authored-by: Wing Leung Choi <wchoi@and.digital>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: locale Permutes locale definitions good first issue Good for newcomers has workaround Workaround provided or linked p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants