You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Faker Library supports initialization with multiple locales:
from faker import Faker
fake = Faker(['it_IT', 'en_US', 'ja_JP'])
for _ in range(10):
print(fake.name())
Whenever I try to initialize library with multiple locales it fails with error:
Error in file '/app/robot/keywords/InventoryImportKeywords.robot': Initializing test library 'FakerLibrary' with arguments [ locale=['ja_JP', 'de_DE', 'en_US'] ] failed: AttributeError: 'list' object has no attribute 'replace'
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/FakerLibrary/keywords.py", line 42, in init
self.fake = faker.factory.Factory.create(locale, providers)
File "/usr/local/lib/python3.8/site-packages/faker/factory.py", line 35, in create
locale = locale.replace('-', '') if locale else DEFAULT_LOCALE
In factory.py file we always treat locale variable as a string with single argument and line:
locale = locale.replace('-', '_') if locale else DEFAULT_LOCALE
causes this issue
Would be super nice to have initialization with multiple locales implemented
The text was updated successfully, but these errors were encountered:
Faker Library supports initialization with multiple locales:
from faker import Faker
fake = Faker(['it_IT', 'en_US', 'ja_JP'])
for _ in range(10):
print(fake.name())
Whenever I try to initialize library with multiple locales it fails with error:
Error in file '/app/robot/keywords/InventoryImportKeywords.robot': Initializing test library 'FakerLibrary' with arguments [ locale=['ja_JP', 'de_DE', 'en_US'] ] failed: AttributeError: 'list' object has no attribute 'replace'
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/FakerLibrary/keywords.py", line 42, in init
self.fake = faker.factory.Factory.create(locale, providers)
File "/usr/local/lib/python3.8/site-packages/faker/factory.py", line 35, in create
locale = locale.replace('-', '') if locale else DEFAULT_LOCALE
In factory.py file we always treat locale variable as a string with single argument and line:
locale = locale.replace('-', '_') if locale else DEFAULT_LOCALE
causes this issue
Would be super nice to have initialization with multiple locales implemented
The text was updated successfully, but these errors were encountered: