Skip to content

Commit

Permalink
feat::Add multilanguage sexes (Issue #251) 101c
Browse files Browse the repository at this point in the history
  • Loading branch information
qmohitsingh committed Nov 24, 2023
1 parent cdb910d commit 5fbcd1d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 36 deletions.
37 changes: 1 addition & 36 deletions include/faker-cxx/types/Sex.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,7 @@ enum class Sex
Female,
};

const std::map<Language, std::map<Sex, std::string>> sexTranslations = {
{Language::English, {{Sex::Male, "Male"}, {Sex::Female, "Female"}}},
{Language::Polish, {{Sex::Male, "Mężczyzna"}, {Sex::Female, "Kobieta"}}},
{Language::Italian, {{Sex::Male, "Maschio"}, {Sex::Female, "Femmina"}}},
{Language::French, {{Sex::Male, "Homme"}, {Sex::Female, "Femme"}}},
{Language::German, {{Sex::Male, "Mann"}, {Sex::Female, "Frau"}}},
{Language::Russian, {{Sex::Male, "Мужчина"}, {Sex::Female, "Женщина"}}},
{Language::Romanian, {{Sex::Male, "Bărbat"}, {Sex::Female, "Femeie"}}},
{Language::Hindi, {{Sex::Male, "पुरुष"}, {Sex::Female, "महिला"}}},
{Language::Finnish, {{Sex::Male, "Mies"}, {Sex::Female, "Nainen"}}},
{Language::Nepali, {{Sex::Male, "पुरुष"}, {Sex::Female, "महिला"}}},
{Language::Spanish, {{Sex::Male, "Hombre"}, {Sex::Female, "Mujer"}}},
{Language::Turkish, {{Sex::Male, "Erkek"}, {Sex::Female, "Kadın"}}},
{Language::Czech, {{Sex::Male, "Muž"}, {Sex::Female, "Žena"}}},
{Language::Slovak, {{Sex::Male, "Muž"}, {Sex::Female, "Žena"}}},
{Language::Ukrainian, {{Sex::Male, "Чоловік"}, {Sex::Female, "Жінка"}}},
{Language::Danish, {{Sex::Male, "Mand"}, {Sex::Female, "Kvinde"}}},
{Language::Swedish, {{Sex::Male, "Man"}, {Sex::Female, "Kvinna"}}},
{Language::Portuguese, {{Sex::Male, "Homem"}, {Sex::Female, "Mulher"}}},
{Language::Norwegian, {{Sex::Male, "Mann"}, {Sex::Female, "Kvinne"}}},
{Language::Japanese, {{Sex::Male, "男性"}, {Sex::Female, "女性"}}},
{Language::Hungarian, {{Sex::Male, "Férfi"}, {Sex::Female, ""}}},
{Language::Croatian, {{Sex::Male, "Muškarac"}, {Sex::Female, "Žena"}}},
{Language::Greek, {{Sex::Male, "Άνδρας"}, {Sex::Female, "Γυναίκα"}}},
{Language::Slovene, {{Sex::Male, "Moški"}, {Sex::Female, "Ženska"}}},
{Language::Dutch, {{Sex::Male, "Man"}, {Sex::Female, "Vrouw"}}},
{Language::Mandarin, {{Sex::Male, ""}, {Sex::Female, ""}}},
{Language::Korean, {{Sex::Male, "남자"}, {Sex::Female, "여자"}}},
{Language::Serbian, {{Sex::Male, "Мушкарац"}, {Sex::Female, "Жена"}}},
{Language::Macedonian, {{Sex::Male, "Маж"}, {Sex::Female, "Жена"}}},
{Language::Albanian, {{Sex::Male, "Mashkull"}, {Sex::Female, "Femër"}}},
{Language::Latvian, {{Sex::Male, "Vīrietis"}, {Sex::Female, "Sieviete"}}},
{Language::Belarusian, {{Sex::Male, "Мужчына"}, {Sex::Female, "Жанчына"}}},
{Language::Estonian, {{Sex::Male, "Mees"}, {Sex::Female, "Naine"}}},
{Language::Irish, {{Sex::Male, "fireannach"}, {Sex::Female, "baineann"}}}
};
const std::map<Language, std::map<Sex, std::string>> sexTranslations;

inline std::string translateSex(Sex sex, Language language = Language::English)
{
Expand Down
41 changes: 41 additions & 0 deletions src/modules/sex/Sex.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include "faker-cxx/types/Sex.h"

namespace faker
{
const std::map<Language, std::map<Sex, std::string>> sexTranslations = {
{Language::English, {{Sex::Male, "Male"}, {Sex::Female, "Female"}}},
{Language::Polish, {{Sex::Male, "Mężczyzna"}, {Sex::Female, "Kobieta"}}},
{Language::Italian, {{Sex::Male, "Maschio"}, {Sex::Female, "Femmina"}}},
{Language::French, {{Sex::Male, "Homme"}, {Sex::Female, "Femme"}}},
{Language::German, {{Sex::Male, "Mann"}, {Sex::Female, "Frau"}}},
{Language::Russian, {{Sex::Male, "Мужчина"}, {Sex::Female, "Женщина"}}},
{Language::Romanian, {{Sex::Male, "Bărbat"}, {Sex::Female, "Femeie"}}},
{Language::Hindi, {{Sex::Male, "पुरुष"}, {Sex::Female, "महिला"}}},
{Language::Finnish, {{Sex::Male, "Mies"}, {Sex::Female, "Nainen"}}},
{Language::Nepali, {{Sex::Male, "पुरुष"}, {Sex::Female, "महिला"}}},
{Language::Spanish, {{Sex::Male, "Hombre"}, {Sex::Female, "Mujer"}}},
{Language::Turkish, {{Sex::Male, "Erkek"}, {Sex::Female, "Kadın"}}},
{Language::Czech, {{Sex::Male, "Muž"}, {Sex::Female, "Žena"}}},
{Language::Slovak, {{Sex::Male, "Muž"}, {Sex::Female, "Žena"}}},
{Language::Ukrainian, {{Sex::Male, "Чоловік"}, {Sex::Female, "Жінка"}}},
{Language::Danish, {{Sex::Male, "Mand"}, {Sex::Female, "Kvinde"}}},
{Language::Swedish, {{Sex::Male, "Man"}, {Sex::Female, "Kvinna"}}},
{Language::Portuguese, {{Sex::Male, "Homem"}, {Sex::Female, "Mulher"}}},
{Language::Norwegian, {{Sex::Male, "Mann"}, {Sex::Female, "Kvinne"}}},
{Language::Japanese, {{Sex::Male, "男性"}, {Sex::Female, "女性"}}},
{Language::Hungarian, {{Sex::Male, "Férfi"}, {Sex::Female, ""}}},
{Language::Croatian, {{Sex::Male, "Muškarac"}, {Sex::Female, "Žena"}}},
{Language::Greek, {{Sex::Male, "Άνδρας"}, {Sex::Female, "Γυναίκα"}}},
{Language::Slovene, {{Sex::Male, "Moški"}, {Sex::Female, "Ženska"}}},
{Language::Dutch, {{Sex::Male, "Man"}, {Sex::Female, "Vrouw"}}},
{Language::Mandarin, {{Sex::Male, ""}, {Sex::Female, ""}}},
{Language::Korean, {{Sex::Male, "남자"}, {Sex::Female, "여자"}}},
{Language::Serbian, {{Sex::Male, "Мушкарац"}, {Sex::Female, "Жена"}}},
{Language::Macedonian, {{Sex::Male, "Маж"}, {Sex::Female, "Жена"}}},
{Language::Albanian, {{Sex::Male, "Mashkull"}, {Sex::Female, "Femër"}}},
{Language::Latvian, {{Sex::Male, "Vīrietis"}, {Sex::Female, "Sieviete"}}},
{Language::Belarusian, {{Sex::Male, "Мужчына"}, {Sex::Female, "Жанчына"}}},
{Language::Estonian, {{Sex::Male, "Mees"}, {Sex::Female, "Naine"}}},
{Language::Irish, {{Sex::Male, "fireannach"}, {Sex::Female, "baineann"}}}
};
}

0 comments on commit 5fbcd1d

Please sign in to comment.