Functions

Locales

The Use fake data method replaces a value with a generated value of the same label: a name, an address, a phone number, an identifier... Many labels can generate values for a specific language or country. This is the locale of the label.

For example, a location/phone field with the locale es-CL gets Chilean phone numbers, and with en-AU it gets Australian ones.

How the Locale Is Chosen

 Discovery                 Operation                    Generated value
 ---------                 ---------                    ---------------
 field "telefono"    ->    Use fake data            ->  +56 9 1234 5678
 label location/phone      label  location/phone
 locale es-CL              locale es-CL  (editable)
 type   mobile             type   mobile (editable)
  1. Discovery assigns a label to each field. The label can also carry the locale of the data (for example person/name with es-AR).
  2. In an anonymize or synthesize operation, the Use fake data method generates values for the field's label.
  3. Click the pen icon (✎) of the field to see the options (see Edit Function Options). The editor shows one selector per label option, named after the option:
    • locale: the locales the label supports (see the table below). It starts with the locale of the field's label, or en. If that locale is not in the list, the first locale of the list is selected.
    • type and format: only for the labels that have them.
  4. In custom functions, pass the locale as the second argument of genLabel. Without it, the locale is en_US. The Text format option (case) works with every locale:
genLabel('person/name', 'es-AR');
genLabel('location/phone', 'es-CL', { type: 'mobile' });
genLabel('location/city', 'pt_BR', { case: 'upper' });

Locale Codes

A locale is a language code, optionally followed by a country code:

CodeLanguage and country
en, en-USEnglish (United States)
en-GBEnglish (United Kingdom)
en-AUEnglish (Australia)
en-NZEnglish (New Zealand)
es, es-ESSpanish (Spain)
es-MXSpanish (Mexico)
es-ARSpanish (Argentina)
es-PESpanish (Peru)
es-ECSpanish (Ecuador)
es-CLSpanish (Chile)
es-CRSpanish (Costa Rica)
es-COSpanish (Colombia)
eu-ESBasque (Spain)
it, it-ITItalian
frFrench
pt, pt-BR, pt_BRPortuguese (Brazil)
de, de-DEGerman

Some labels list the locale with an underscore (pt_BR) and others with a hyphen (pt-BR), but both forms are the same locale: pt_BR, pt-BR and pt-br generate the same values in every label, in saved rules and in genLabel.

Locales per Label

LabelLocalesOther options
person/nameen, es, es-MX, eu-ES, es-AR, es-PE, es-EC, es-CL, en-AU, en-NZ, fr, ittype: first, last, full, last_first
person/sexen, es, frtype: full, abbr
location/addresses-ES, es-MX, es-AR, es-PE, es-EC, es-CL, it, en, pt_BR, fr, en-AU, en-NZ
location/cityes-ES, es-MX, es-AR, es-PE, es-EC, es-CL, it, en, pt_BR, fr, en-NZ
location/statees-ES, es-MX, es-AR, es-PE, es-EC, es-CL, it, en, pt_BR, fr, en-AU, en-NZtype: abbr, full
location/countryany, es-ES, es-MX, it, en, pt_BR, fr
location/nationalityen, es, it, pt
location/phonees-ES, es-MX, es-AR, es-PE, es-EC, es-CL, es-CR, it, en, pt-BR, fr, en-AU, en-NZtype and format, depending on the locale
location/zip_codede-DE, es-ES, es-MX, es-AR, es-PE, es-EC, es-CL, es-CR, en, it, pt-BR, fr, en-GB, en-AU, en-NZ
vehicle/plateen-AU, en-NZ, en-US, es-AR, es-CL, es-EC, es-ES, es-MX, es-PE
vehicle/fuel, vehicle/typesen, es, pt
flights/fareen, es, pt
general/colorsen, es, pt
business/order_statusen, es, pt
entertainment/movie/genreen, es, pt
business/departmentde, en, es, pt
business/job_titleen, es
datetime/weekdayen, es, pttype: abbr, full
identifier/cedula_identidades-CR, es-CO, es-AR, es-PEformat
identifier/driver_licenseit-IT, es-CL
identifier/passportes-CLformat: random, letter, numeric
finance/bank_accountes-CLtype: cuentarut, account
health/ficha_clinica, health/previsiones-CL
health/prevision_numberes-CLtype: tramo, afiliacion
finance/bsb, identifier/abn, identifier/tfn, identifier/medicareen-AU
identifier/irden-NZ

Country-Specific Labels

These labels always generate values of one country, so they have no locale:

CountryLabels
Spainidentifier/dni
Mexicoidentifier/nss, identifier/curp, identifier/rfc
Italyidentifier/cf
United Kingdomidentifier/nino, identifier/nhs
United Statesidentifier/ssn, identifier/dea
Chileidentifier/rut (format: ##.###.###-# or ########-#)
Ecuadoridentifier/cedula_ecuador (format: ########## or #########-#)

Locale Details

Names

LocaleSource
eu-ESBasque first and last names
es-AR, es-PE, es-EC, es-CL, en-NZNames of each country
en, en-AU, es, es-MX, fr, itGeneric name generator for the language

type selects first (first name), last (last name), full (first and last name) or last_first (last and first name).

Addresses, Cities and States

  • es-AR, es-PE, es-EC and es-CL use their own lists of streets, cities and regions. type abbr gives the region abbreviation.
  • en-NZ uses its own lists of streets, cities and regions. location/state always gives the full region name: there is no list of New Zealand region abbreviations, so type abbr is ignored.
  • location/city has no en-AU locale: there is no list of Australian cities.
  • The other locales use the generic generator for the language.
  • location/country with any gives the country names in English.

Phone Numbers

LocaletypeGenerated numbers
es-ESlandline, mobileLandlines start with 9 (format madrid: 91, eus/alava: 945). Mobiles start with 6
es-MXMexican area code + 7 digits
es-ARlandline, mobile10 digits with the area code. Mobiles add a leading 9 (11 digits)
es-PElandline, mobileLandlines with area code (######## or ####-####). Mobiles start with 9 (######### or ### ### ###)
es-EClandline, mobileLandlines with a province digit (######## or ####-####). Mobiles start with 09 (########## or ### ### ####)
es-CLlandline, mobile9 digits, or +56 # #### ####. Mobiles start with 9
es-CRlandline, mobile, mixed8 digits: ########, ####-#### or #### ####
en-AUlandline, mobileLandlines 0X## ### ### with the area code of Sydney, Melbourne, Brisbane or Perth (format). Mobiles 04## ### ###
en-NZlandline, mobileLandlines 0X ### #### with the area code of Auckland, Wellington or Christchurch (format). Mobiles 02X ### ####
it, en, pt-BR, frGeneric generator for the language, or format #########, ###-###-### or ## ### ## ##

Zip Codes

LocaleGenerated codes
es-AR4 digits
es-PE5 digits starting with a department code
es-EC6 digits: province, canton and parish
es-CL7 digits
es-CRReal Costa Rican postal codes
en-NZ4 digits, from 0110 to 9893
OthersGeneric generator for the country

Vehicle Plates

LocaleExamples
es-ES1234BCD
es-MXBCD-123-F
es-ARAB 123 CD or ABC 123
es-PEABC-123 or A1B-234
es-ECABC-1234
es-CLABCD-12 or AB-CD-12
en-AUAB-12-CD, ABC-123 or 123-ABC
en-NZABC123
OthersUS state abbreviation + 4 characters, for example CA7K2P

Identifiers

LabelLocaleGenerated values
identifier/cedula_identidades-CR9 digits: #.####.####, # #### ####, #-####-#### or ########
es-CO10 digits: #.###.###.###, # ### ### ###, #-###-###-### or ##########
es-AR7 or 8 digits: ##.###.###, ## ### ###, ##-###-###, ########, #.###.### or #######
es-PE8 digits
identifier/driver_licenseit-ITItalian driver license
es-CLA Chilean RUT (the license number is the holder's RUT)
identifier/passportes-CLletter: a letter + 8 digits. numeric: 8 or 9 digits
finance/bank_accountes-CLcuentarut: CuentaRUT account, the RUT without the check digit (7 or 8 digits). account: 8 to 12 digits
health/previsiones-CLFONASA, ISAPRE or AFP affiliation
health/prevision_numberes-CLtramo: FONASA bracket (Tramo A...). afiliacion: 6 to 10 digits

Language-Only Labels

vehicle/fuel, vehicle/types, flights/fare, location/nationality, general/colors, business/order_status, entertainment/movie/genre and person/sex only have a language (en, es, pt, it, fr). The values come in English when the generator has no list for that language. location/nationality has lists for es, pt and it. general/colors, business/order_status, entertainment/movie/genre and location/nationality also accept the language with a country (es-ES, pt-BR).

business/department, business/job_title and datetime/weekday use the generic generator for the language. pt gives Portuguese (Brazil) values.

Accents and Fallbacks

  • Generated text has its accents removed: José becomes Jose, and Begoña becomes Begona.
  • A locale whose language and country codes are the same (fr-FR, de-DE, it-IT) is used as the language (fr, de, it).
  • If the generic generator has no data for a country, it uses the language of the locale: es-CR uses es, and en-NZ uses en.
  • If it has no data for a language alone, it uses the first country of the language: pt uses pt-BR.
  • If the locale is empty or the generic generator has no data for its language (for example eu-ES), en is used. A value never takes the language of the previous value.

See Also