From 162cf9a691c6bec7bb490e0c2d9a56be110a7da7 Mon Sep 17 00:00:00 2001 From: Ayan Nayyer Date: Sat, 28 Jun 2025 15:49:11 +0530 Subject: [PATCH] tolgee-localisation Migrated User Facing Dashboard to Tolgee --- .tolgee/migration-status.json | 307 ++++++++++++++++++++++++++++++++++ src/user/AdminDashboard.js | 35 ++-- src/user/Profile.js | 23 ++- src/user/Signin.js | 38 +++-- src/user/Signup.js | 48 ++++-- src/user/UserDashboard.js | 36 ++-- 6 files changed, 431 insertions(+), 56 deletions(-) create mode 100644 .tolgee/migration-status.json diff --git a/.tolgee/migration-status.json b/.tolgee/migration-status.json new file mode 100644 index 0000000..46e0bce --- /dev/null +++ b/.tolgee/migration-status.json @@ -0,0 +1,307 @@ +{ + "src/user/AdminDashboard.js": { + "migrated": true, + "keys": [ + { + "name": "admin-links-header", + "description": "Header text for admin links section", + "default": "Admin Links" + }, + { + "name": "create-category-link", + "description": "Link text for creating a new category", + "default": "Create Category" + }, + { + "name": "create-place-link", + "description": "Link text for creating a new place", + "default": "Create Place" + }, + { + "name": "view-place-orders-link", + "description": "Link text for viewing place orders", + "default": "View place Orders" + }, + { + "name": "manage-places-link", + "description": "Link text for managing places", + "default": "Manage Places" + }, + { + "name": "manage-categories-link", + "description": "Link text for managing categories", + "default": "Manage categories" + }, + { + "name": "user-information-header", + "description": "Header text for user information section", + "default": "User Information" + }, + { + "name": "", + "description": "Text displayed for admin role", + "default": "Admin" + }, + { + "name": "", + "description": "Text displayed for registered user role", + "default": "Registered User" + }, + { + "name": "", + "description": "Title of the dashboard page", + "default": "Dashboard" + }, + { + "name": "", + "description": "Greeting message on dashboard", + "default": "G'day" + } + ] + }, + "src/user/Profile.js": { + "migrated": true, + "keys": [ + { + "name": "name-label", + "description": "Label for name input field in profile update form", + "default": "Name" + }, + { + "name": "email-label", + "description": "Label for email input field in profile update form", + "default": "Email" + }, + { + "name": "password-label", + "description": "Label for password input field in profile update form", + "default": "Password" + }, + { + "name": "submit-button", + "description": "Text for form submission button", + "default": "Submit" + }, + { + "name": "profile-update-heading", + "description": "Title for the profile page", + "default": "Profile" + }, + { + "name": "", + "description": "Description for the profile page", + "default": "Update your profile" + }, + { + "name": "", + "description": "Heading for profile update section", + "default": "Profile update" + } + ] + }, + "src/user/Signin.js": { + "migrated": true, + "keys": [ + { + "name": "hello-globetrotter", + "description": "Greeting message for users on the login form", + "default": "Hello Globetrotter" + }, + { + "name": "email-label", + "description": "Alt text for the avatar image", + "default": "" + }, + { + "name": "password-label", + "description": "Label for email input field", + "default": "Email" + }, + { + "name": "submit-button", + "description": "Label for password input field", + "default": "Password" + }, + { + "name": "or-text", + "description": "Text for the submit button", + "default": "Submit" + }, + { + "name": "create-account-link", + "description": "Text for the or separator", + "default": "or" + }, + { + "name": "welcome-message", + "description": "Text for the create account link", + "default": "Create an account" + }, + { + "name": "service-message", + "description": "Welcome message on the login page", + "default": "Welcome toTravelYaari" + }, + { + "name": "", + "description": "Alt text for the signup image", + "default": "signup" + }, + { + "name": "", + "description": "Message about service quality", + "default": "We Are Happy to see you here. We are working to provide the best services to you." + }, + { + "name": "", + "description": "Text shown during loading state", + "default": "Loading......" + } + ] + }, + "src/user/Signup.js": { + "migrated": true, + "keys": [ + { + "name": "signup-heading", + "description": "Heading for the signup form", + "default": "Signup" + }, + { + "name": "name-label", + "description": "Label for the name input field", + "default": "Name" + }, + { + "name": "email-label", + "description": "Label for the email input field", + "default": "Email" + }, + { + "name": "password-label", + "description": "Label for the password input field", + "default": "Password" + }, + { + "name": "password-again-label", + "description": "Label for the password confirmation input field", + "default": "Password again" + }, + { + "name": "submit-button", + "description": "Text for the submit button", + "default": "Submit" + }, + { + "name": "already-have-account", + "description": "Text asking if user already has an account", + "default": "Already have an Account ?" + }, + { + "name": "signin-link", + "description": "Text for the signin link", + "default": "Signin" + }, + { + "name": "welcome-message", + "description": "Welcome message for new users", + "default": "Welcome to TravelYaari" + }, + { + "name": "service-message", + "description": "Message about service quality", + "default": "We Are Happy to see you here. We are working to provide the best services to you." + }, + { + "name": "terms-agreement", + "description": "Alt text for signup image", + "default": "signup" + }, + { + "name": "explore-world", + "description": "Text about agreeing to terms and services", + "default": "By Signin, you Agree to our terms and Services." + }, + { + "name": "account-created", + "description": "Motivational message about exploring the world", + "default": "Let's Explore the World !!!!" + }, + { + "name": "signin-link", + "description": "Success message for account creation", + "default": "New account is created. Please" + }, + { + "name": "", + "description": "Text for the signin link", + "default": "Signin" + } + ] + }, + "src/user/UserDashboard.js": { + "migrated": true, + "keys": [ + { + "name": "user-links-header", + "description": "Header text for user links section", + "default": "User Links" + }, + { + "name": "my-wishlisted-places", + "description": "Navigation link text for wishlisted places", + "default": "My Wishlisted places" + }, + { + "name": "update-profile", + "description": "Navigation link text for profile update", + "default": "Update My Profile" + }, + { + "name": "user-information-header", + "description": "Header text for user information section", + "default": "User Information" + }, + { + "name": "purchase-history-header", + "description": "Text displayed for admin role", + "default": "Admin" + }, + { + "name": "", + "description": "Text displayed for regular user role", + "default": "Registered Travelyaari User 😇" + }, + { + "name": "", + "description": "Header text for purchase history section", + "default": "Purchase history" + }, + { + "name": "", + "description": "Label for product name in purchase history", + "default": "Product name" + }, + { + "name": "", + "description": "Label for product price in purchase history", + "default": "Product price" + }, + { + "name": "", + "description": "Label for purchase date in purchase history", + "default": "Purchased date" + }, + { + "name": "", + "description": "Title of the dashboard page", + "default": "Dashboard" + }, + { + "name": "", + "description": "Greeting message for the user", + "default": "G'day" + } + ] + } +} \ No newline at end of file diff --git a/src/user/AdminDashboard.js b/src/user/AdminDashboard.js index 0f72a42..dcc27fe 100644 --- a/src/user/AdminDashboard.js +++ b/src/user/AdminDashboard.js @@ -2,40 +2,48 @@ import React from "react"; import Layout from "../core/Layout"; import { isAuthenticated } from "../auth"; import { Link } from "react-router-dom"; +import { T, useTranslate } from "@tolgee/react"; const AdminDashboard = () => { const {// eslint-disable-next-line user: { _id, name, email, role } } = isAuthenticated(); + const { t } = useTranslate(); const adminLinks = () => { return (
-

Admin Links

+

+

@@ -46,12 +54,15 @@ const AdminDashboard = () => { const adminInfo = () => { return (
-

User Information

+

+

  • {name}
  • {email}
  • - {role === 1 ? "Admin" : "Registered User"} + {role === 1 ? +t('admin-role') : +t('registered-user-role')}
@@ -60,8 +71,10 @@ const AdminDashboard = () => { return (
@@ -72,4 +85,4 @@ const AdminDashboard = () => { ); }; -export default AdminDashboard; +export default AdminDashboard; \ No newline at end of file diff --git a/src/user/Profile.js b/src/user/Profile.js index 9805395..62b15d9 100644 --- a/src/user/Profile.js +++ b/src/user/Profile.js @@ -4,8 +4,10 @@ import { isAuthenticated } from '../auth'; /* eslint-disable no-unused-vars */ import { Link, Redirect } from 'react-router-dom'; import { read, update, updateUser } from './apiUser'; +import { T, useTranslate } from '@tolgee/react'; const Profile = ({ match }) => { + const { t } = useTranslate(); const [values, setValues] = useState({ name: '', email: '', @@ -65,31 +67,38 @@ const Profile = ({ match }) => { const profileUpdate = (name, email, password) => (
- +
- +
- +
); return ( - -

Profile update

+ +

+

{profileUpdate(name, email, password)} {redirectUser(success)}
); }; -export default Profile; +export default Profile; \ No newline at end of file diff --git a/src/user/Signin.js b/src/user/Signin.js index 238f9cb..77408d8 100644 --- a/src/user/Signin.js +++ b/src/user/Signin.js @@ -7,7 +7,10 @@ import LoadingOverlay from 'react-loading-overlay'; import avatar from './../image/login/avatar.png'; import sideimage from './../image/login/side.jpg'; import './../CSS/signin.css'; +import { T, useTranslate } from '@tolgee/react'; + const Signin = () => { + const { t } = useTranslate(); const [values, setValues] = useState({ email: "", password: "", @@ -43,12 +46,15 @@ const Signin = () => { const signUpForm = () => (
-

Hello Globetrotter

+

+

- + {
- + {
- + { />
- or - Create an account + + + +
-

Welcome toTravelYaari

- signup -

We Are Happy to see you here. We are working to provide the best services to you.

+

+

+ { +

+

); @@ -102,7 +115,8 @@ const Signin = () => { ); @@ -132,4 +146,4 @@ const Signin = () => { ); }; -export default Signin; +export default Signin; \ No newline at end of file diff --git a/src/user/Signup.js b/src/user/Signup.js index daee0a7..69d35a4 100644 --- a/src/user/Signup.js +++ b/src/user/Signup.js @@ -4,7 +4,10 @@ import Layout from '../core/Layout'; import { signup } from '../auth'; import './../CSS/signup.css'; import towerimage from "./../image/signup/bg2.jpeg"; +import { T, useTranslate } from '@tolgee/react'; + const Signup = () => { + const { t } = useTranslate(); const [values, setValues] = useState({ name: '', email: '', @@ -43,44 +46,57 @@ const Signup = () => {
-

Signup

+

+

- +
- +
- +
- +
- Already have an Account ?   - Signin + +  + +
-

Welcome to TravelYaari

-

We Are Happy to see you here. We are working to provide the best services to you.

- signup +

+

+

+

+ {
-

By Signin, you Agree to our terms and Services.

+

+

-

Let's Explore the World !!!!

+

+

@@ -95,7 +111,9 @@ const Signup = () => { const showSuccess = () => (
- New account is created. Please Signin + + +
); @@ -109,4 +127,4 @@ const Signup = () => { ); }; -export default Signup; +export default Signup; \ No newline at end of file diff --git a/src/user/UserDashboard.js b/src/user/UserDashboard.js index 4329481..c1f990c 100644 --- a/src/user/UserDashboard.js +++ b/src/user/UserDashboard.js @@ -4,9 +4,11 @@ import { isAuthenticated } from "../auth"; import { Link } from "react-router-dom"; import { getPurchaseHistory } from "./apiUser"; import moment from "moment"; +import { T, useTranslate } from "@tolgee/react"; const Dashboard = () => { const [history, setHistory] = useState([]); + const { t } = useTranslate(); const { user: { _id, name, email, role } @@ -31,16 +33,19 @@ const Dashboard = () => { const userLinks = () => { return (
-

User Links

+

+

  • - My Wishlisted places + +
  • - Update My Profile + +
@@ -51,12 +56,15 @@ const Dashboard = () => { const userInfo = () => { return (
-

User Information

+

+

  •   {name}
  •   {email}
  •   - {role === 1 ? "Admin" : "Registered Travelyaari User 😇"} + {role === 1 ? +t('admin-role') : +t('user-role')}
@@ -66,7 +74,8 @@ const Dashboard = () => { const purchaseHistory = history => { return (
-

Purchase history

+

+

  • {history.map((h, i) => { @@ -76,12 +85,15 @@ const Dashboard = () => { {h.products.map((p, i) => { return (
    -
    Product name: {p.name}
    +
    { +t('product-name')}: {p.name}
    - Product price: ${p.price} + { +t('product-price')}: ${p.price}
    - Purchased date:{" "} + { +t('purchased-date')}:{" "} {moment( p.createdAt ).fromNow()} @@ -100,8 +112,10 @@ const Dashboard = () => { return (