Skip to content
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

feat: Internationalization Support (i18n) #242

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
"fortawesome": "^0.0.1-security",
"google-auth-library": "^9.14.1",
"googleapis": "^144.0.0",
"i18next": "^24.0.2",
"i18next-browser-languagedetector": "^8.0.0",
"i18next-http-backend": "^3.0.1",
"ioredis": "^5.4.1",
"joi": "^17.6.0",
"jsonwebtoken": "^9.0.2",
Expand All @@ -56,6 +59,7 @@
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-highlight": "0.15.0",
"react-i18next": "^15.1.3",
"react-router-dom": "^6.26.1",
"react-simple-code-editor": "^0.11.2",
"react-transition-group": "^4.4.2",
Expand Down Expand Up @@ -110,4 +114,4 @@
"ts-node": "^10.4.0",
"vite": "^5.4.10"
}
}
}
50 changes: 50 additions & 0 deletions public/locales/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"login": {
"title": "Willkommen zurück!",
"email": "E-Mail",
"password": "Passwort",
"button": "Einloggen",
"loading": "Lädt",
"register_prompt": "Noch keinen Account?",
"register_link": "Registrieren",
"welcome_notification": "Willkommen bei Maxun!",
"error_notification": "Anmeldung fehlgeschlagen. Bitte versuchen Sie es erneut."
},
"register": {
"title": "Konto registrieren",
"email": "E-Mail",
"password": "Passwort",
"button": "Registrieren",
"loading": "Lädt",
"register_prompt": "Bereits ein Konto?",
"login_link": "Einloggen",
"welcome_notification": "Willkommen bei Maxun!",
"error_notification": "Registrierung fehlgeschlagen. Bitte versuchen Sie es erneut."
},
"recordingtable": {
"run": "Ausführen",
"name": "Name",
"schedule": "Zeitplan",
"integrate": "Integrieren",
"settings": "Einstellungen",
"options": "Optionen",
"heading": "Meine Roboter",
"new": "Roboter erstellen",
"modal": {
"title": "Geben Sie die URL ein",
"label": "URL",
"button": "Aufnahme starten"
},
"edit": "Bearbeiten",
"delete": "Löschen",
"duplicate": "Duplizieren"
},
"mainmenu": {
"recordings": "Roboter",
"runs": "Ausführungen",
"proxy": "Proxy",
"apikey": "API-Schlüssel",
"feedback": "Maxun Cloud beitreten",
"apidocs": "API-Dokumentation"
}
}
53 changes: 53 additions & 0 deletions public/locales/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"login": {
"title": "Welcome Back!",
"email": "Email",
"password": "Password",
"button": "Login",
"loading": "Loading",
"register_prompt": "Don't have an account?",
"register_link": "Register",
"welcome_notification": "Welcome to Maxun!",
"error_notification": "Login Failed. Please try again."
},
"register": {
"title": "Register Account",
"email": "Email",
"password": "Password",
"button": "Register",
"loading": "Loading",
"register_prompt": "Already have an account?",
"login_link": "Login",
"welcome_notification": "Welcome to Maxun!",
"error_notification": "Registeration Failed. Please try again."
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix typo in error message

There's a spelling error in the registration error message.

-      "error_notification": "Registeration Failed. Please try again."
+      "error_notification": "Registration Failed. Please try again."
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"error_notification": "Registeration Failed. Please try again."
"error_notification": "Registration Failed. Please try again."

},
Comment on lines +2 to +23
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add missing authentication error scenarios

The authentication sections are missing common error scenarios that should be localized.

Add these additional translation keys to the login and register sections:

 "login": {
   // ... existing keys ...
+  "invalid_email": "Please enter a valid email address",
+  "password_required": "Password is required",
+  "account_locked": "Account has been temporarily locked",
+  "network_error": "Network error. Please check your connection"
 },
 "register": {
   // ... existing keys ...
+  "email_taken": "This email is already registered",
+  "password_requirements": "Password must be at least 8 characters",
+  "terms_acceptance": "Please accept the terms and conditions"
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"login": {
"title": "Welcome Back!",
"email": "Email",
"password": "Password",
"button": "Login",
"loading": "Loading",
"register_prompt": "Don't have an account?",
"register_link": "Register",
"welcome_notification": "Welcome to Maxun!",
"error_notification": "Login Failed. Please try again."
},
"register": {
"title": "Register Account",
"email": "Email",
"password": "Password",
"button": "Register",
"loading": "Loading",
"register_prompt": "Already have an account?",
"login_link": "Login",
"welcome_notification": "Welcome to Maxun!",
"error_notification": "Registeration Failed. Please try again."
},
"login": {
"title": "Welcome Back!",
"email": "Email",
"password": "Password",
"button": "Login",
"loading": "Loading",
"register_prompt": "Don't have an account?",
"register_link": "Register",
"welcome_notification": "Welcome to Maxun!",
"error_notification": "Login Failed. Please try again.",
"invalid_email": "Please enter a valid email address",
"password_required": "Password is required",
"account_locked": "Account has been temporarily locked",
"network_error": "Network error. Please check your connection"
},
"register": {
"title": "Register Account",
"email": "Email",
"password": "Password",
"button": "Register",
"loading": "Loading",
"register_prompt": "Already have an account?",
"login_link": "Login",
"welcome_notification": "Welcome to Maxun!",
"error_notification": "Registeration Failed. Please try again.",
"email_taken": "This email is already registered",
"password_requirements": "Password must be at least 8 characters",
"terms_acceptance": "Please accept the terms and conditions"
},

"recordingtable":{
"run": "Run",
"name": "Name",
"schedule": "Schedule",
"integrate": "Integrate",
"settings": "Settings",
"options": "Options",
"heading":"My Robots",
"new":"Create Robot",
"modal":{
"title":"Enter the URL",
"label":"URL",
"button":"Start Recording"
},
"edit":"Edit",
"delete":"Delete",
"duplicate":"Duplicate",
"search":"Search Robots..."

},
"mainmenu":{
"recordings": "Robots",
"runs": "Runs",
"proxy": "Proxy",
"apikey": "API Key",
"feedback":"Join Maxun Cloud",
"apidocs":"API Docs"

}
}
13 changes: 13 additions & 0 deletions public/locales/es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"app": {
"name": "Maxun",
"version": "beta"
},
"login": {
"title": "¡Bienvenido de nuevo!",
"email": "Correo electrónico",
"password": "Contraseña",
"button": "Iniciar sesión",
"register_prompt": "¿No tienes una cuenta? Regístrate"
}
}
50 changes: 50 additions & 0 deletions public/locales/ja.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"login": {
"title": "お帰りなさい!",
"email": "メールアドレス",
"password": "パスワード",
"button": "ログイン",
"loading": "読み込み中",
"register_prompt": "アカウントをお持ちでないですか?",
"register_link": "登録する",
"welcome_notification": "Maxunへようこそ!",
"error_notification": "ログインに失敗しました。もう一度お試しください。"
},
"register": {
"title": "アカウントを登録する",
"email": "メールアドレス",
"password": "パスワード",
"button": "登録する",
"loading": "読み込み中",
"register_prompt": "既にアカウントをお持ちですか?",
"login_link": "ログイン",
"welcome_notification": "Maxunへようこそ!",
"error_notification": "登録に失敗しました。もう一度お試しください。"
},
"recordingtable": {
"run": "実行",
"name": "名前",
"schedule": "スケジュール",
"integrate": "統合",
"settings": "設定",
"options": "オプション",
"heading": "私のロボット",
"new": "ロボットを作成",
"modal": {
"title": "URLを入力してください",
"label": "URL",
"button": "録画を開始"
},
"edit": "編集",
"delete": "削除",
"duplicate": "複製"
},
"mainmenu": {
"recordings": "ロボット",
"runs": "実行",
"proxy": "プロキシ",
"apikey": "APIキー",
"feedback": "Maxunクラウドに参加する",
"apidocs": "APIドキュメント"
}
}
13 changes: 13 additions & 0 deletions public/locales/zh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"app": {
"name": "Maxun",
"version": "beta"
},
"login": {
"title": "欢迎回来!",
"email": "电子邮件",
"password": "密码",
"button": "登录",
"register_prompt": "没有账号?注册"
}
}
29 changes: 16 additions & 13 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from 'react';
import { Routes, Route } from 'react-router-dom';
import React from "react";
import { Routes, Route } from "react-router-dom";
import { ThemeProvider, createTheme } from "@mui/material/styles";
import { GlobalInfoProvider } from "./context/globalInfo";
import { PageWrapper } from "./pages/PageWrappper";
import i18n from "./i18n";


const theme = createTheme({
palette: {
Expand All @@ -20,14 +22,14 @@ const theme = createTheme({
},
containedPrimary: {
// Styles for 'contained' variant with 'primary' color
'&:hover': {
"&:hover": {
backgroundColor: "#ff66d9",
},
},
outlined: {
// Apply white background for all 'outlined' variant buttons
backgroundColor: "#ffffff",
'&:hover': {
"&:hover": {
backgroundColor: "#f0f0f0", // Optional lighter background on hover
},
},
Expand All @@ -36,7 +38,7 @@ const theme = createTheme({
MuiLink: {
styleOverrides: {
root: {
'&:hover': {
"&:hover": {
color: "#ff00c3",
},
},
Expand All @@ -63,7 +65,7 @@ const theme = createTheme({
standardInfo: {
backgroundColor: "#fce1f4",
color: "#ff00c3",
'& .MuiAlert-icon': {
"& .MuiAlert-icon": {
color: "#ff00c3",
},
},
Expand All @@ -72,7 +74,7 @@ const theme = createTheme({
MuiAlertTitle: {
styleOverrides: {
root: {
'& .MuiAlert-icon': {
"& .MuiAlert-icon": {
color: "#ffffff",
},
},
Expand All @@ -81,15 +83,16 @@ const theme = createTheme({
},
});


function App() {
return (
<ThemeProvider theme={theme}>
<GlobalInfoProvider>
<Routes>
<Route path="/*" element={<PageWrapper />} />
</Routes>
</GlobalInfoProvider>

<GlobalInfoProvider>
<Routes>
<Route path="/*" element={<PageWrapper />} />
</Routes>
</GlobalInfoProvider>

</ThemeProvider>
);
}
Expand Down
Loading