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.
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.
BareProvider
creates all of the
selection and fill-in functions.BaseProvider
inherits from the
BareProvider
and provides locale specific functionality.
Functionality of BaseProvider remains the same.en_US
if there is no version of this locale provider and will warn you if they
do.address
, company
, element
,
element_symbol
, file_name
, email
,
url
, mac_address
,
lorem_paragraph
, ssn
private
to reduce visual
clutter.czech-language
turkish-language
.InternetProvider
adds new methods ipv4
and
ipv6
via the new suggested package ipaddress
(#112) thanks @davidchallAddressProvider
and JobsProvider
gain new
langugage locale nl_NL
(#118) (#119) thanks @markbaasInternetProvider
gains new method slug
(#67)MiscProvider
gains two new methods boolean
and null_boolean
(#70)es_PE
locale support added to
PhoneNumberProvider
(#108)en_NZ
locale support added to
AddressProvider
, InternetProvider
, and
PersonProvider
(#109)MissingDataProvider
thanks to @KKulma (#110)PhoneNumberProvider
gains support for locales:
dk_DK
, en_NZ
, id_ID
,
th_TH
, and tw_GH
(#100)allowed_locales()
-
the exported character vector of allowed locales for each provider has
moved inside of the R6 class in $private
because there’s no
reason for the user to modify allowed locales -
allowed_locales()
reads this vector for each providerch_job()
and JobsProvider
gains
da_DK
locale support (#94) from @MartinMSPedersenPersonProvider
for locale fr_FR
:
fix accents; avoid awkward french names; now can do double first names;
removed some duplicate names (#35) (#83) from @kylevoytoJobsProvider
and PersonProvider
where found; and remove some blank
suffixes for fa_IR
PersonProvider
(#88) (#91)
from @kylevoytoxx_XX
where first two letters are lowercase and second two are uppercase (#90)
from @kylevoytodk_DK
to
da_DK
to comply with ISO-3166 (#93) from @MartinMSPedersenPersonProvider
for various locales (#96) from @MartinMSPederseniptools
and stringi
(#82)ElementsProvider
and associated methods
ch_element_element()
and ch_element_symbol()
for getting element names and symbols (#55)InternetProvider
with many methods, including for
domain names, urls (and their parts), emails, tld’s, etc. (#66)MiscProvider
with methods for getting locale
names and locale codes (#69)UserAgentProvider
for user agent strings
(#57)FileProvider
with methods for mime type, file
extension, file names and paths (#59)LoremProvider
with methods for words, sentences
and paragraphs (#58)JobProvider
gains Finnish locale (#79)PersonProvider
for locale en_GB
- we
were ignoring probabilities of different names (#63) (#75)ColorProvider
: generate only the 216 colors in safe
web colors (https://en.wikipedia.org/wiki/Web_colors#Web-safe_colors) -
and fix method for generating hex colors (#18) (#42) (#76)safe_color_name
within
ColorProvider
be sensitive to locale (#17) (#77)stringi
and iptools
moved from
Imports to Suggests - not required for package use now unless a few
specific methods used (#71)AddressProvider
gains methods street_name
,
street_address
, postcode
, and
address
. in addition, various fixes to
AddressProvider
(#62) (#80)