panlatent / element-generator

Generate content for your elements in Craft CMS
https://docs.panlatent.com/element-generator
Other
2 stars 0 forks source link

Thoughts after first install/run: locales/languages #2

Open rauwebieten opened 3 months ago

rauwebieten commented 3 months ago

Hi, interesting plugin I'm willing to pay for, but there are some things that are not clear.

  1. How to specify the default locale/language for faker? I do not have the impression english is used as default.

  2. We do regulary setup localized sites. How can I specify locale/language for the fake data?

  3. We often have setups with 1 or more sites in different locales/languages. How can I make this work together?

panlatent commented 3 months ago

Inspiring! Your likes.

Currently, Faker's language is determined by the site language. You can add a site configuration and specify it through the Site Handle. If it is not filled in, it means the default site.

return [
    'default' => [],
    'generators' => [
        'posts' => function () {
            return [
                'elementType' => \craft\elements\Entry::class,
                'section' => 'posts',
                'site' => 'your-site',

The language based on Site seems to solve your other problems.

It must be pointed out that Faker's language code is somewhat different from Craft and requires more compatibility testing.

I plan to provide an option to specify the language when generating, which should be able to further meet your needs. I will improve the relevant functions and documents as soon as possible.

panlatent commented 3 months ago

🎉 Congratulations!

I spent some time finishing some of the documentation and improving some language support, and the new version adds the ability to generate content using the OpenAI API.

You may still need to take risks, but it will get better.