This is a Next.js project bootstrapped with create-next-app
.
First, run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying pages/index.tsx
. The page auto-updates as you edit the file.
API routes can be accessed on http://localhost:3000/api/user. This endpoint can be edited in pages/api/user.ts
.
The pages/api
directory is mapped to /api/*
. Files in this directory are treated as API routes instead of React pages.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.
This project contains a script (./tools/checkIntl.js
) to help manage your react-intl translations files. It has been written to run without any dependencies or compilation. It is expected to be used along with the formatjs cli.
The checkIntl script can be run with different flags and options. For more details on how individual options work, see the checkIntl file itself. In practice, it is easiest to save the commands, with options included, as package.json scripts.
For example, to ensure translations in the project are up to date:
- Run
npm run intl-extract
. This script parses the/pages
,/components
,messages
folders for all the react-intl messages. The messages are injected into en.json. - Run
npm run check-intl
. This generates a untranslated.json file in the project's/lang
folder. - Send untranslated.json for translation, asking them to only translate the "defaultMessage" fields.
- Save the translated version which comes back as newTranslations.json in the same lang folder.
- Run
npm run check-intl-merge
. This merges the newTranslations.json file with the fr.json adding the new translated messages, and updating any old ones too. - If you see any warnings about untranslated entries which simply match in English and French, add the key to the array in whitelist.json and repeat step 4.
Only fr.json and whitelist.json need to be checked into source control. The other files created during this process are generated as needed or only used to communicate with translators, should be added to .gitignore, and may be deleted after use.