Skip to content

Commit

Permalink
add portuguese names
Browse files Browse the repository at this point in the history
  • Loading branch information
cieslarmichal committed Nov 17, 2023
1 parent cdeea6f commit 82f754d
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 12 deletions.
19 changes: 10 additions & 9 deletions include/faker-cxx/types/Country.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,26 @@ enum class Country
Brazil,
Norway,
Japan,
Portugal,
};

const std::vector<Country> countries{
Country::Usa, Country::England, Country::Poland, Country::Italy, Country::France, Country::Germany,
Country::Russia, Country::Romania, Country::India, Country::Finland, Country::Nepal, Country::Spain,
Country::Turkey, Country::Czech, Country::Slovakia, Country::Ukraine, Country::Denmark, Country::Sweden,
Country::Brazil, Country::Norway, Country::Japan,
};
Country::Brazil, Country::Norway, Country::Japan, Country::Portugal};

inline std::string toString(Country country)
{
std::map<Country, std::string> countryToStringMapping{
{Country::Usa, "Usa"}, {Country::England, "England"}, {Country::Poland, "Poland"},
{Country::Italy, "Italy"}, {Country::France, "France"}, {Country::Germany, "Germany"},
{Country::Russia, "Russia"}, {Country::Romania, "Romania"}, {Country::India, "India"},
{Country::Finland, "Finland"}, {Country::Nepal, "Nepal"}, {Country::Spain, "Spain"},
{Country::Turkey, "Turkey"}, {Country::Czech, "Czech"}, {Country::Slovakia, "Slovakia"},
{Country::Ukraine, "Ukraine"}, {Country::Denmark, "Denmark"}, {Country::Sweden, "Sweden"},
{Country::Brazil, "Brazil"}, {Country::Norway, "Norway"}, {Country::Japan, "Japan"},
{Country::Usa, "Usa"}, {Country::England, "England"}, {Country::Poland, "Poland"},
{Country::Italy, "Italy"}, {Country::France, "France"}, {Country::Germany, "Germany"},
{Country::Russia, "Russia"}, {Country::Romania, "Romania"}, {Country::India, "India"},
{Country::Finland, "Finland"}, {Country::Nepal, "Nepal"}, {Country::Spain, "Spain"},
{Country::Turkey, "Turkey"}, {Country::Czech, "Czech"}, {Country::Slovakia, "Slovakia"},
{Country::Ukraine, "Ukraine"}, {Country::Denmark, "Denmark"}, {Country::Sweden, "Sweden"},
{Country::Brazil, "Brazil"}, {Country::Norway, "Norway"}, {Country::Japan, "Japan"},
{Country::Portugal, "Portugal"},
};

return countryToStringMapping.at(country);
Expand Down
3 changes: 2 additions & 1 deletion src/modules/person/Person.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "data/nepal/NepalesePeopleNames.h"
#include "data/norway/NorwegianPeopleNames.h"
#include "data/poland/PolishPeopleNames.h"
#include "data/portugal/PortuguesePeopleNames.h"
#include "data/romania/RomanianPeopleNames.h"
#include "data/russia/RussianPeopleNames.h"
#include "data/slovakia/SlovakPeopleNames.h"
Expand Down Expand Up @@ -52,7 +53,7 @@ const std::map<Country, PeopleNames> countryToPeopleNamesMapping{
{Country::Ukraine, ukrainianPeopleNames}, {Country::Denmark, danishPeopleNames},
{Country::Sweden, swedishPeopleNames}, {Country::Usa, usaPeopleNames},
{Country::Brazil, brazilianPeopleNames}, {Country::Norway, norwegianPeopleNames},
{Country::Japan, japanesePeopleNames},
{Country::Japan, japanesePeopleNames}, {Country::Portugal, portuguesePeopleNames},
};

std::string middleNameForCountry(Country country, std::optional<Sex> sex);
Expand Down
5 changes: 3 additions & 2 deletions src/modules/person/PersonTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "data/nepal/NepalesePeopleNames.h"
#include "data/norway/NorwegianPeopleNames.h"
#include "data/poland/PolishPeopleNames.h"
#include "data/portugal/PortuguesePeopleNames.h"
#include "data/romania/RomanianPeopleNames.h"
#include "data/russia/RussianPeopleNames.h"
#include "data/slovakia/SlovakPeopleNames.h"
Expand Down Expand Up @@ -52,7 +53,7 @@ const std::map<Country, PeopleNames> countryToPeopleNamesMapping{
{Country::Ukraine, ukrainianPeopleNames}, {Country::Denmark, danishPeopleNames},
{Country::Sweden, swedishPeopleNames}, {Country::Usa, usaPeopleNames},
{Country::Brazil, brazilianPeopleNames}, {Country::Norway, norwegianPeopleNames},
{Country::Japan, japanesePeopleNames},
{Country::Japan, japanesePeopleNames}, {Country::Portugal, portuguesePeopleNames},
};

const std::map<Country, std::string> generatedTestName{
Expand All @@ -66,7 +67,7 @@ const std::map<Country, std::string> generatedTestName{
{Country::Ukraine, "shouldGenerateUkrainianName"}, {Country::Denmark, "shouldGenerateDanishName"},
{Country::Sweden, "shouldGenerateSwedishName"}, {Country::Usa, "shouldGenerateAmericanName"},
{Country::Brazil, "shouldGenerateBrazilianName"}, {Country::Norway, "shouldGenerateNorwegianName"},
{Country::Japan, "shouldGenerateJapaneseName"},
{Country::Japan, "shouldGenerateJapaneseName"}, {Country::Portugal, "shouldGeneratePortugueseName"},
};
}

Expand Down
33 changes: 33 additions & 0 deletions src/modules/person/data/portugal/PortugueseFirstNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma once

#include <string>
#include <vector>

namespace faker
{
const std::vector<std::string> portugueseMalesFirstNames = {
"Afonso", "Alexandre", "André", "Ângelo", "António", "Artur", "Benjamim", "Bernardo", "Bruno",
"Carlos", "César", "Cristiano", "Daniel", "David", "Dinis", "Diogo", "Duarte", "Edgar",
"Eduardo", "Elias", "Emanuel", "Fábio", "Feliciano", "Fernando", "Filipe", "Francisco", "Frederico",
"Gabriel", "Gaspar", "Gil", "Gonçalo", "Guilherme", "Gustavo", "Hélio", "Henrique", "Hugo",
"Igor", "Ígor", "Isac", "Ivan", "Ivo", "Jaime", "João", "Joaquim", "Jorge",
"José", "Josué", "Júlio", "Leandro", "Leonardo", "Lourenço", "Lucas", "Luís", "Manel",
"Manuel", "Marcelo", "Marco", "Marcos", "Mário", "Martim", "Mateus", "Matias", "Mauro",
"Micael", "Miguel", "Moisés", "Norberto", "Nuno", "Paulo", "Pedro", "Rafael", "Raul",
"Renato", "Ricardo", "Roberto", "Rodrigo", "Romeu", "Rúben", "Rui", "Salvador", "Samuel",
"Sandro", "Santiago", "Sebastião", "Sérgio", "Simão", "Tiago", "Tomás", "Tomé", "Valentim",
"Valter", "Vasco", "Vicente", "Vítor", "Xavier"};

const std::vector<std::string> portugueseFemalesFirstNames = {
"Adriana", "Alexandra", "Alice", "Amélia", "Ana", "Ariana", "Áurea", "Aurora", "Bárbara",
"Beatriz", "Benedita", "Bruna", "Caetana", "Camila", "Carla", "Carlota", "Carminho", "Carmo",
"Carolina", "Catarina", "Cecília", "Célia", "Clara", "Constança", "Daniela", "Débora", "Diana",
"Eduarda", "Elisa", "Ema", "Emília", "Érica", "Eva", "Fabiana", "Filipa", "Flor",
"Francisca", "Frederica", "Gabriela", "Helena", "Inês", "Irina", "Íris", "Isabel", "Jéssica",
"Joana", "Júlia", "Juliana", "Julieta", "Lara", "Laura", "Leonor", "Letícia", "Lia",
"Lorena", "Luana", "Luena", "Luísa", "Luna", "Madalena", "Mafalda", "Mara", "Márcia",
"Margarida", "Maria", "Mariana", "Marta", "Matilde", "Melissa", "Mia", "Miriam", "Natália",
"Nicole", "Núria", "Ofélia", "Olívia", "Paula", "Pilar", "Rafaela", "Raquel", "Rita",
"Rosa", "Safira", "Sara", "Sílvia", "Sofia", "Soraia", "Tatiana", "Teresa", "Valentina",
"Vânia", "Vera", "Vitória"};
}
21 changes: 21 additions & 0 deletions src/modules/person/data/portugal/PortugueseLastNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once

#include <string>
#include <vector>

namespace faker
{
const std::vector<std::string> portugueseLastNames = {
"Abreu", "Albuquerque", "Almeida", "Alves", "Amaral", "Amorim", "Andrade", "Anjos", "Antunes",
"Araújo", "Assunção", "Azevedo", "Baptista", "Barbosa", "Barros", "Batista", "Borges", "Braga",
"Branco", "Brito", "Campos", "Cardoso", "Carneiro", "Carvalho", "Castro", "Coelho", "Correia",
"Costa", "Cruz", "Cunha", "Domingues", "Esteves", "Faria", "Fernandes", "Ferreira", "Figueiredo",
"Fonseca", "Freitas", "Garcia", "Gaspar", "Gomes", "Gonçalves", "Guerreiro", "Henriques", "Jesus",
"Leal", "Leite", "Lima", "Lopes", "Loureiro", "Lourenço", "Macedo", "Machado", "Magalhães",
"Maia", "Marques", "Martins", "Matias", "Matos", "Melo", "Mendes", "Miranda", "Monteiro",
"Morais", "Moreira", "Mota", "Moura", "Nascimento", "Neto", "Neves", "Nobre", "Nogueira",
"Nunes", "Oliveira", "Pacheco", "Paiva", "Pereira", "Pinheiro", "Pinho", "Pinto", "Pires",
"Ramos", "Raposo", "Reis", "Ribeiro", "Rocha", "Rodrigues", "Santos", "Saraiva", "Silva",
"Simões", "Soares", "Sousa", "", "Tavares", "Teixeira", "Torres", "Valente", "Vaz",
"Vicente", "Vieira"};
}
18 changes: 18 additions & 0 deletions src/modules/person/data/portugal/PortuguesePeopleNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

#include "../NameFormats.h"
#include "../PeopleNames.h"
#include "PortugueseFirstNames.h"
#include "PortugueseLastNames.h"
#include "PortuguesePrefixes.h"

namespace faker
{
const NameFormats portuguesePersonNameFormats{{{"{prefix} {firstName} {lastName}", 1}, {"{firstName} {lastName}", 9}}};

const PeopleNames portuguesePeopleNames{
{portugueseMalesFirstNames, {}, portugueseLastNames, portugueseMalesPrefixes, {}},
{portugueseFemalesFirstNames, {}, portugueseLastNames, portugueseFemalesPrefixes, {}},
portuguesePersonNameFormats};

}
11 changes: 11 additions & 0 deletions src/modules/person/data/portugal/PortuguesePrefixes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

#include <string>
#include <vector>

namespace faker
{
const std::vector<std::string> portugueseMalesPrefixes{"Sr.", "Dr.", "Prof.", "Eng."};

const std::vector<std::string> portugueseFemalesPrefixes{"Sra.", "Dra.", "Prof.", "Eng."};
}

0 comments on commit 82f754d

Please sign in to comment.