-
-
Notifications
You must be signed in to change notification settings - Fork 934
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
'lorem.words' missing for zh_CN #2907
Comments
What do you expect for lorem data in zh_CN? Ref: Workaround: new Faker({ locale: [zh_CN, {lorem: en.lorem}]});
// or
new Faker({ locale: [zh_CN, en]});
// or
new Faker({ locale: [zh_CN, {lorem: {words: zh_CN.word.noun }}]}); |
What I expected was to get pure Chinese words. Adding 'en' to the locale indeed solves the error, because Faker automatically generates paragraphs in all English words. new Faker({ locale: [zh_CN, {lorem: en.lorem}]}); // All English words
// or
new Faker({ locale: [zh_CN, en]}); // All English words
// or
new Faker({ locale: [zh_CN, {lorem: {words: zh_CN.word.noun }}]}); // The locale data for 'lorem.words' are missing in this locale |
Sorry I didn't notice that new Faker({ locale: [zh_CN, { lorem: { words: zh_CN.word.verb } }] }); // 写 驾驶 拎 拧 捡 舞. 抚 跳 拿 托 挡 坐 吮 抬 擦 搔. 擦 抛 披. Is this what you expect? FFR: en lorem = Latin |
Chinese doesn't normally put spaces in between words. My feeling is that "Chinese" lorem equivalent would be a long string of real Chinese characters but with nonsense meanings, not necessarily real words. |
Thank you @ST-DDT, your solution indeed solves my problem. It outputs continuous Chinese paragraphs, but they are interspersed with spaces which I need to handle myself. The reason I raised this issue is that I didn't find a similar solution in the demos on the documentation. I hope that in the future, the faker team can include such cases in the documentation or provide better support for Chinese, just like in the demos. const customFaker = new Faker({
local: [zh_CN]
})
customFaker.lorem.paragraphs({ min: 2, max: 5 }, '\n') |
Pre-Checks
Describe the bug
@faker-js/[email protected]
const customFaker = new Faker({ locale: [zh_CN] }); customFaker.lorem.paragraphs({ min:2, max:3 }, '\n')
get error "The locale data for 'lorem.words' are missing in this locale.
Please contribute the missing data to the project or use a locale/Faker instance that has these data."
Minimal reproduction code
No response
Additional Context
Environment Info
Which module system do you use?
Used Package Manager
pnpm
The text was updated successfully, but these errors were encountered: