Faker.js: DE - streetName(), streetAddress(), streetSuffix() return street names from EN locale

Created on 1 Jul 2018  路  9Comments  路  Source: Marak/faker.js

I've tested a few other german methods (faker.address.country, faker.address.state, faker.address.firstName, faker.address.lastName, ...) which all seem to work properly, it's only the street address methods that seem to fallback to the english locale. As there hasn't been a commit to these files in the last three years, I suspect something else is going wrong here...

Bug Will Fix

All 9 comments

This can even be checked using the faker.hook.io instance:
http://faker.hook.io/?property=address.streetName&locale=de

As you can see, it returns street addresses from the en locale.

If you have tests which you've run that are failing please add the failing tests to the project in a PR and we can see about fixing the API if it's not working as intended.

Writing tests for this case would mean writing tests for all locale implementations which I guess isn't what you want. The way I quickly verified this was by doing curl http://faker.hook.io/?property=address.streetName&locale=de and grepping the second word in the english city suffixes, which matches every time. This, and the street format is <num> <street> instead of <street> <num>.

We'll need a failing test in order to fix what you are reporting.

Please submit a PR including reproducible code of the problem or a potential code fix for the problem.

Thanks!

I've submitted the PR that highlights the problem in a test as you requested, even though I've got no clue on fixing it without digging further into the code.

Localities in faker will fallback to english if the selected locality doesn't have locale data for that specific language.

Have you tried checking the locales folder to see what might be missing for German? It's possible we'll need to add the missing data, any help would be appreciated.

I know a bit of German, so I should be able to review the changes. Auch, Das Leben ist kein Ponyhof.

Related #133 #645 #337 #232

Related: https://github.com/Marak/faker.js/blob/master/lib/address.js#L109

I think the issue is that the address module isn't using any of the custom formatting strings we previously didn't have available. It's the same issue across a few other API methods and localities.

It might just be a matter of making sure address can use data like https://github.com/Marak/faker.js/blob/master/lib/locales/de/address/street_address.js in formatting address strings.

I'm currently working on some other parts of our application but I'll try to check as soon as possible... Thank you for the investigation!

@Marak can you maybe point out any points in the code where the definitions from the locales folder are currently being interpolated? I could not find any place in which the #{<reference>} references are interpolated when looking at this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blackshady picture blackshady  路  4Comments

chenweiyj picture chenweiyj  路  4Comments

JeffBeltran picture JeffBeltran  路  5Comments

marcelorl picture marcelorl  路  4Comments

jamesbrucepower picture jamesbrucepower  路  6Comments