chore: Translation Fixes, Lint Error Corrections, and Additional Translations (#788)

* fix translation and small lint error

* changed from localize to useLocalize hook

* changed to useLocalize
This commit is contained in:
Marco Beretta 2023-08-14 17:51:03 +02:00 committed by GitHub
parent b64cc71d88
commit 74802dd720
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 421 additions and 421 deletions

View file

@ -4,10 +4,10 @@ import { useResetPasswordMutation, TResetPassword } from 'librechat-data-provide
import { useNavigate, useSearchParams } from 'react-router-dom';
import { useRecoilValue } from 'recoil';
import store from '~/store';
import { localize } from '~/localization/Translation';
import { useLocalize } from '~/hooks';
function ResetPassword() {
const lang = useRecoilValue(store.lang);
const localize = useLocalize();
const {
register,
handleSubmit,
@ -33,20 +33,20 @@ function ResetPassword() {
<div className="flex min-h-screen flex-col items-center justify-center bg-white pt-6 sm:pt-0">
<div className="mt-6 w-96 overflow-hidden bg-white px-6 py-4 sm:max-w-md sm:rounded-lg">
<h1 className="mb-4 text-center text-3xl font-semibold">
{localize(lang, 'com_auth_reset_password_success')}
{localize('com_auth_reset_password_success')}
</h1>
<div
className="relative mb-8 mt-4 rounded border border-green-400 bg-green-100 px-4 py-3 text-center text-green-700"
role="alert"
>
{localize(lang, 'com_auth_login_with_new_password')}
{localize('com_auth_login_with_new_password')}
</div>
<button
onClick={() => navigate('/login')}
aria-label={localize(lang, 'com_auth_sign_in')}
aria-label={localize('com_auth_sign_in')}
className="w-full transform rounded-sm bg-green-500 px-4 py-3 tracking-wide text-white transition-colors duration-200 hover:bg-green-600 focus:bg-green-600 focus:outline-none"
>
{localize(lang, 'com_auth_continue')}
{localize('com_auth_continue')}
</button>
</div>
</div>
@ -56,18 +56,18 @@ function ResetPassword() {
<div className="flex min-h-screen flex-col items-center justify-center bg-white pt-6 sm:pt-0">
<div className="mt-6 w-96 overflow-hidden bg-white px-6 py-4 sm:max-w-md sm:rounded-lg">
<h1 className="mb-4 text-center text-3xl font-semibold">
{localize(lang, 'com_auth_reset_password')}
{localize('com_auth_reset_password')}
</h1>
{resetError && (
<div
className="relative mt-4 rounded border border-red-400 bg-red-100 px-4 py-3 text-red-700"
role="alert"
>
{localize(lang, 'com_auth_error_invalid_reset_token')}{' '}
{localize('com_auth_error_invalid_reset_token')}{' '}
<a className="font-semibold text-green-600 hover:underline" href="/forgot-password">
{localize(lang, 'com_auth_click_here')}
{localize('com_auth_click_here')}
</a>{' '}
{localize(lang, 'com_auth_to_try_again')}
{localize('com_auth_to_try_again')}
</div>
)}
<form
@ -96,16 +96,16 @@ function ResetPassword() {
type="password"
id="password"
autoComplete="current-password"
aria-label={localize(lang, 'com_auth_password')}
aria-label={localize('com_auth_password')}
{...register('password', {
required: localize(lang, 'com_auth_password_required'),
required: localize('com_auth_password_required'),
minLength: {
value: 8,
message: localize(lang, 'com_auth_password_min_length'),
message: localize('com_auth_password_min_length'),
},
maxLength: {
value: 128,
message: localize(lang, 'com_auth_password_max_length'),
message: localize('com_auth_password_max_length'),
},
})}
aria-invalid={!!errors.password}
@ -116,7 +116,7 @@ function ResetPassword() {
htmlFor="password"
className="absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500"
>
{localize(lang, 'com_auth_password')}
{localize('com_auth_password')}
</label>
</div>
@ -132,7 +132,7 @@ function ResetPassword() {
<input
type="password"
id="confirm_password"
aria-label={localize(lang, 'com_auth_password_confirm')}
aria-label={localize('com_auth_password_confirm')}
// uncomment to prevent pasting in confirm field
onPaste={(e) => {
e.preventDefault();
@ -140,7 +140,7 @@ function ResetPassword() {
}}
{...register('confirm_password', {
validate: (value) =>
value === password || localize(lang, 'com_auth_password_not_match'),
value === password || localize('com_auth_password_not_match'),
})}
aria-invalid={!!errors.confirm_password}
className="peer block w-full appearance-none rounded-t-md border-0 border-b-2 border-gray-300 bg-gray-50 px-2.5 pb-2.5 pt-5 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-0"
@ -150,7 +150,7 @@ function ResetPassword() {
htmlFor="confirm_password"
className="absolute left-2.5 top-4 z-10 origin-[0] -translate-y-4 scale-75 transform text-sm text-gray-500 duration-300 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:text-green-500"
>
{localize(lang, 'com_auth_password_confirm')}
{localize('com_auth_password_confirm')}
</label>
</div>
{errors.confirm_password && (
@ -176,10 +176,10 @@ function ResetPassword() {
<button
disabled={!!errors.password || !!errors.confirm_password}
type="submit"
aria-label={localize(lang, 'com_auth_submit_registration')}
aria-label={localize('com_auth_submit_registration')}
className="w-full transform rounded-sm bg-green-500 px-4 py-3 tracking-wide text-white transition-colors duration-200 hover:bg-green-600 focus:bg-green-600 focus:outline-none"
>
{localize(lang, 'com_auth_continue')}
{localize('com_auth_continue')}
</button>
</div>
</form>