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

Add ability to load a file from local bundle instead #137

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

morgz
Copy link

@morgz morgz commented Jun 19, 2020

Using this library with SPM will not bring in the resources (those lovely little json files)

I've added an alternative initializer where you can specify a path.

e.g

let locale = "en"
let stringPath = Bundle.main.path(forResource: locale, ofType: "json")
let faker = Faker(locale: locale, path: stringPath!)

BEFORE this is considered merge worthy...

  • Can only load base translation files: 'en, es, ru, etc...' Trying to load a .json with "-" will fail (en-GB) I couldn't be bothered yet to step through the parser to find where it loads the "en" after loading the extras from "en-gb"
  • I added some simple tests but better if the creator can review and amend to properly cover.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant