Implement Internationalization (en and fr) for Multi-language Support
What kind of change does this PR introduce?
Feature: Added internationalization (en and fr) support to the website to enable multi-language functionality.
Why was this change needed?
This change was needed to provide a seamless experience for users across different regions by allowing the website to support multiple languages.
Other information:
eg: Did you discuss this change with anybody before working on it (not required, but can be a good idea for bigger changes). Any plans for the future, etc?
Yes, I did discuss the updates and changes made to the codebase.
Checklist:
Put a "X" in the boxes below to indicate you have followed the checklist;
- [X] I have read the CONTRIBUTING guide.
- [X] I checked that there were not similar issues or PRs already open for this.
- [X] This PR fixes just ONE issue (do not include multiple issues or types of change in the same PR) For example, don't try and fix a UI issue and include new dependencies in the same PR.
Summary by CodeRabbit
-
New Features
- Added internationalization support across various components, allowing dynamic translation of user-facing text.
- Introduced language preference setting via a new endpoint for users.
- Implemented localized error messages and prompts throughout the application.
- Added support for English and French languages with corresponding translation files.
- Enhanced user interface elements with translatable strings for improved accessibility.
-
Documentation
- Added English and French translation files for UI elements.
- Updated localization configuration to support multiple languages.
-
Chores
- Added
next-intldependency to enhance internationalization capabilities.
- Added
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| gitroom | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Dec 10, 2024 9:00am |
1 Skipped Deployment
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| postiz | ⬜️ Ignored (Inspect) | Visit Preview | Dec 10, 2024 9:00am |
@steveCs50 is attempting to deploy a commit to the Listinai Team on Vercel.
A member of the Team first needs to authorize it.
[!WARNING]
Rate limit exceeded
@Aspireve has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 19 seconds before requesting another review.
⌛ How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the
@coderabbitai reviewcommand as a PR comment. Alternatively, push new commits to this PR.We recommend that you space out your commits to avoid hitting the rate limit.
🚦 How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.
📥 Commits
Reviewing files that changed from the base of the PR and between feb18b462d1b526d48ffebf365a1de82598fa561 and 26c238c9ae0fd882865ad07b30e7cf4751f83cfe.
📒 Files selected for processing (3)
.eslintrc.json(2 hunks)apps/frontend/src/components/layout/settings.component.tsx(4 hunks)apps/frontend/src/components/layout/title.tsx(1 hunks)
Walkthrough
This pull request introduces comprehensive internationalization (i18n) support to the application using the next-intl library. The changes span across multiple components, configuration files, and the backend, enabling dynamic language switching and translation of user interface elements. A new language change mechanism is implemented, allowing users to set their preferred language through a cookie, with initial support for English and French languages. The modifications include adding translation files, updating component rendering to use translation functions, and configuring Next.js to support internationalization.
Changes
| File/Path | Change Summary |
|---|---|
apps/backend/src/api/routes/users.controller.ts |
Added changeLanguage method to set user language preference via cookie; added ChangeLanguageDto class for language validation. |
apps/frontend/next.config.js |
Integrated next-intl/plugin for internationalization configuration. |
apps/frontend/src/app/layout.tsx |
Added NextIntlClientProvider to support localization and fetch current locale/messages. |
apps/frontend/src/i18n/ |
Added locales configuration, translation files for English and French. |
| Multiple frontend components | Replaced hardcoded strings with translation function calls, enhancing localization across various UI elements. |
package.json |
Added next-intl dependency. |
.eslintrc.json |
Updated ESLint configuration for i18n files, turning off specific TypeScript rules. |
Sequence Diagram
sequenceDiagram
participant User
participant Frontend
participant Backend
participant Translations
User->>Frontend: Change language
Frontend->>Backend: POST /changeLanguage
Backend-->>Frontend: Set NEXT_LOCALE cookie
Frontend->>Translations: Load translation file
Translations-->>Frontend: Provide translated strings
Frontend->>User: Render UI in selected language
Poem
🐰 A Rabbit's Ode to Translation
In code where words once stood so still,
Now dance with language's sweet will,
From English plains to French terrain,
Our app speaks more without a strain!Hop, translate, and set us free! 🌍
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Generate unit testing code for this file. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai generate unit testing code for this file. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and generate unit testing code. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. (Beta) -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Hey @A1exKH!
The ESLint issues seem to be related to the environment variables. Non-null assertions are necessary to prevent TypeScript from complaining about potential undefined values being assigned to variables that require a string.
If there's a way to suppress these warnings, could you guide me on how to achieve that?
Hey @A1exKH!
The ESLint issues seem to be related to the environment variables. Non-null assertions are necessary to prevent TypeScript from complaining about potential undefined values being assigned to variables that require a string.
If there's a way to suppress these warnings, could you guide me on how to achieve that?
@jamesread could give an advice how to better handle the warning from ESLint?
Heyy Hi!! @A1exKH I spoke to @nevo-david regarding the eslint warning, so he suggested me I could just disable the non-null warning I added that to the PR
Heyy Hi!! @A1exKH I resolved all the conflicts in this PR
Heyy Hi!! @A1exKH Which other stuff should I need to change for the review
@Aspireve please merge the latest version of main branch into your PR.
It might be a bit challenging for me since I'm not fully familiar with the new code that was pushed.
However, I'll still do my best to solve them based on what I know.
If I encounter any issues or get stuck, would you be able to assist me?
Heyy Hi @A1exKH I solved all the merge conflicts with the hosted main branch