Skip to content

Add i18n support and logging #6

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

Merged
merged 2 commits into from
Apr 14, 2020
Merged

Add i18n support and logging #6

merged 2 commits into from
Apr 14, 2020

Conversation

jamaljsr
Copy link
Member

Closes #3 & #5

This PR is built on top of #2 so that should be reviewed and merged before reviewing this PR. Only the last two commits are new.

This update adds i18n support using i18next and react-i18next packages. Only an English lang file is included but more can be added easily in the future.

This PR also adds some basic logging infrastructure using the debug package. Here are some notes from the README on how to customize the logs that are outputted to the console.

Logging

Client-side logs are disabled by default in production builds and enabled by default in a development environment. In production, logging can be turned on by adding a couple keys to your browser's localStorage. Simply run these two JS statements in you browser's DevTools console:

localStorage.setItem('debug', '*');
localStorage.setItem('debug-level', 'debug');

The value for debug is a namespace filter which determines which portions of the app to display logs for. The namespaces currently used by the app are as follows:

  • main: logs general application messages
  • action: logs all actions that modify the internal application state
  • grpc: logs all GRPC API requests and responses

Example filters: main,action will only log main and action messages. *,-actions will log everything except action messages.

The value for debug-level determines the verbosity of the logs. The value can be one of debug, info, warn, or error.

@jamaljsr jamaljsr linked an issue Apr 14, 2020 that may be closed by this pull request
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

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

LGTM, great to have i18n and debugging capabilities added from start!

@jamaljsr jamaljsr merged commit b4c31ec into master Apr 14, 2020
@jamaljsr jamaljsr deleted the feat/i18n branch April 14, 2020 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add logging library Add support for multiple languages
2 participants