Developing on Coral
Running Coral for development is very similar to installing Coral via Source as described in our Getting Started guide.
Coral requires NodeJS ^14.18, we recommend using nvm
to help manage node
versions: https://github.com/creationix/nvm.
# Clone and cd into the Coral directory.git clone https://github.com/coralproject/talk.gitcd talk
# Install dependencies.sh scripts/npm-i.sh
Running Coral with default settings assumes that you have:
- MongoDB ^4.2 running on
127.0.0.1:27017
- Redis ^3.2 running on
127.0.0.1:6379
If you don't already have these databases running, you can execute the following assuming you have Docker installed on your local machine:
docker run -d -p 27017:27017 --restart always --name mongo mongo:4.2docker run -d -p 6379:6379 --restart always --name redis redis:3.2
Then initialize Coral using the helper script:
sh initialize.sh
Then inside the client/
folder run:
npm run watch
Then open another terminal inside the server/
folder and similarly run:
npm run watch
These two terminals will run through some build steps and start the system up in development mode. The client/
hosts the front end code and the server/
hosts the GraphQL API and underlying data management with Redis and Mongo.
When the client code has been built, navigate to http://localhost:8080/install to start the installation wizard.
To see the comment stream goto http://localhost:8080/.
To run linting and tests use the following commands:
# Run the linters.sh scripts/lint.sh
# Inside client, server you can run our unit and integration testsnpm run test
#
EmailTo test out the email sending functionality, you can run inbucket which provides a test SMTP server that can visualize emails in the browser:
docker run -d --name inbucket --restart always -p 2500:2500 -p 9001:9000 inbucket/inbucket
You can then configure the email server on Coral
by setting the email settings in
Configure -> Email
in the admin:
Field | Value |
---|---|
From Address | community@test.com |
Secure | No |
Host | localhost |
Port | 2500 |
Authentication | No |
Navigate to http://localhost:9001, click the "Monitor" tab. New emails received on this screen.
#
ContributingTo get started contributing, check out our Contribution Guidelines.
#
Contributing a TranslationWe’re so proud to have received submissions from a lot of 3rd party contributors translating Coral into their own languages.
You can see what languages Coral currently supports here: https://github.com/coralproject/talk/tree/main/locales
Coral uses the fluent library and store our
translations in FTL files in
locales/
and server/src/core/server/locales/
.
Strings are added or removed from localization bundles in the translation files
as needed. Strings MUST NOT be changed after they've been committed and
pushed to main
. Changing a string requires creating a new ID with a new name
(preferably descriptive instead of incremented) and deletion of the obsolete ID.
It's often useful to add a comment above the string with info about how and
where the string is used.
Once a language has enough coverage, it should be added to
common/lib/helpers/i18n/locales.ts
.
The Perspective API
also supports comments in specific languages. When the language is supported in
Coral and supported by the Perspective API, the language should be added to the
language map in server/src/core/server/services/comments/pipeline/phases/toxic.ts
.
To assist with the translation process, we have a script that is based on the work by @cristiandean in https://github.com/coralproject/talk/pull/2949 that will detect missing, new, or changed translation keys for the specified language. You can use this with:
# usage: ./scripts/i18n/validate.ts <locale>./scripts/i18n/validate.ts pt-BR