faker
faker copied to clipboard
Improve specification of lorem module and definitions
Languages that use latin characters should use the latin lorem text (e.g. copy it from en). We will create a separate PR that will document this behavior of the lorem feature in the definitions and module. After the change of definitions we should create another PR that actually changes the locale data to comply with the new spec and additional care should be taken regarding tree shakeability if the locale data are imported from other locales.
Especially the later part should be done by the team to ensure there are no side effects.
Originally posted by @ST-DDT in https://github.com/faker-js/faker/issues/2824#issuecomment-2077678007
Suggestion by @matthewmayer
If it is identical to en could we not just have words.ts be like this to avoid duplication:
import words from '../../en/lorem/words';
export default words;
I'll create a PR for the documentation part. Unless you are already working on it.
https://github.com/faker-js/faker/issues/2907#issuecomment-2119197303
This raises my impression that lorem should be strictly Latin only and we should probably add gibberishSentence/Paragraph/Text methods to the word module instead.
Honestly, as long as we have a clear definition I'm fine with it. It's not like we can't change it in the future, if required.
If we do decide to to keep lorem non-Latin languages we should definitely allow for languages that don't have a space as a word seperator (e.g. Chinese, Thai). For example here you'd probably want to use a definition like faker.definitions.lorem.word_seperator instead of a hardcoded ' '.
Team Proposal
- We want to make the lorem module to consist only of lorem ipsum (Latin)
- We want to make a new text (or similar) module that generates blind texts in the current locale
- We are not sure yet whether these will be hard-coded pseudo realistic sentences or wild combinations of words that may or may not follow the normal syntax of the language (e.g.
firstName drives through cityvsnoun verb adjectivevsword word word) - The module should roughly mimic the methods in the lorem module
- The lorem module and the blind text module should have links (at each method) between each other to help with discovery
- We are not sure yet whether these will be hard-coded pseudo realistic sentences or wild combinations of words that may or may not follow the normal syntax of the language (e.g.
- The actual redefinition on the lorem module is v10/not now (after we have the blind-text module)
FFR: We now use it for domain words as well, so it using latin letters would help with that:
- https://github.com/faker-js/faker/pull/3253