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: auto generate/update locale files #252

Merged
merged 13 commits into from Feb 1, 2022
Merged

feat: auto generate/update locale files #252

merged 13 commits into from Feb 1, 2022

Conversation

ST-DDT
Copy link
Member

@ST-DDT ST-DDT commented Jan 21, 2022

This PR adds a script that automatically generates

  • src/locale/*.ts
  • src/locales/index.ts.
  • and docs/api/localization.md

This should be merged after #248

The is the generation/update related part for #210

Currently this is not integrated in the build process.

@netlify
Copy link

netlify bot commented Jan 21, 2022

✔️ Deploy Preview for vigilant-wescoff-04e480 ready!

🔨 Explore the source changes: 93d4bc4

🔍 Inspect the deploy log: https://app.netlify.com/sites/vigilant-wescoff-04e480/deploys/61eb2c6b373a1c00072ae468

😎 Browse the preview: https://deploy-preview-252--vigilant-wescoff-04e480.netlify.app

scripts/generateLocales.ts Outdated Show resolved Hide resolved
scripts/generateLocales.ts Outdated Show resolved Hide resolved
@Shinigami92 Shinigami92 added the p: 1-normal Nothing urgent label Jan 21, 2022
@Shinigami92 Shinigami92 linked an issue Jan 21, 2022 that may be closed by this pull request
@ST-DDT
Copy link
Member Author

ST-DDT commented Jan 23, 2022

This has been split into multiple PRs and needs to be updated once #263 and #264 have been merged.

@ST-DDT ST-DDT marked this pull request as ready for review January 25, 2022 00:16
@ST-DDT ST-DDT requested a review from a team as a code owner January 25, 2022 00:16
@ST-DDT
Copy link
Member Author

ST-DDT commented Jan 25, 2022

Updated.

If the following change is considered breaking, then we could just temporarily remove/change it.
That way, we can still use the automation script.

- export = faker;
+ export default faker;

@Shinigami92
Copy link
Member

I thing export = faker is currently the right way, so plain js node users can just use const fakerDe = require('@faker-js/faker/locale/de') instead of const fakerDe = require('@faker-js/faker/locale/de').default.
So indeed, for the locales we have a special case here.

package.json Outdated Show resolved Hide resolved
src/locale/en.ts Outdated Show resolved Hide resolved
Shinigami92
Shinigami92 previously approved these changes Jan 27, 2022
Copy link
Member

@Shinigami92 Shinigami92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 🚀

Shinigami92
Shinigami92 previously approved these changes Jan 27, 2022
Shinigami92
Shinigami92 previously approved these changes Jan 29, 2022
Shinigami92
Shinigami92 previously approved these changes Jan 29, 2022
@ST-DDT ST-DDT requested a review from a team January 30, 2022 21:34
@ST-DDT
Copy link
Member Author

ST-DDT commented Jan 30, 2022

I need this in main in order to update it for #363 .
(There is no automation enabled for this yet.)

CONTRIBUTING.md Show resolved Hide resolved
@ST-DDT ST-DDT merged commit df48704 into faker-js:main Feb 1, 2022
@ST-DDT ST-DDT deleted the feature/locales/autogenerate branch February 1, 2022 17:06
bmenant pushed a commit to bmenant/faker that referenced this pull request Mar 11, 2022
demipel8 pushed a commit to demipel8/faker that referenced this pull request Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: 1-normal Nothing urgent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docs: document supported locales
3 participants