-
Notifications
You must be signed in to change notification settings - Fork 59.7k
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
Use i18n for DISCOVERY #5920
base: main
Are you sure you want to change the base?
Use i18n for DISCOVERY #5920
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@fishshi is attempting to deploy a commit to the NextChat Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe changes in this pull request involve modifications to the sidebar component and localization files. The Changes
Possibly related PRs
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (1)
app/locales/cn.ts (1)
632-634
: Consider expanding Discovery section translations.Given that this PR focuses on enhancing i18n for the DISCOVERY feature, consider adding translations for additional Discovery-related UI elements such as:
- Section descriptions
- Feature explanations
- Action buttons
- Error messages
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (4)
app/components/sidebar.tsx
(3 hunks)app/constant.ts
(0 hunks)app/locales/cn.ts
(2 hunks)app/locales/tw.ts
(1 hunks)
💤 Files with no reviewable changes (1)
- app/constant.ts
🔇 Additional comments (5)
app/locales/cn.ts (3)
179-179
: LGTM! Comment translation improves clarity for Chinese developers.
The translation of the comment maintains the critical instruction while making it more accessible to Chinese developers.
633-633
: LGTM! Improved clarity in search functionality label.
The change from "搜索" to "搜索聊天记录" provides better context about the search functionality, making it clearer that users are specifically searching chat records.
632-634
: Verify translation usage in components.
Let's verify how these translations are being used in the components:
✅ Verification successful
Translation changes are properly integrated and used.
The verification shows that:
- The
SearchChat
translation is consistently used across all language files (ar, bn, cn, cs, de, en, es, fr, id, it, jp, ko, no, pt, ru, sk, tr, tw, vi). - The translation is actively used in the search-chat component (
app/components/search-chat.tsx
) throughLocale.SearchChat.Page.Title
,Locale.SearchChat.Page.SubTitle
, andLocale.SearchChat.Item.View
. - The component is properly integrated into the application's routing system via
Path.SearchChat
constant. - The changes in the Chinese translation file (
cn.ts
) align with the translation structure used throughout the application.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for usage of SearchChat and Discovery translations
echo "Searching for SearchChat translation usage..."
rg -A 2 "SearchChat.*Name" --type ts --type tsx
echo "Searching for Discovery translation usage..."
rg -A 2 "Discovery.*Name" --type ts --type tsx
Length of output: 354
Script:
#!/bin/bash
# Search for SearchChat translation usage with correct file type
echo "Searching for SearchChat translation usage..."
rg "SearchChat" --type typescript
# Search for files that might be using these translations
echo -e "\nSearching for potential component files..."
fd -e tsx -e ts
Length of output: 3465
Script:
#!/bin/bash
# Search for SearchChat usage with rg without file type specification
echo "Searching for SearchChat usage..."
rg "SearchChat" -A 2
# Specifically check the search-chat component
echo -e "\nChecking search-chat component implementation..."
cat app/components/search-chat.tsx
Length of output: 9163
app/components/sidebar.tsx (2)
227-227
: LGTM: State variable renamed appropriately
The state variable rename from showPluginSelector
to showDiscoverySelector
aligns with the new Discovery feature and maintains clear naming conventions.
262-262
: Implementation looks good, verify path constants
The UI interaction changes are implemented correctly, maintaining the same user experience while updating to use the new Discovery feature.
Let's verify that all paths used in the DISCOVERY constant are properly defined:
Also applies to: 266-276
✅ Verification successful
Path constants are properly defined and used correctly
The verification confirms that all paths used in the DISCOVERY constant (Path.Plugins
, Path.Sd
, Path.SearchChat
) are properly defined in the Path
enum in app/constant.ts
and are used consistently throughout the codebase. The implementation maintains proper type safety and routing integrity.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that all paths used in DISCOVERY are defined in Path constant
# Search for Path constant definition
echo "Searching for Path constant definition..."
rg --type typescript "export (?:const|enum|type) Path\s*=" -A 10
# Verify specific path usage
echo "Verifying specific paths..."
rg --type typescript "Path\.(Plugins|Sd|SearchChat)\b" -A 1
Length of output: 356
Script:
#!/bin/bash
# Let's try without typescript file type specification and search for Path definitions
echo "Searching for Path constant definition..."
rg "export (?:const|enum|type) Path\s*=" -A 10
# Search for DISCOVERY constant to understand path usage
echo "Searching for DISCOVERY constant..."
rg "export const DISCOVERY\s*=" -A 10
# Search for specific path usages without typescript specification
echo "Verifying path usages..."
rg "Path\.(Plugins|Sd|SearchChat)\b" -A 1
Length of output: 1401
Script:
#!/bin/bash
# Let's find the Path enum/constant definition
echo "Searching for Path definition in constants or types..."
rg -g "*.{ts,tsx}" "(?:enum|const|type)\s+Path\s*[=]?" -B 2 -A 10
# Also search for any imports of Path to find its source
echo "Searching for Path imports..."
rg -g "*.{ts,tsx}" "import.*Path.*from" -B 1 -A 1
Length of output: 4356
@@ -485,7 +485,7 @@ const tw = { | |||
}, | |||
}, | |||
SearchChat: { | |||
Name: "搜尋", | |||
Name: "搜尋聊天記錄", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Translations need to be updated for consistency across language files
Only Traditional Chinese (tw) and Simplified Chinese (cn) use the more descriptive "Search Chat Records" translation, while other languages use a simpler "Search" translation. For consistency in user experience:
- Update the following translations to be more descriptive about searching chat records:
- English (en): "Search" → "Search Chat"
- Japanese (jp): "検索" → "チャット検索"
- Korean (ko): "검색" → "채팅 검색"
- Spanish (es): "Buscar" → "Buscar Chat"
- French (fr): "Recherche" → "Rechercher les discussions"
- German (de): "Suche" → "Chat durchsuchen"
- And similar descriptive updates for other language files
🔗 Analysis chain
LGTM! The translation update improves clarity.
The change from "搜尋" to "搜尋聊天記錄" makes the functionality clearer by explicitly stating that the search is for chat records.
Let's verify the consistency of this translation across other language files:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if the SearchChat.Name translation is consistent across language files
# Expected: All language files should have similarly descriptive translations
# Search for SearchChat.Name in all locale files
rg -A 1 "SearchChat: \{" app/locales/
Length of output: 1450
const DISCOVERY = [ | ||
{ name: Locale.Plugin.Name, path: Path.Plugins }, | ||
{ name: "Stable Diffusion", path: Path.Sd }, | ||
{ name: Locale.SearchChat.Page.Title, path: Path.SearchChat }, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Maintain i18n consistency across all DISCOVERY items
The "Stable Diffusion" string is hardcoded while other entries use localization. This inconsistency could cause issues when supporting multiple languages.
Consider using i18n for all strings:
const DISCOVERY = [
{ name: Locale.Plugin.Name, path: Path.Plugins },
- { name: "Stable Diffusion", path: Path.Sd },
+ { name: Locale.Discovery.StableDiffusion, path: Path.Sd },
{ name: Locale.SearchChat.Page.Title, path: Path.SearchChat },
];
Committable suggestion skipped: line range outside the PR's diff.
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
📝 补充信息 | Additional Information
Page.Title
instead ofName
for SearchChat, as the latter's semantics in the i18n file seem incomplete (only covering "Search" without "Chat").Summary by CodeRabbit
New Features
Bug Fixes
Documentation