Skip to content

Conversation

@Recxsmacx
Copy link

@Recxsmacx Recxsmacx commented Mar 5, 2025

Related to #3716

Fixes #3720

Add language support to the footer section to address the issue of the footer text not changing when the language is switched.

  • Footer Component (components/footer/Footer.tsx)

    • Import useTranslation hook from next-i18next.
    • Use useTranslation hook to get the t function.
    • Replace hardcoded text with t function calls for translation.
    • Add currentLanguage prop to the Footer component.
    • Use currentLanguage prop to determine the language for translations.
  • Next-i18next Configuration (next-i18next.config.js)

    • Add footer to the namespaces array.
  • App Component (pages/_app.tsx)

    • Pass the current language as a prop to the Footer component.
  • Translation Files

    • Add English translations for the footer section in public/locales/en/footer.json.
    • Add German translations for the footer section in public/locales/de/footer.json.

Summary by CodeRabbit

  • New Features
    • Enhanced footer localization with multilingual support, providing translated headings and labels for a tailored user experience.
  • Refactor
    • Streamlined the footer layout with improved spacing and simplified social media and navigation sections.
  • Chores
    • Updated internationalization settings and added new language assets to support the enhanced footer content.

Related to #3716

Fixes #3720

Add language support to the footer section to address the issue of the footer text not changing when the language is switched.

* **Footer Component (`components/footer/Footer.tsx`)**
  - Import `useTranslation` hook from `next-i18next`.
  - Use `useTranslation` hook to get the `t` function.
  - Replace hardcoded text with `t` function calls for translation.
  - Add `currentLanguage` prop to the `Footer` component.
  - Use `currentLanguage` prop to determine the language for translations.

* **Next-i18next Configuration (`next-i18next.config.js`)**
  - Add `footer` to the `namespaces` array.

* **App Component (`pages/_app.tsx`)**
  - Pass the current language as a prop to the `Footer` component.

* **Translation Files**
  - Add English translations for the footer section in `public/locales/en/footer.json`.
  - Add German translations for the footer section in `public/locales/de/footer.json`.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2025

Warning

Rate limit exceeded

@Recxsmacx has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 1 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command 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 5cdb645 and 6421a89.

📒 Files selected for processing (2)
  • next.config.mjs (2 hunks)
  • pages/_app.tsx (3 hunks)

Walkthrough

The pull request updates the footer components and i18n configuration to enhance internationalization. The Footer component now accepts a currentLanguage prop and utilizes the useTranslation hook to render translatable text. In addition, a new function TranslatedInitiativeLinks is introduced in FooterList to translate initiative link labels. The i18n configuration has been expanded to include a new 'footer' namespace with minor syntax adjustments, and new JSON localization files for both German and English footers have been added.

Changes

File(s) Change Summary
components/footer/Footer.tsx, components/footer/FooterList.ts Enhanced footer components for i18n: updated Footer to accept a currentLanguage prop and utilize useTranslation for dynamic text; added TranslatedInitiativeLinks in FooterList to translate initiative link labels.
next-i18next.config.cjs Updated i18n configuration to include a new 'footer' namespace and improved syntax consistency with minor formatting adjustments.
public/locales/de/footer.json, public/locales/en/footer.json Added new localization files for the footer, providing translated strings for UI elements in German and English.

Possibly related PRs

Suggested labels

ready-to-merge, autoupdate

Suggested reviewers

  • derberg
  • devilkiller-ag
  • anshgoyalevil
  • sambhavgupta0705
  • magicmatatjahu
  • asyncapi-bot-eve
  • Mayaleeeee

Poem

I'm a hopping rabbit, full of cheer,
Translating text far and near.
New strings in footers make my day,
With i18n magic leading the way.
Code and carrots, side by side,
In language gardens, let's enjoy the ride!
🥕🐇 Happy hops to every coder!


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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 @coderabbitai in 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 @coderabbitai in 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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

@netlify
Copy link

netlify bot commented Mar 5, 2025

Deploy Preview for asyncapi-website failed.

Built without sensitive environment variables

Name Link
🔨 Latest commit 6421a89
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/67c80b50e16fcd000890baf6

@Recxsmacx Recxsmacx changed the title fix translation of footer section fix: fix translation of footer section Mar 5, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
components/footer/FooterList.ts (1)

9-9: Adjust import order according to the project's guidelines.

The useTranslation import should appear before the component imports according to the linting rules.

-import IconGithub from '../icons/Github';
-import IconLinkedIn from '../icons/LinkedIn';
-import IconSlack from '../icons/Slack';
-import IconTwitch from '../icons/Twitch';
-import IconTwitter from '../icons/Twitter';
-import IconYoutubeGray from '../icons/YouTubeGray';
-import { useTranslation } from 'next-i18next';
+import { useTranslation } from 'next-i18next';
+
+import IconGithub from '../icons/Github';
+import IconLinkedIn from '../icons/LinkedIn';
+import IconSlack from '../icons/Slack';
+import IconTwitch from '../icons/Twitch';
+import IconTwitter from '../icons/Twitter';
+import IconYoutubeGray from '../icons/YouTubeGray';
🧰 Tools
🪛 ESLint

[error] 1-9: Run autofix to sort these imports!

(simple-import-sort/imports)


[error] 9-9: next-i18next import should occur before import of ../icons/Github

(import/order)

next-i18next.config.cjs (1)

7-7: Fix trailing comma formatting.

The linter is flagging formatting inconsistencies with trailing commas. This should be standardized according to project formatting rules.

- react: { useSuspense: false },// this line
+ react: { useSuspense: false } // this line
- de: 'Deutsch',
- },
+ de: 'Deutsch'
+ }

Also applies to: 11-12

🧰 Tools
🪛 ESLint

[error] 7-7: Replace , with ·

(prettier/prettier)

components/footer/Footer.tsx (3)

3-3: Remove unused import.

The useRouter import is declared but never used in this component.

-import { useRouter } from 'next/router';
🧰 Tools
🪛 ESLint

[error] 3-3: 'useRouter' is defined but never used.

(unused-imports/no-unused-imports)


[error] 3-3: 'useRouter' is defined but never used.

(no-unused-vars)


9-13: Fix import ordering and structure.

The component interface and imports should follow a consistent order. All imports should be at the top of the file, followed by interface definitions.

import type { InitiativeLink, SocialMediaLink } from './FooterList';
+import { initiativeLinks, socialMediaLinks } from './FooterList';

interface FooterProps {
  currentLanguage: string;
}
-import { initiativeLinks, socialMediaLinks } from './FooterList';
🧰 Tools
🪛 ESLint

[error] 9-9: Expected 1 empty line after import statement not followed by another import.

(import/newline-after-import)


[error] 13-13: Import in body of module; reorder to top.

(import/first)


94-103: Fix formatting issues in the Netlify deployment section.

There are multiple formatting issues in the Netlify deployment section including trailing spaces and inconsistent indentation that should be addressed.

-            <a 
-            href='https://netlify.com' 
-            target='_blank'
-             rel='noopener noreferrer'>
-            <img
-             src='https://www.netlify.com/img/global/badges/netlify-color-bg.svg'
-              className='h-6'
-               alt='Deploys by Netlify'
-                />          
-                  </a>
+            <a
+              href='https://netlify.com'
+              target='_blank'
+              rel='noopener noreferrer'
+            >
+              <img
+                src='https://www.netlify.com/img/global/badges/netlify-color-bg.svg'
+                className='h-6'
+                alt='Deploys by Netlify'
+              />
+            </a>
🧰 Tools
🪛 ESLint

[error] 94-94: Trailing spaces not allowed.

(no-trailing-spaces)


[error] 94-97: Replace ⏎············href='https://netlify.com'·⏎············target='_blank'⏎············ with href='https://netlify.com'·target='_blank'

(prettier/prettier)


[error] 95-95: Trailing spaces not allowed.

(no-trailing-spaces)


[error] 98-98: Insert ··

(prettier/prettier)


[error] 99-99: Insert ···

(prettier/prettier)


[error] 100-100: Insert ··

(prettier/prettier)


[error] 101-101: Insert ·

(prettier/prettier)


[error] 102-102: Replace ················/>·········· with ··············/>

(prettier/prettier)


[error] 102-102: Trailing spaces not allowed.

(no-trailing-spaces)


[error] 103-103: Delete ······

(prettier/prettier)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2776c91 and 5cdb645.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • components/footer/Footer.tsx (2 hunks)
  • components/footer/FooterList.ts (2 hunks)
  • next-i18next.config.cjs (1 hunks)
  • public/locales/de/footer.json (1 hunks)
  • public/locales/en/footer.json (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • public/locales/de/footer.json
  • public/locales/en/footer.json
🧰 Additional context used
🪛 ESLint
components/footer/FooterList.ts

[error] 1-9: Run autofix to sort these imports!

(simple-import-sort/imports)


[error] 9-9: next-i18next import should occur before import of ../icons/Github

(import/order)

components/footer/Footer.tsx

[error] 3-3: 'useRouter' is defined but never used.

(unused-imports/no-unused-imports)


[error] 3-3: 'useRouter' is defined but never used.

(no-unused-vars)


[error] 9-9: Expected 1 empty line after import statement not followed by another import.

(import/newline-after-import)


[error] 13-13: Import in body of module; reorder to top.

(import/first)


[error] 15-15: 'currentLanguage' is defined but never used. Allowed unused args must match /^_/u.

(unused-imports/no-unused-vars)


[error] 15-15: 'currentLanguage' is defined but never used.

(no-unused-vars)


[error] 76-76: Replace ·href={link.url}·target='_blank'·rel='noopener·noreferrer'·className='flex·items-center·gap-2·text-cool-gray·transition·hover:text-white' with ⏎······················href={link.url}⏎······················target='_blank'⏎······················rel='noopener·noreferrer'⏎······················className='flex·items-center·gap-2·text-cool-gray·transition·hover:text-white'⏎····················

(prettier/prettier)


[error] 94-94: Trailing spaces not allowed.

(no-trailing-spaces)


[error] 94-97: Replace ⏎············href='https://netlify.com'·⏎············target='_blank'⏎············ with href='https://netlify.com'·target='_blank'

(prettier/prettier)


[error] 95-95: Trailing spaces not allowed.

(no-trailing-spaces)


[error] 98-98: Insert ··

(prettier/prettier)


[error] 99-99: Insert ···

(prettier/prettier)


[error] 100-100: Insert ··

(prettier/prettier)


[error] 101-101: Insert ·

(prettier/prettier)


[error] 102-102: Replace ················/>·········· with ··············/>

(prettier/prettier)


[error] 102-102: Trailing spaces not allowed.

(no-trailing-spaces)


[error] 103-103: Delete ······

(prettier/prettier)

next-i18next.config.cjs

[error] 7-7: Replace , with ·

(prettier/prettier)


[error] 11-11: Delete ,

(prettier/prettier)


[error] 12-12: Delete ,

(prettier/prettier)

⏰ Context from checks skipped due to timeout of 180000ms (1)
  • GitHub Check: Lighthouse CI
🔇 Additional comments (4)
components/footer/FooterList.ts (1)

78-85: Well-implemented translation function.

The TranslatedInitiativeLinks function elegantly handles translations while preserving the original structure of the links objects. This is a clean approach to internationalizing the navigation items.

next-i18next.config.cjs (1)

5-5: Successfully added footer namespace to i18n configuration.

Adding the 'footer' namespace to the configuration is the correct approach for enabling translations in the footer component.

components/footer/Footer.tsx (2)

10-12: Verify usage of the currentLanguage prop.

The currentLanguage prop is defined and passed to the Footer component but isn't actually used within the component. Consider removing it if not needed, or document its purpose if it's intended for future use.

Also applies to: 15-15


16-16: Excellent implementation of internationalization.

The translation functionality has been properly implemented throughout the footer component using the t function. All static text can now be properly translated based on the selected language, which greatly enhances the user experience for non-English speakers.

Also applies to: 30-30, 39-40, 46-47, 57-58, 62-63, 71-72, 90-91

@Recxsmacx Recxsmacx closed this Mar 6, 2025
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.

[BUG] Footer section language not changing when language is changed

1 participant