Skip to content

Conversation

@ArjinAlbay
Copy link
Member

@ArjinAlbay ArjinAlbay commented Jul 25, 2025

Summary by CodeRabbit

  • New Features

    • Introduced multilingual support with English and Turkish translations across the application.
    • Added a language switcher to the navigation header, allowing users to toggle between supported languages.
  • Enhancements

    • Updated all visible text to use translation keys, enabling dynamic language changes.
    • Refreshed project carousel content with new featured projects.
  • Chores

    • Added necessary translation files and internationalization configuration.
    • Integrated new dependencies for language detection and translation management.

… translations

- Added i18next and related packages for localization.
- Created English translation files for common phrases and specific content.
- Created Turkish translation files for common phrases and specific content.
- Added a translations.json file to manage language keys and translations.
@coderabbitai
Copy link

coderabbitai bot commented Jul 25, 2025

"""

Walkthrough

Internationalization (i18n) support is introduced throughout the application. This includes adding translation resource files for English and Turkish, configuring i18n libraries, updating components to use translation hooks, and integrating a language switcher UI. Next.js and package configuration files are updated to support multilingual routing and translation management.

Changes

Files/Groups Change Summary
components/languageSwitcher/LanguageSwitcher.js Added a new LanguageSwitcher React component for switching languages using react-i18next.
components/nav.js Imported and rendered LanguageSwitcher in the navigation header.
lib/i18n.js Introduced i18n configuration using i18next, react-i18next, and language detector plugins.
next-i18next.config.js, next.config.mjs Added Next.js i18n configuration and integrated it into the main config.
package.json Added dependencies for i18next, react-i18next, next-i18next, and language detector.
pages/index.js Replaced hardcoded UI strings with translation keys via useTranslation hook.
public/locales/en/common.json, public/locales/tr/common.json, translations.json Added basic translation JSON files for English and Turkish.
public/locales/en/index.json, public/locales/en/translation.json, public/locales/tr/translation.json Added extensive translation resource files for English and Turkish, covering UI content and metadata.
lib/carousel.json Replaced carousel project entries with new ones, updating titles, descriptions, images, and links.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant LanguageSwitcher
    participant i18n
    participant UIComponent

    User->>LanguageSwitcher: Clicks language button
    LanguageSwitcher->>i18n: i18n.changeLanguage(lang)
    i18n-->>UIComponent: Triggers re-render with new language
    UIComponent->>i18n: useTranslation() retrieves strings
    UIComponent-->>User: Displays UI in selected language
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–20 minutes

Poem

🐰
Hop, hop, a switch of tongue—
Now Turkish or English, all in one!
With flags and buttons, joy anew,
The code now speaks to more than a few.
Translations bloom, the UI sings,
Multilingual magic—what delight it brings!
🌍✨
"""

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 00f229e and a37b252.

📒 Files selected for processing (1)
  • next-i18next.config.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • next-i18next.config.js
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file 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.

Copy link

@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: 4

🔭 Outside diff range comments (5)
pages/index.js (5)

654-669: Complete internationalization for this section.

This section contains hardcoded English text that should be internationalized to match the rest of the page. The text "Connect with builders from the community" and related content should use translation keys.

Consider adding translation keys for this section:

-              <Text variant="title" sx={{ fontSize: ['36px', 4, 5] }}>
-                Connect with{' '}
-                <Text
-                  as="span"
-                  sx={{
-                    borderRadius: 'default',
-                    px: 2,
-                    mx: 0,
-                    whiteSpace: 'nowrap',
-                    color: 'white',
-                    bg: 'red'
-                  }}
-                >
-                  builders
-                </Text>{' '}
-                from the community
-              </Text>
-              <Text
-                variant="subtitle"
-                as="p"
-                sx={{ fontSize: ['18px', '20px', '22px'], pb: [3, 0, 0] }}
-              >
-                We gather both online and in-person to share our love of code
-                and make things together!
-              </Text>
+              <Text variant="title" sx={{ fontSize: ['36px', 4, 5] }}>
+                {t('connect.title')}
+              </Text>
+              <Text
+                variant="subtitle"
+                as="p"
+                sx={{ fontSize: ['18px', '20px', '22px'], pb: [3, 0, 0] }}
+              >
+                {t('connect.subtitle')}
+              </Text>

719-746: Complete internationalization for the open source section.

This section contains hardcoded English text including "We build open source games and tools together" and related content that should be internationalized.

Add translation keys for this section to ensure consistent multilingual support across the entire page.


857-882: Complete internationalization for the IRL community section.

The "Find your IRL community" section and its subtitle contain hardcoded English text that should use translation keys for consistency with the rest of the internationalized content.


910-935: Complete internationalization for the recap section.

The recap section includes hardcoded text like "We've got a lot going on - Let's recap" and "Find your second home at HHS" that should be internationalized.


998-1117: Complete internationalization for the action cards.

The three action cards contain hardcoded English text for titles and descriptions ("Join Our Community", "Explore Our Open Source Tools", "Start A Club") that should use translation keys.

🧹 Nitpick comments (9)
translations.json (1)

1-10: Prefer per-locale resource files over a single translations.json

i18next (and next-i18next) look for translation namespaces inside public/locales/<lng>/<ns>.json.
Keeping an additional root-level translations.json with duplicate keys:

  • introduces another source of truth that can easily diverge from the canonical public/locales/* files,
  • is not loaded automatically by the library, so the data is effectively unused unless extra plumbing is added.

Consider deleting this file and consolidating the strings under the existing public/locales/{en,tr}/common.json (or another namespace) to avoid drift.

public/locales/en/common.json (1)

1-4: Minor: drop punctuation to keep keys identical across locales

Key "welcome" carries "Welcome!" here but "Welcome" in other files.
Uniform values (and punctuation) simplify copy-editing and avoid accidental fallback mismatches.

No functional impact; treat as style guidance.

public/locales/tr/common.json (1)

1-4: Align punctuation with English counterpart

Same note as above – consider removing the exclamation mark or adding it to both locales for consistency.

public/locales/en/index.json (1)

1-9: Consider consolidating translation files for better maintainability.

The JSON structure and content are well-organized. However, having separate files like index.json, translation.json, and common.json might lead to confusion about where to place new translations. Consider consolidating into a single main translation file or establish clear guidelines for file organization.

components/languageSwitcher/LanguageSwitcher.js (2)

20-41: Enhance accessibility and add responsive considerations.

Consider adding accessibility attributes and responsive behavior for mobile devices.

        <Button
          key={lang.code}
          onClick={() => changeLanguage(lang.code)}
          variant={i18n.language === lang.code ? 'primary' : 'outline'}
+         aria-label={`Switch to ${lang.name}`}
+         aria-pressed={i18n.language === lang.code}
          sx={{
            fontSize: 1,
            py: 1,
            px: 2,
            display: 'flex',
            alignItems: 'center',
            gap: 1,
            cursor: 'pointer',
            opacity: i18n.language === lang.code ? 1 : 0.7,
+           '@media (max-width: 48em)': {
+             fontSize: 0,
+             px: 1
+           },
            '&:hover': {
              opacity: 1
            }
          }}
        >

11-14: Consider making language configuration external.

Hardcoding the language list limits flexibility. Consider moving this to a configuration file or making it configurable via props.

-  const languages = [
-    { code: 'en', name: 'English', flag: '🇺🇸' },
-    { code: 'tr', name: 'Türkçe', flag: '🇹🇷' }
-  ]
+  const languages = [
+    { code: 'en', name: t('english'), flag: '🇺🇸' },
+    { code: 'tr', name: t('turkish'), flag: '🇹🇷' }
+  ]
public/locales/tr/translation.json (1)

89-93: Consider consistency in terminology translation.

Ensure consistent translation of technical terms throughout the application. For example, "Hack Kulüpleri" for "Hack Clubs" should be used consistently across all translation files.

pages/index.js (1)

47-48: Verify if the i18n import is necessary.

The i18n import on line 47 doesn't appear to be used directly in the component. Only the useTranslation hook is utilized. Consider removing the unused import unless it's required for initialization.

-import i18n from '../lib/i18n'
 import { useTranslation } from 'react-i18next'
lib/i18n.js (1)

1-56: Well-configured i18n setup with a potential optimization opportunity.

The i18n configuration is comprehensive and follows best practices:

  • Proper plugin integration for language detection and React
  • Appropriate fallback language and debug settings
  • Comprehensive language detection strategy
  • Correct React integration options

However, consider lazy-loading translation files for better performance:

For better bundle optimization, consider using dynamic imports for translation files:

-// Import translation files
-import enTranslations from '../public/locales/en/translation.json'
-import trTranslations from '../public/locales/tr/translation.json'

 i18n
   .use(LanguageDetector)
   .use(initReactI18next)
   .init({
     debug: process.env.NODE_ENV === 'development',
     fallbackLng: 'en',
     interpolation: {
       escapeValue: false,
     },
-    resources: {
-      en: {
-        translation: enTranslations
-      },
-      tr: {
-        translation: trTranslations
-      }
-    },
+    // Load resources dynamically
+    resources: {},
+    
+    // Backend configuration for loading translations
+    backend: {
+      loadPath: '/locales/{{lng}}/{{ns}}.json',
+    },

This approach would require adding i18next-http-backend plugin but would improve initial bundle size.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fbe7909 and f62338f.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (13)
  • components/languageSwitcher/LanguageSwitcher.js (1 hunks)
  • components/nav.js (3 hunks)
  • lib/i18n.js (1 hunks)
  • next-i18next.config.js (1 hunks)
  • next.config.mjs (2 hunks)
  • package.json (2 hunks)
  • pages/index.js (13 hunks)
  • public/locales/en/common.json (1 hunks)
  • public/locales/en/index.json (1 hunks)
  • public/locales/en/translation.json (1 hunks)
  • public/locales/tr/common.json (1 hunks)
  • public/locales/tr/translation.json (1 hunks)
  • translations.json (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
components/nav.js (1)
components/languageSwitcher/LanguageSwitcher.js (1)
  • LanguageSwitcher (4-44)
components/languageSwitcher/LanguageSwitcher.js (1)
pages/index.js (1)
  • useTranslation (76-76)
pages/index.js (2)
components/languageSwitcher/LanguageSwitcher.js (1)
  • useTranslation (5-5)
pages/fiscal-sponsorship/open-source.js (1)
  • Link (25-32)
🔇 Additional comments (9)
package.json (1)

54-56: i18n package compatibility verified – no peer-dependency warnings
Ran npm ls i18next react-i18next next-i18next and confirmed all versions (i18next@25.3.2, react-i18next@15.6.1, next-i18next@15.4.2) resolve without unmet peer dependencies.

next.config.mjs (2)

29-29: LGTM: Proper i18n integration.

The i18n configuration is correctly integrated into the Next.js config following the standard pattern for next-i18next.


1-1: ✅ i18n Configuration Verified

The referenced next-i18next.config.js file exists and exports a valid i18n config:

  • locales: ['en', 'tr']
  • defaultLocale: 'en'
  • localeDetection: true

No further changes needed—your import and i18n property in next.config.mjs are correctly configured.

components/nav.js (1)

10-10: LGTM: Clean component import.

The import follows the project's convention for component imports.

public/locales/tr/translation.json (1)

1-95: Comprehensive Turkish translations with well-organized structure.

The translation file is comprehensive and well-structured with logical key organization. The nested structure makes it easy to understand the context of each translation.

pages/index.js (1)

238-607: Well-implemented translation key usage.

The translation keys are well-structured, semantic, and follow a logical hierarchy. The implementation correctly uses the useTranslation hook and applies translations consistently throughout the internationalized sections.

lib/i18n.js (1)

33-48: Excellent language detection configuration.

The language detection setup is comprehensive and well-ordered:

  • Prioritizes explicit user choices (query string, cookie, localStorage)
  • Falls back to browser defaults appropriately
  • Implements proper caching strategy
  • Sets reasonable cookie expiration (7 days)
public/locales/en/translation.json (2)

1-104: Well-structured translation file with comprehensive coverage.

The translation file demonstrates excellent organization:

  • Clear hierarchical structure with logical groupings
  • Semantic key names that are easy to understand and maintain
  • Comprehensive coverage of UI elements and content
  • Proper JSON formatting and structure

The nested structure (e.g., joyOfCode.steps.connect.title) makes it easy to organize related translations and maintain consistency.


22-41: Excellent content structure for the joyOfCode section.

The step-by-step content is well-structured with clear titles and engaging descriptions. The nested organization makes it easy to maintain and translate this content consistently across languages.


return (
<Flex sx={{ gap: 2, alignItems: 'center' }}>
<Text sx={{ fontSize: 1, fontWeight: 'bold' }}>Language:</Text>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Make the "Language:" label translatable.

The label is hardcoded in English, which defeats the purpose of internationalization. It should use a translation key.

-      <Text sx={{ fontSize: 1, fontWeight: 'bold' }}>Language:</Text>
+      <Text sx={{ fontSize: 1, fontWeight: 'bold' }}>{t('language')}:</Text>

And add the translation key to your locale files:

{
  "language": "Language"
}
🤖 Prompt for AI Agents
In components/languageSwitcher/LanguageSwitcher.js at line 18, the "Language:"
label is hardcoded in English, which breaks internationalization. Replace the
hardcoded text with a translation function call using a key like "language".
Then, add the "language" key with the value "Language" to your locale JSON files
to support translations.

color={baseColor}
dark={dark}
/>
<LanguageSwitcher />
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify responsive behavior of the language switcher.

The LanguageSwitcher is well-positioned in the navigation. However, ensure it behaves appropriately on mobile devices where navigation collapses.


🏁 Script executed:

#!/bin/bash
# Description: Check if LanguageSwitcher has responsive considerations
# Expected: Component should handle mobile layouts appropriately

# Look for responsive styles in the LanguageSwitcher component
rg -A 10 -B 5 "@media|sx.*display|mobile" components/languageSwitcher/LanguageSwitcher.js

Length of output: 91


We didn’t locate any responsive rules with the previous grep. Let’s first find the exact LanguageSwitcher file and then inspect it for breakpoints or media queries:


🏁 Script executed:

#!/bin/bash
# 1. Locate the LanguageSwitcher component file
rg -l "export.*LanguageSwitcher" -g "*.js" -g "*.jsx" -g "*.ts" -g "*.tsx"

# 2. If found, inspect for responsive patterns
FILE=$(rg -l "export.*LanguageSwitcher" -g "*.js" -g "*.jsx" -g "*.ts" -g "*.tsx" | head -n1)
if [ -n "$FILE" ]; then
  echo "🔍 Inspecting $FILE for responsive styling…"
  echo "--- @media queries ---"
  rg -n -C 3 "@media" "$FILE"
  echo "--- sx props ---"
  rg -n -C 3 "sx=" "$FILE"
  echo "--- useMediaQuery hook ---"
  rg -n -C 3 "useMediaQuery" "$FILE"
else
  echo "❌ LanguageSwitcher component file not found"
fi

Length of output: 1335


Ensure LanguageSwitcher adapts to mobile layouts

The LanguageSwitcher currently uses a static <Flex> layout without any breakpoints, media queries, or conditional rendering. On narrow viewports it may overflow or clash with the collapsed nav. Please add responsive handling so it either hides or reflows appropriately.

• File: components/languageSwitcher/LanguageSwitcher.js
Lines: ~16–27

  • No @media queries detected
  • No useMediaQuery usage
  • All sx props use fixed values

Suggestions:

  • Wrap in a conditional display component (e.g. <Hide below="md"> / <Show above="sm">)
  • Or update sx to use responsive arrays, for example:
    <Flex
  • sx={{ gap: 2, alignItems: 'center' }}
  • sx={{
  • display: ['none', 'flex'],      // hidden on xs, shown on sm+
    
  • gap: 2,
    
  • alignItems: 'center'
    
  • }}
- Alternatively, use `useMediaQuery` to switch between desktop and mobile UI

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion
// components/languageSwitcher/LanguageSwitcher.js

// … somewhere around lines 16–27 …

return (
<Flex
  sx={{
    display: ['none', 'flex'],    // hidden on xs, shown on sm+
    gap: 2,
    alignItems: 'center'
  }}
>
  {/* …existing children (e.g. language buttons) */}
</Flex>
);

// …
🤖 Prompt for AI Agents
In components/nav.js at line 231, the LanguageSwitcher component lacks
responsive design and may overflow on narrow viewports. To fix this, update the
LanguageSwitcher usage by wrapping it in a conditional display component like
<Hide below="md"> or <Show above="sm"> to hide it on small screens, or modify
its sx props in components/languageSwitcher/LanguageSwitcher.js (lines ~16–27)
to use responsive arrays for layout values. Alternatively, implement
useMediaQuery inside LanguageSwitcher to render different layouts based on
screen size.

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.

1 participant