Skip to content

refactor(website): Separate search translations for each language into separate files#295

Merged
yamadashy merged 2 commits intomainfrom
reafact/i18n
Jan 18, 2025
Merged

refactor(website): Separate search translations for each language into separate files#295
yamadashy merged 2 commits intomainfrom
reafact/i18n

Conversation

@yamadashy
Copy link
Owner

@yamadashy yamadashy commented Jan 18, 2025

Checklist

  • Run npm run test
  • Run npm run lint

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@yamadashy yamadashy changed the title refactor(website): Separate search translations for each language int… refactor(website): Separate search translations for each language into separate files Jan 18, 2025
@codecov
Copy link

codecov bot commented Jan 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.20%. Comparing base (741c292) to head (6767833).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #295   +/-   ##
=======================================
  Coverage   92.20%   92.20%           
=======================================
  Files          44       44           
  Lines        2168     2168           
  Branches      474      474           
=======================================
  Hits         1999     1999           
  Misses        169      169           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 18, 2025

Deploying repomix with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6767833
Status: ✅  Deploy successful!
Preview URL: https://eec70b38.repomix.pages.dev
Branch Preview URL: https://reafact-i18n.repomix.pages.dev

View logs

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 18, 2025

📝 Walkthrough

Walkthrough

The pull request introduces localized search configurations for multiple languages (Spanish, Japanese, Korean, Portuguese, and Chinese) in the VitePress configuration. Each language-specific configuration file now includes a new export configXxxSearch that defines translations for search-related UI elements. The configShard.ts file has been updated to import these new search configurations, replacing previously hardcoded translations with imported localized search options. Additionally, a job for linting the Renovate configuration has been removed from the CI workflow.

Changes

File Change Summary
website/client/.vitepress/config/configEs.ts Added configEsSearch export with Spanish search translations
website/client/.vitepress/config/configJa.ts Added configJaSearch export with Japanese search translations
website/client/.vitepress/config/configKo.ts Added configKoSearch export with Korean search translations
website/client/.vitepress/config/configPtBr.ts Added configPtBrSearch export with Brazilian Portuguese search translations
website/client/.vitepress/config/configZhCn.ts Added configZhCnSearch export with Chinese search translations
website/client/.vitepress/config/configShard.ts Imported search configurations for multiple languages, removing hardcoded translations
.github/workflows/ci.yml Removed lint-renovate-config job from CI workflow

Possibly related PRs


📜 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 5cf760e and 6767833.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml (0 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/ci.yml
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Test (windows-latest, 23.x)
  • GitHub Check: Test (windows-latest, 22.x)
  • GitHub Check: Test (windows-latest, 19.x)
  • GitHub Check: Cloudflare Pages

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?

❤️ 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. (Beta)
  • @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
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 (3)
website/client/.vitepress/config/configShard.ts (1)

2-6: Consider grouping related imports together.

While the implementation is correct, consider organizing imports alphabetically for better maintainability:

-import { configEsSearch } from './configEs';
-import { configJaSearch } from './configJa';
-import { configKoSearch } from './configKo';
-import { configPtBrSearch } from './configPtBr';
-import { configZhCnSearch } from './configZhCn';
+import { configEsSearch } from './configEs';
+import { configJaSearch } from './configJa';
+import { configKoSearch } from './configKo';
+import { configPtBrSearch } from './configPtBr';
+import { configZhCnSearch } from './configZhCn';
website/client/.vitepress/config/configZhCn.ts (1)

45-65: LGTM! Well-structured search translations.

The search configuration is well-organized and includes all necessary UI elements. The language code 'zh-cn' correctly matches the main config.

Consider adding JSDoc comments to document the purpose of this configuration object, for example:

+/**
+ * Chinese (Simplified) search translations for VitePress's local search feature.
+ * @see https://vitepress.dev/reference/default-theme-search
+ */
export const configZhCnSearch: DefaultTheme.LocalSearchOptions['locales'] = {
website/client/.vitepress/config/configJa.ts (1)

45-65: LGTM! Consistent implementation with other language configs.

The Japanese search configuration follows the same structure and includes all necessary translations.

Consider adding JSDoc comments similar to other language configs:

+/**
+ * Japanese search translations for VitePress's local search feature.
+ * @see https://vitepress.dev/reference/default-theme-search
+ */
export const configJaSearch: DefaultTheme.LocalSearchOptions['locales'] = {
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 741c292 and 5cf760e.

📒 Files selected for processing (6)
  • website/client/.vitepress/config/configEs.ts (2 hunks)
  • website/client/.vitepress/config/configJa.ts (2 hunks)
  • website/client/.vitepress/config/configKo.ts (2 hunks)
  • website/client/.vitepress/config/configPtBr.ts (2 hunks)
  • website/client/.vitepress/config/configShard.ts (2 hunks)
  • website/client/.vitepress/config/configZhCn.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: Test (windows-latest, 23.x)
  • GitHub Check: Test (windows-latest, 22.x)
  • GitHub Check: Test (windows-latest, 21.x)
  • GitHub Check: Test (windows-latest, 20.x)
  • GitHub Check: Test (windows-latest, 19.x)
  • GitHub Check: Test (windows-latest, 18.x)
  • GitHub Check: Build and run (windows-latest, 22.x)
  • GitHub Check: Test (windows-latest, 18.0.0)
  • GitHub Check: Lint Renovate config
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (6)
website/client/.vitepress/config/configKo.ts (1)

45-65: Well-structured Korean search translations!

The implementation follows VitePress's localization pattern and includes all necessary UI elements with semantically correct Korean translations.

website/client/.vitepress/config/configEs.ts (1)

46-66: Consistent Spanish search translations implementation!

The Spanish translations follow the same well-structured pattern and include all necessary UI elements with proper translations.

website/client/.vitepress/config/configPtBr.ts (1)

46-66: Properly implemented Brazilian Portuguese search translations!

The implementation correctly uses the 'pt-br' locale key and maintains consistency with other language configurations.

website/client/.vitepress/config/configShard.ts (1)

35-39: Clean implementation of multilingual search configuration!

The use of spread operator to combine language-specific configurations is elegant and maintainable.

website/client/.vitepress/config/configZhCn.ts (1)

1-1: LGTM! Good practice with explicit type import.

The explicit type import from VitePress ensures proper type checking for the search configurations.

website/client/.vitepress/config/configJa.ts (1)

Line range hint 1-65: Verify consistency across all language configuration files.

Let's ensure all language configurations follow the same structure and have all required translations.

✅ Verification successful

All language configurations are consistent and complete

All language configuration files follow the same structure and contain all required translations. Language codes are properly set and consistent between config and search sections.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistency across all language configuration files

# Check if all language files have the same structure
echo "Checking language configuration files structure..."
rg -l "LocalSearchOptions\['locales'\]" website/client/.vitepress/config/

# Verify all required translation keys are present in each config
echo "\nVerifying translation keys..."
for key in "buttonText" "buttonAriaLabel" "noResultsText" "resetButtonTitle" "backButtonTitle" "displayDetails" "selectText" "navigateText" "closeText"; do
  echo "\nChecking presence of '$key':"
  rg --no-filename "^\s*$key:" website/client/.vitepress/config/config*.ts
done

# Check language code consistency
echo "\nVerifying language code consistency..."
rg -A 1 "lang: '([^']+)'" website/client/.vitepress/config/config*.ts
rg -A 1 "export const config\w+Search.*\n.*'([^']+)': {" website/client/.vitepress/config/config*.ts

Length of output: 9517

@yamadashy yamadashy merged commit 38063a0 into main Jan 18, 2025
54 checks passed
@yamadashy yamadashy deleted the reafact/i18n branch January 18, 2025 05:09
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