From 1e49b7ecb1fc42d0c7b05ef929078e57e6affe92 Mon Sep 17 00:00:00 2001 From: Abner Chou Date: Mon, 24 Jul 2023 08:33:08 -0400 Subject: [PATCH] Support localization for Nav components (#688) * init localization * Update defaul to en * Fix merge issue and import path. * Set default to en * Change jsx to tsx * Update the password max length string. * Remove languageContext as using the recoil instead. * Add localization to component endpoints pages * Revert default to en after testing. * Update LoginForm.tsx * Fix translation. * Make lint happy * Merge (#1) * Create deploy.yml * Add localization support for endpoint pages components (#667) * init localization * Update defaul to en * Fix merge issue and import path. * Set default to en * Change jsx to tsx * Update the password max length string. * Remove languageContext as using the recoil instead. * Add localization to component endpoints pages * Revert default to en after testing. * Update LoginForm.tsx * Fix translation. * Make lint happy * Add a restart to melisearch in docker-compose.yml (#684) * Oauth fixes for Cognito (#686) * Add a restart to melisearch in docker-compose.yml * Oauth fixes for Cognito * Use the username or email for full name from oath if not provided --------- Co-authored-by: Donavan * Italian localization support for endpoint (#687) --------- Co-authored-by: Danny Avila <110412045+danny-avila@users.noreply.github.com> Co-authored-by: Donavan Stanley Co-authored-by: Donavan Co-authored-by: Marco Beretta <81851188+Berry-13@users.noreply.github.com> * Translate Nav pages * Fix npm test --------- Co-authored-by: Danny Avila <110412045+danny-avila@users.noreply.github.com> Co-authored-by: Donavan Stanley Co-authored-by: Donavan Co-authored-by: Marco Beretta <81851188+Berry-13@users.noreply.github.com> --- client/src/components/Auth/Registration.tsx | 6 +- .../components/Endpoints/EditPresetDialog.jsx | 2 +- .../Endpoints/EndpointOptionsDialog.jsx | 2 +- .../Endpoints/Plugins/AgentSettings.jsx | 7 +- .../Endpoints/Plugins/OptionHover.jsx | 24 +-- .../components/Endpoints/Plugins/Settings.jsx | 39 ++++- .../Endpoints/SaveAsPresetDialog.jsx | 4 +- client/src/components/Nav/ClearConvos.tsx | 7 +- .../Nav/ExportConversation/ExportModel.jsx | 27 +-- .../Nav/ExportConversation/index.jsx | 4 +- client/src/components/Nav/Logout.jsx | 8 +- client/src/components/Nav/MobileNav.jsx | 8 +- client/src/components/Nav/NavLinks.jsx | 12 +- client/src/components/Nav/SearchBar.jsx | 6 +- client/src/components/Nav/Settings.jsx | 7 +- .../SettingsTabs/ClearChatsButton.spec.tsx | 13 +- .../components/Nav/SettingsTabs/General.tsx | 81 +++++---- .../Nav/SettingsTabs/ThemeSelector.spec.tsx | 11 +- client/src/components/Nav/index.jsx | 6 +- client/src/localization/Translation.tsx | 9 +- client/src/localization/languages/Eng.tsx | 37 ++++- client/src/localization/languages/Zh.tsx | 156 ++++++++++++++---- 22 files changed, 346 insertions(+), 130 deletions(-) diff --git a/client/src/components/Auth/Registration.tsx b/client/src/components/Auth/Registration.tsx index dec1361079..495bc84c61 100644 --- a/client/src/components/Auth/Registration.tsx +++ b/client/src/components/Auth/Registration.tsx @@ -55,13 +55,15 @@ function Registration() { return (
-

Create your account

+

+ {localize(lang, 'com_auth_create_account')} +

{error && (
- There was an error attempting to register your account. Please try again. {errorMessage} + {localize(lang, 'com_auth_error_create')} {errorMessage}
)}
{ return ( diff --git a/client/src/components/Endpoints/EndpointOptionsDialog.jsx b/client/src/components/Endpoints/EndpointOptionsDialog.jsx index ffd2660ce8..c147b178d9 100644 --- a/client/src/components/Endpoints/EndpointOptionsDialog.jsx +++ b/client/src/components/Endpoints/EndpointOptionsDialog.jsx @@ -48,7 +48,7 @@ const EndpointOptionsDialog = ({ open, onOpenChange, preset: _preset, title }) = <> diff --git a/client/src/components/Endpoints/Plugins/AgentSettings.jsx b/client/src/components/Endpoints/Plugins/AgentSettings.jsx index a36dcde029..1ff09ffd95 100644 --- a/client/src/components/Endpoints/Plugins/AgentSettings.jsx +++ b/client/src/components/Endpoints/Plugins/AgentSettings.jsx @@ -46,7 +46,7 @@ function Settings(props) {
@@ -24,7 +24,7 @@ function OptionHover({ type, side }) { // {...options} >
-

{types[type]}

+

{localize(lang, types[type])}

diff --git a/client/src/components/Endpoints/Plugins/Settings.jsx b/client/src/components/Endpoints/Plugins/Settings.jsx index d1a8043cb2..d1afa7bab3 100644 --- a/client/src/components/Endpoints/Plugins/Settings.jsx +++ b/client/src/components/Endpoints/Plugins/Settings.jsx @@ -55,7 +55,7 @@ function Settings(props) {
{ }; useEffect(() => { - setTitle(preset?.title || 'My Preset'); + setTitle(preset?.title || localize(lang, 'com_endpoint_my_preset')); // eslint-disable-next-line react-hooks/exhaustive-deps }, [open]); return (