Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding locale to word module #932

Merged
merged 35 commits into from
Oct 3, 2024
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c2bf42a
generating a new adjetive signature for adding information of locale
gustavobastian Sep 26, 2024
0e5758c
adding more tables
gustavobastian Sep 28, 2024
f84570d
adding new function wordsL
gustavobastian Sep 28, 2024
8dded88
adding more words to data
gustavobastian Sep 28, 2024
39bc77d
change functions names, fixing test not passing
gustavobastian Sep 30, 2024
7982e94
adding check if locale is in map or not
gustavobastian Sep 30, 2024
ef6b2bf
signature for functions
gustavobastian Sep 30, 2024
9377561
generating all test
gustavobastian Sep 30, 2024
134b862
using en_US words structure for general functions
gustavobastian Sep 30, 2024
27377b3
Merge branch 'cieslarmichal:main' into feature/word-locale
gustavobastian Sep 30, 2024
f8ae4f1
using span for main structures of data
gustavobastian Sep 30, 2024
a984912
adding portuguese words
gustavobastian Oct 1, 2024
b638f37
adding french words
gustavobastian Oct 1, 2024
7faea51
adding test
gustavobastian Oct 1, 2024
34b503d
Merge branch 'cieslarmichal:main' into feature/word-locale
gustavobastian Oct 1, 2024
05859a1
Merge branch 'feature/word-locale' of github.com:gustavobastian/faker…
gustavobastian Oct 1, 2024
988cef0
modify changelog
gustavobastian Oct 1, 2024
808f1f4
Merge pull request #1 from gustavobastian/feature/word-locale
gustavobastian Oct 1, 2024
af7f3e3
adding parametrized test
gustavobastian Oct 1, 2024
c6f0618
fixing use fmt and GTest from System
gustavobastian Oct 1, 2024
d3b9a60
spelling
gustavobastian Oct 2, 2024
07ad1ef
reverting modification in internet.cpp
gustavobastian Oct 2, 2024
ae09226
spell correction
gustavobastian Oct 2, 2024
a0782c7
using correct function in test
gustavobastian Oct 2, 2024
df3043f
check if the locale is defined using idiomsMapSpan structure, if not …
gustavobastian Oct 2, 2024
0156b92
Merge pull request #2 from gustavobastian/feature/word-locale
gustavobastian Oct 2, 2024
55469e0
unsing auto in parameterized tests
gustavobastian Oct 2, 2024
de4c2ee
change functions descriptions
gustavobastian Oct 2, 2024
760d1be
removing duplicate functions
gustavobastian Oct 2, 2024
80ea7d0
removing extre newlines in tests
gustavobastian Oct 2, 2024
bee73c2
Merge pull request #3 from gustavobastian/feature/word-locale
gustavobastian Oct 2, 2024
6b918ab
adding const in test values.
gustavobastian Oct 2, 2024
bb7cf04
Merge pull request #4 from gustavobastian/feature/word-locale
gustavobastian Oct 2, 2024
7be658f
removing option in words with (length<=256), and s capture the datase…
gustavobastian Oct 3, 2024
c9c8a76
Merge pull request #5 from gustavobastian/feature/word-locale
gustavobastian Oct 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
check if the locale is defined using idiomsMapSpan structure, if not …
…using default en_US.
  • Loading branch information
gustavobastian committed Oct 2, 2024
commit df3043f3cd208c4c2792e2c1bd489fefa27a7db4
20 changes: 13 additions & 7 deletions src/modules/word.cpp
Original file line number Diff line number Diff line change
@@ -172,10 +172,11 @@ std::string_view conjunctionLocale(unsigned int length, const Locale locale)
length=100;
}
auto localeLocal = locale;
if(_allWords_map.find(locale)==_allWords_map.end())
if(idiomsMapSpan.find(locale)==idiomsMapSpan.end())
{
localeLocal = Locale::en_US;
}

auto sorted= _conjunctions_sorted_map.at(localeLocal);
return sortedSizeRandomElement(length, sorted);
}
@@ -195,11 +196,13 @@ std::string_view interjectionLocale(unsigned int length, const Locale locale)
{
length=100;
}
auto localeLocal = locale;
if(_allWords_map.find(locale)==_allWords_map.end())
auto localeLocal = locale;

if(idiomsMapSpan.find(locale)==idiomsMapSpan.end())
{
localeLocal = Locale::en_US;
}

auto sorted= _interjections_sorted_map.at(localeLocal);
return sortedSizeRandomElement(length, sorted);
}
@@ -221,10 +224,10 @@ std::string_view nounLocale(unsigned int length, const Locale locale)
length=100;
}
auto localeLocal = locale;
if(_allWords_map.find(locale)==_allWords_map.end())
if(idiomsMapSpan.find(locale)==idiomsMapSpan.end())
{
localeLocal = Locale::en_US;
}
}
auto sorted= _nouns_sorted_map.at(localeLocal);
return sortedSizeRandomElement(length, sorted);
}
@@ -246,10 +249,12 @@ std::string_view prepositionLocale(unsigned int length, const Locale locale)
length=100;
}
auto localeLocal = locale;
if(_allWords_map.find(locale)==_allWords_map.end())

if(idiomsMapSpan.find(locale)==idiomsMapSpan.end())
{
localeLocal = Locale::en_US;
}

auto sorted=_prepositions_sorted_map.at(localeLocal);
return sortedSizeRandomElement(length, sorted);
}
@@ -270,7 +275,8 @@ std::string_view verbLocale(unsigned int length, const Locale locale)
length=100;
}
auto localeLocal = locale;
if(_allWords_map.find(locale)==_allWords_map.end())

if(idiomsMapSpan.find(locale)==idiomsMapSpan.end())
{
localeLocal = Locale::en_US;
}