Skip to content

Commit

Permalink
Merge pull request #130 from ropensci/feat/rearrange_locale
Browse files Browse the repository at this point in the history
Inherit from providers in stead of dynamic loading
  • Loading branch information
RMHogervorst authored Oct 21, 2023
2 parents bc2aba0 + 99cda9f commit 5ed2ed5
Show file tree
Hide file tree
Showing 369 changed files with 25,098 additions and 7,618 deletions.
5 changes: 5 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ appveyor.yml
^codemeta\.json$
^revdep$
^Makefile$
^todo.md$
^data-raw$
^doc$
^Meta$
^inst\examples$
.git
9 changes: 8 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@

* Submit an issue on the [Issues page](https://github.com/ropensci/charlatan/issues)

### Choose a task
Look in the [Contributing to charlatan](https://github.com/ropensci/charlatan/blob/master/vignettes/contributing.Rmd) vignette for details if you're adding a new provider or locale.
Find one of the open issues labelled with #helpwanted or any other if you want.

### Code contributions

Check out the [Contributing to charlatan](https://github.com/ropensci/charlatan/blob/master/vignettes/contributing.Rmd) vignette for details if you're adding a new provider or locale.

* please first open an issue if you want to add something, we can discuss the way forward from there.
* Fork this repo to your Github account
* Clone your version on your account down to your machine from your account, e.g,. `git clone https://github.com/<yourgithubusername>/charlatan.git`
* Make sure to track progress upstream (i.e., on our version of `charlatan` at `ropensci/charlatan`) by doing `git remote add upstream https://github.com/ropensci/charlatan.git`. Before making changes make sure to pull changes in from upstream by doing either `git fetch upstream` then merge later or `git pull upstream` to fetch and merge in one step
* Make your changes (bonus points for making changes on a new feature branch)
* Push up to your account
* Submit a pull request to home base (likely master branch, but check to make sure) at `ropensci/charlatan`

### Also, check out our [discussion forum](https://discuss.ropensci.org)
### Community

Also, check out our [discussion forum](https://discuss.ropensci.org)
7 changes: 4 additions & 3 deletions .github/workflows/R-check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
on: [push, pull_request]
on: [pull_request]

name: R-check

Expand All @@ -13,8 +13,9 @@ jobs:
matrix:
config:
- { os: windows-latest, r: 'latest'}
- { os: ubuntu-20.04, r: 'latest'}
- { os: ubuntu-20.04, r: 'devel'}
- { os: ubuntu-22.04, r: 'latest'}
- { os: ubuntu-22.04, r: 'devel'}
- { os: macOS-latest, r: 'latest'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
revdep/checks.noindex
revdep/data.sqlite
revdep/library.noindex
/doc/
/Meta/
inst/doc
todo.md
28 changes: 21 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Package: charlatan
Type: Package
Title: Make Fake Data
Description: Make fake data, supporting addresses, person names, dates,
Description: Make fake data that looks realistic, supporting addresses,
person names, dates,
times, colors, coordinates, currencies, digital object identifiers
('DOIs'), jobs, phone numbers, 'DNA' sequences, doubles and integers
from distributions and within a range.
Version: 0.5.1
Version: 0.6.0
Authors@R: c(
person("Roel M.", "Hogervorst",
email ="hogervorst.rm@gmail.com",
Expand Down Expand Up @@ -41,17 +42,21 @@ Suggests:
knitr,
rmarkdown,
ipaddress,
stringi
RoxygenNote: 7.2.2
stringi,
spelling
RoxygenNote: 7.2.3
Depends:
R (>= 2.10)
Collate:
'address-provider-en_GB.R'
'address-provider-en_NZ.R'
'address-provider-en_US.R'
'address-provider-nl_NL.R'
'base-provider.R'
'datetime-provider.R'
'address-provider.R'
'available_locales.R'
'available_providers.R'
'base-provider.R'
'charlatan-package.R'
'charlatan_settings.R'
'color-provider-en_US.R'
Expand Down Expand Up @@ -89,6 +94,7 @@ Collate:
'internet-provider-de_DE.R'
'internet-provider-en_AU.R'
'internet-provider-en_NZ.R'
'internet-provider-en_US.R'
'internet-provider-fa_IR.R'
'internet-provider-fr_FR.R'
'internet-provider-hr_HR.R'
Expand All @@ -107,6 +113,7 @@ Collate:
'jobs-provider-uk_UA.R'
'jobs-provider-zh_TW.R'
'jobs-provider.R'
'languages.R'
'lorem-provider-ar_AA.R'
'lorem-provider-el_GR.R'
'lorem-provider-en_US.R'
Expand Down Expand Up @@ -149,14 +156,21 @@ Collate:
'person-provider-no_NO.R'
'person-provider-pl_PL.R'
'person-provider.R'
'phone-number-provider-all.R'
'phone_number.R'
'phonenumbers-provider.R'
'phonenumber-provider-en.R'
'phonenumber-provider-es.R'
'phonenumber-provider-fr.R'
'phonenumber-provider-nl.R'
'phonenumber-provider-rest.R'
'phonenumber-provider.R'
'sequence-provider.R'
'sequences.R'
'ssn-provider-all.R'
'ssn-provider.R'
'ssn.R'
'taxonomy-provider-all.R'
'taxonomy-provider.R'
'taxonomy.R'
'useragent-provider-all.R'
'useragent-provider.R'
'zzz.R'
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ locales_update:
# No real targets!
.PHONY: all test doc install

vignettes:
${RSCRIPT} -e "devtools::build_vignettes()"

style:
${RSCRIPT} -e "styler:::style_active_pkg()"
cov:
${RSCRIPT} -e "covr::package_coverage()"
cloc:
${RSCRIPT} -e "cloc::cloc('R')"
spellcheck:
${RSCRIPT} -e "devtools::spell_check()"

Expand Down
122 changes: 121 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,29 +1,148 @@
# Generated by roxygen2: do not edit by hand

export(AddressProvider)
export(AddressProvider_en_GB)
export(AddressProvider_en_NZ)
export(AddressProvider_en_US)
export(AddressProvider_nl_NL)
export(BaseProvider)
export(ColorProvider)
export(ColorProvider_en_US)
export(ColorProvider_uk_UA)
export(CompanyProvider)
export(CompanyProvider_bg_BG)
export(CompanyProvider_cs_CZ)
export(CompanyProvider_de_DE)
export(CompanyProvider_en_US)
export(CompanyProvider_es_MX)
export(CompanyProvider_fa_IR)
export(CompanyProvider_fr_FR)
export(CompanyProvider_hr_HR)
export(CompanyProvider_it_IT)
export(CoordinateProvider)
export(CreditCardProvider)
export(CurrencyProvider)
export(DOIProvider)
export(DateTimeProvider)
export(ElementProvider)
export(ElementProvider_en_US)
export(ElementProvider_nl_NL)
export(FileProvider)
export(FileProvider_en_US)
export(FraudsterClient)
export(InternetProvider)
export(InternetProvider_bg_BG)
export(InternetProvider_cs_CZ)
export(InternetProvider_de_DE)
export(InternetProvider_en_AU)
export(InternetProvider_en_NZ)
export(InternetProvider_en_US)
export(InternetProvider_fa_IR)
export(InternetProvider_fr_FR)
export(InternetProvider_hr_HR)
export(JobProvider)
export(JobProvider_da_DK)
export(JobProvider_en_US)
export(JobProvider_fa_IR)
export(JobProvider_fi_FI)
export(JobProvider_fr_CH)
export(JobProvider_fr_FR)
export(JobProvider_hr_HR)
export(JobProvider_nl_NL)
export(JobProvider_pl_PL)
export(JobProvider_ru_RU)
export(JobProvider_uk_UA)
export(JobProvider_zh_TW)
export(LoremProvider)
export(LoremProvider_ar_AA)
export(LoremProvider_el_GR)
export(LoremProvider_en_US)
export(LoremProvider_he_IL)
export(LoremProvider_ja_JP)
export(LoremProvider_la)
export(LoremProvider_ru_RU)
export(LoremProvider_zh_CN)
export(LoremProvider_zh_TW)
export(MiscProvider)
export(MissingDataProvider)
export(NumericsProvider)
export(PersonProvider)
export(PersonProvider_bg_BG)
export(PersonProvider_cs_CZ)
export(PersonProvider_da_DK)
export(PersonProvider_de_AT)
export(PersonProvider_de_DE)
export(PersonProvider_en_GB)
export(PersonProvider_en_NZ)
export(PersonProvider_en_US)
export(PersonProvider_es_ES)
export(PersonProvider_es_MX)
export(PersonProvider_fa_IR)
export(PersonProvider_fi_FI)
export(PersonProvider_fr_CH)
export(PersonProvider_fr_FR)
export(PersonProvider_hr_HR)
export(PersonProvider_it_IT)
export(PersonProvider_ja_JP)
export(PersonProvider_ko_KR)
export(PersonProvider_lt_LT)
export(PersonProvider_lv_LV)
export(PersonProvider_ne_NP)
export(PersonProvider_nl_NL)
export(PersonProvider_no_NO)
export(PersonProvider_pl_PL)
export(PhoneNumberProvider)
export(PhoneNumberProvider_bg_BG)
export(PhoneNumberProvider_bs_BA)
export(PhoneNumberProvider_cs_CZ)
export(PhoneNumberProvider_da_DK)
export(PhoneNumberProvider_de_DE)
export(PhoneNumberProvider_dk_DK)
export(PhoneNumberProvider_el_GR)
export(PhoneNumberProvider_en_AU)
export(PhoneNumberProvider_en_CA)
export(PhoneNumberProvider_en_GB)
export(PhoneNumberProvider_en_NZ)
export(PhoneNumberProvider_en_US)
export(PhoneNumberProvider_es_ES)
export(PhoneNumberProvider_es_MX)
export(PhoneNumberProvider_es_PE)
export(PhoneNumberProvider_fa_IR)
export(PhoneNumberProvider_fi_FI)
export(PhoneNumberProvider_fr_CH)
export(PhoneNumberProvider_fr_FR)
export(PhoneNumberProvider_he_IL)
export(PhoneNumberProvider_hi_IN)
export(PhoneNumberProvider_hr_HR)
export(PhoneNumberProvider_hu_HU)
export(PhoneNumberProvider_id_ID)
export(PhoneNumberProvider_it_IT)
export(PhoneNumberProvider_ja_JP)
export(PhoneNumberProvider_ko_KR)
export(PhoneNumberProvider_lt_LT)
export(PhoneNumberProvider_lv_LV)
export(PhoneNumberProvider_ne_NP)
export(PhoneNumberProvider_nl_BE)
export(PhoneNumberProvider_nl_NL)
export(PhoneNumberProvider_nn_NO)
export(PhoneNumberProvider_no_NO)
export(PhoneNumberProvider_pl_PL)
export(PhoneNumberProvider_pt_BR)
export(PhoneNumberProvider_pt_PT)
export(PhoneNumberProvider_ru_RU)
export(PhoneNumberProvider_sk_SK)
export(PhoneNumberProvider_sv_SE)
export(PhoneNumberProvider_th_TH)
export(PhoneNumberProvider_tr_TR)
export(PhoneNumberProvider_uk_UA)
export(PhoneNumberProvider_zh_TW)
export(SSNProvider)
export(SSNProvider_en_US)
export(SSNProvider_nl_NL)
export(SequenceProvider)
export(TaxonomyProvider)
export(TaxonomyProvider_en_US)
export(UserAgentProvider)
export(UserAgentProvider_en_US)
export(ch_beta)
export(ch_color_name)
export(ch_company)
Expand Down Expand Up @@ -63,6 +182,7 @@ export(ch_unix_time)
export(charlatan_locales)
export(charlatan_settings)
export(fraudster)
export(subclass)
importFrom(R6,R6Class)
importFrom(tibble,as_tibble)
importFrom(whisker,whisker.render)
57 changes: 57 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,60 @@



charlatan 0.6.0
===============
This release changes the internal logic of the package to make it easier for you to contribute.
One of the greatest strengths of charlatan, _and its spirit brothers faker (in python) and faker (in perl),_ is
the ability to customize realistically looking data in many locales.
But it was not so easy to add locales that were very different from en_US.
This release aims to make it easier for you to add new locales for your favorite
data types.

## Detailed
Previous versions of {charlatan} used special logic to load in locale-specific
data, and this worked great, but requires every locale to use the same naming
conventions and required a lot of work across all locales of that provider
if you only needed that change for one locale.

Since version 0.6.0, locale specific Providers inherit from
a **Parent provider** with basic functionality for that Provider type,
and more specific functions for a locale are moved into that locale.
For example, if you are Spongebob Squarepants, and all of your addresses are
required to have a fruit in the street name, this is now possible by
overriding the address function for the spongebob squarepants locale only.
See the revamped `contributing` vignette for more info.


### NEW FEATURES
* Added a new vignette with more detailed examples of data simulation.
* A new baseclass `BareProvider` creates all of the selection and fill-in functions.
* The `BaseProvider` inherits from the `BareProvider` and provides locale specific functionality. Functionality of BaseProvider remains the same.
* All **Parent providers** will error when you try to init them.
* Locales inherit from a **Parent provider**, giving us the ability to customize
every locale (when needed) without changing the logic for all locales.
* Every provider (when it has locales) has at least an en_US locale.
* Ability to create specific functions for your locale specific provider. Example: Are first and last names not used in your locale? you can now create specific functions for your locale. Example: the Japanese locale now has first_kana_name _(for example ヒロキ)_, last_kana_name functionality next to the romanized names.
* all locales have labels so they are connected in the docs. You can now see all NZ Providers in one overview.


### REMOVED
* Removed the siren functionality from CompanyProvider (it was only used in the fr_FR locale and we can provide phone numbers with the PhoneProvider.

### MINOR IMPROVEMENTS
* All locale specific Providers fall back to locale `en_US` if there is no version of this locale provider and will warn you if they do.
* Reworked development vignette
* added locale-templates for addresses, colors, company, internet, job, lorem,person, phonenumber and ssn.
* added the following functionality to fraudster: `address`, `company`, `element`, `element_symbol`, `file_name`, `email`, `url`, `mac_address`, `lorem_paragraph`, `ssn`
* add print method so the providers print nicely in the console.
* All data fields are moved to `private` to reduce visual clutter.
* Added docs for languages like `czech-language` `turkish-language`.

### BUG FIXES
* None




charlatan 0.5.1
===============

Expand Down
Loading

0 comments on commit 5ed2ed5

Please sign in to comment.