-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat::Add multilanguage sexes (Issue #251) 101a
- Loading branch information
1 parent
75717d7
commit ee1ce84
Showing
2 changed files
with
97 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#pragma once | ||
|
||
#include <map> | ||
#include <vector> | ||
|
||
namespace faker | ||
{ | ||
|
||
enum class Language | ||
{ | ||
English, | ||
Polish, | ||
French, | ||
German, | ||
Italian, | ||
Russian, | ||
Romanian, | ||
Hindi, | ||
Finnish, | ||
Nepali, | ||
Spanish, | ||
Turkish, | ||
Czech, | ||
Slovak, | ||
Ukrainian, | ||
Danish, | ||
Swedish, | ||
Portuguese, | ||
Norwegian, | ||
Japanese, | ||
Hungarian, | ||
Croatian, | ||
Greek, | ||
Slovene, | ||
Dutch, | ||
Mandarin, | ||
Korean, | ||
Serbian, | ||
Macedonian, | ||
Albanian, | ||
Latvian, | ||
Irish, | ||
Belarusian, | ||
Estonian | ||
}; | ||
|
||
//const std::vector<Language> languages{ | ||
// Language::English, Language::Polish, Language::Italian, Language::French, Language::German, Language::Russian, | ||
// Language::Romanian, Language::Hindi, Language::Finnish, Language::Nepali, Language::Spanish, Language::Turkish, | ||
// Language::Czech, Language::Slovak, Language::Ukrainian, Language::Danish, Language::Swedish}; | ||
|
||
inline std::string toString(Language language) | ||
{ | ||
static const std::map<Language, std::string> languageToStringMapping{ | ||
{Language::English, "English"}, {Language::Polish, "Polish"}, {Language::Italian, "Italian"}, | ||
{Language::French, "French"}, {Language::German, "German"}, {Language::Russian, "Russian"}, | ||
{Language::Romanian, "Romanian"}, {Language::Hindi, "Hindi"}, {Language::Finnish, "Finnish"}, | ||
{Language::Nepali, "Nepali"}, {Language::Spanish, "Spanish"}, {Language::Turkish, "Turkish"}, | ||
{Language::Czech, "Czech"}, {Language::Slovak, "Slovak"}, {Language::Ukrainian, "Ukrainian"}, | ||
{Language::Danish, "Danish"}, {Language::Swedish, "Swedish"}, | ||
{Language::Portuguese, "Portuguese"}, {Language::Norwegian, "Norwegian"}, {Language::Japanese, "Japanese"}, | ||
{Language::Hungarian, "Hungarian"}, {Language::Croatian, "Croatian"}, {Language::Greek, "Greek"}, | ||
{Language::Slovene, "Slovene"}, {Language::Dutch, "Dutch"}, {Language::Mandarin, "Mandarin"}, | ||
{Language::Korean, "Korean"}, {Language::Serbian, "Serbian"}, {Language::Macedonian, "Macedonian"}, | ||
{Language::Albanian, "Albanian"}, {Language::Latvian, "Latvian"}, {Language::Irish, "Irish"}, | ||
{Language::Belarusian, "Belarusian"}, {Language::Estonian, "Estonian"} | ||
}; | ||
|
||
return languageToStringMapping.at(language); | ||
} | ||
|
||
inline std::ostream& operator<<(std::ostream& os, Language language) | ||
{ | ||
return os << toString(language); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters