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

Docs: dynamically generated list of available locales page #2838

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fturmel
Copy link
Member

@fturmel fturmel commented Dec 11, 2021

This PR converts the documentation generation code to TypeScript and adds a new dynamically generated documentation page that lists available locales as a table and as JSON. I think this will be very valuable to the community to have easy access to this information.

You can preview the generated page here: https://github.com/date-fns/date-fns/blob/9bb51691f201c3ec05ab832acbc5d478f2e5c47a/docs/i18nLocales.md

A few things to point out:

  • I turned on the jsdoc-to-markdown cache, as it seems to work well and detects file changes correctly. On my machine, it takes almost 2 minutes on an empty cache to generate the docs, but completes in 420ms with cache and one source file modified.
  • This new docs generation script will fail if the @summary jsdoc tags of locales are not unique. Hoping this will help people build out locale selectors without duplicate entries. I made some adjustments to a few locale's jsdoc entries to fix typos, uniqueness and precision.
  • To complete the TypeScript conversion, I had to add some type definitions to package.json. I kept the changes to a minimum.

Hope you like it!

EDIT: also fixes a docs bug for FP ESM usage, see comment below

@tan75
Copy link
Contributor

tan75 commented Dec 11, 2021

DIscussion:
#2724

@fturmel
Copy link
Member Author

fturmel commented Dec 11, 2021

@bartduisters Apologies, as mentioned in the other thread I was going off the CLDR for the English name of the locale and found that Flemish was in there. https://unicode-org.github.io/cldr-staging/charts/40/summary/nl.html

Just pushed a commit using your recommendations.

@fturmel
Copy link
Member Author

fturmel commented Dec 12, 2021

Last commit in this PR fixes dosc ESM usage examples for FP (see #2124).

Before notice //
import { formatISO } from 'date-fns/esm//fp'

After
import { formatISO } from 'date-fns/fp'

It also removes 'umd' usage since that is not supported anymore and not displayed on the docs website.

@fturmel fturmel force-pushed the PR/docs-generate-locales-page branch 2 times, most recently from bd471dc to 9e5c925 Compare December 24, 2021 18:02
@fturmel fturmel linked an issue Dec 26, 2021 that may be closed by this pull request
@fturmel fturmel force-pushed the PR/docs-generate-locales-page branch from 9e5c925 to 4af9178 Compare December 27, 2021 17:25
@fturmel fturmel force-pushed the PR/docs-generate-locales-page branch from 4af9178 to d177686 Compare December 28, 2021 17:58
@fturmel fturmel force-pushed the PR/docs-generate-locales-page branch from c243c3d to 9bb5169 Compare January 10, 2022 14:43
@fturmel
Copy link
Member Author

fturmel commented Jan 10, 2022

soft reset to fix all the conflicts. Also removed the TypeScript and broken locale stats from output since these are not relevant anymore.

@p-fernandez
Copy link

This PR seems stale. Is there any plans to merge it anytime soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typescript types don't seem to work with FP module
3 participants