mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-27 04:44:10 +01:00
🌐 refactor: Interpolate Localization Keys (#10650)
* fix: replace string concatenation of localization keys with interpolations and add keys for unlocalized string literals * chore: update test for new localization key --------- Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
parent
0f8ed6e737
commit
3e8cb01f84
28 changed files with 130 additions and 85 deletions
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable i18next/no-literal-string */
|
||||
import { Button } from '@librechat/client';
|
||||
import { useRouteError } from 'react-router-dom';
|
||||
import { useLocalize } from '~/hooks';
|
||||
|
|
@ -132,12 +131,12 @@ export default function RouteErrorBoundary() {
|
|||
>
|
||||
<div className="bg-surface-primary/60 mx-4 w-11/12 max-w-4xl rounded-2xl border border-border-light p-8 shadow-2xl backdrop-blur-xl">
|
||||
<h2 className="mb-6 text-center text-3xl font-medium tracking-tight text-text-primary">
|
||||
Oops! Something Unexpected Occurred
|
||||
{localize('com_ui_error_unexpected')}
|
||||
</h2>
|
||||
|
||||
{/* Error Message */}
|
||||
<div className="mb-4 rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-sm text-gray-600 dark:text-gray-200">
|
||||
<h3 className="mb-2 font-medium">Error Message:</h3>
|
||||
<h3 className="mb-2 font-medium">{localize('com_ui_error_message_prefix')}</h3>
|
||||
<pre className="whitespace-pre-wrap text-sm font-light leading-relaxed text-text-primary">
|
||||
{errorDetails.message}
|
||||
</pre>
|
||||
|
|
@ -147,7 +146,7 @@ export default function RouteErrorBoundary() {
|
|||
{(typeof errorDetails.status === 'number' ||
|
||||
typeof errorDetails.statusText === 'string') && (
|
||||
<div className="mb-4 rounded-xl border border-yellow-500/20 bg-yellow-500/5 p-4 text-sm text-text-primary">
|
||||
<h3 className="mb-2 font-medium">Status:</h3>
|
||||
<h3 className="mb-2 font-medium">{localize('com_ui_status_prefix')}:</h3>
|
||||
<p className="text-text-primary">
|
||||
{typeof errorDetails.status === 'number' && `${errorDetails.status} `}
|
||||
{typeof errorDetails.statusText === 'string' && errorDetails.statusText}
|
||||
|
|
@ -159,7 +158,7 @@ export default function RouteErrorBoundary() {
|
|||
{errorDetails.stack != null && errorDetails.stack.trim() !== '' && (
|
||||
<details className="group mb-4 rounded-xl border border-border-light p-4">
|
||||
<summary className="mb-2 flex cursor-pointer items-center justify-between text-sm font-medium text-text-primary">
|
||||
<span>Stack Trace</span>
|
||||
<span>{localize('com_ui_stack_trace')}</span>
|
||||
<div className="flex items-center">
|
||||
<Button
|
||||
variant="outline"
|
||||
|
|
@ -168,7 +167,7 @@ export default function RouteErrorBoundary() {
|
|||
className="ml-2 px-2 py-1 text-xs"
|
||||
aria-label={localize('com_ui_copy_stack_trace')}
|
||||
>
|
||||
Copy
|
||||
{localize('com_ui_copy')}
|
||||
</Button>
|
||||
</div>
|
||||
</summary>
|
||||
|
|
@ -191,7 +190,7 @@ export default function RouteErrorBoundary() {
|
|||
{errorDetails.data != null && (
|
||||
<details className="group mb-4 rounded-xl border border-border-light p-4">
|
||||
<summary className="mb-2 flex cursor-pointer items-center justify-between text-sm font-medium text-text-primary">
|
||||
<span>Additional Details</span>
|
||||
<span>{localize('com_ui_additional_details')}</span>
|
||||
<span className="transition-transform group-open:rotate-90">{'>'}</span>
|
||||
</summary>
|
||||
<pre className="whitespace-pre-wrap text-xs font-light leading-relaxed text-text-primary">
|
||||
|
|
@ -201,12 +200,14 @@ export default function RouteErrorBoundary() {
|
|||
)}
|
||||
|
||||
<div className="mt-6 flex flex-col gap-4">
|
||||
<p className="text-sm font-light text-text-secondary">Please try one of the following:</p>
|
||||
<p className="text-sm font-light text-text-secondary">
|
||||
{localize('com_ui_error_try_following_prefix')}:
|
||||
</p>
|
||||
<ul className="list-inside list-disc text-sm text-text-secondary">
|
||||
<li>Refresh the page</li>
|
||||
<li>Clear your browser cache</li>
|
||||
<li>Check your internet connection</li>
|
||||
<li>Contact the Admin if the issue persists</li>
|
||||
<li>{localize('com_ui_refresh_page')}</li>
|
||||
<li>{localize('com_ui_clear_browser_cache')}</li>
|
||||
<li>{localize('com_ui_check_internet')}</li>
|
||||
<li>{localize('com_ui_contact_admin_if_issue_persists')}</li>
|
||||
</ul>
|
||||
<div className="mt-4 flex flex-col items-center gap-4 sm:flex-row sm:justify-center">
|
||||
<Button
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue