Skip to content

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

Draft
morgz wants to merge 2 commits into
vadymmarkov:masterfrom
morgz:master
Draft

Add ability to load a file from local bundle instead#137
morgz wants to merge 2 commits into
vadymmarkov:masterfrom
morgz:master

Conversation

@morgz
Copy link
Copy Markdown

@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.

1 participant