Skip to content

Commit

Permalink
use context in document
Browse files Browse the repository at this point in the history
  • Loading branch information
shayanfpg9 committed Mar 30, 2023
1 parent 3b9697c commit f63623a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion client/src/component/Hook/useConfig.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export default function useConfig(error = false) {
document.title += ` (${params.query})`;
break;

case "document":
document.title += " -> /" + (params.action || params.method || "");
break;

default:
break;
}
Expand All @@ -44,8 +48,15 @@ export default function useConfig(error = false) {
const setDesc = () => {
const DescriptionMeta = document.querySelector("meta[name~='description']");

if (location !== "info") {
if (location !== "info" && location !== "document") {
DescriptionMeta.setAttribute("content", t(`descriptions.${location}`));
} else if (location === "document") {
DescriptionMeta.setAttribute(
"content",
t(`descriptions.${location}`, {
action: "/" + (params.action || params.method || ""),
})
);
} else {
DescriptionMeta.setAttribute(
"content",
Expand Down
2 changes: 1 addition & 1 deletion client/src/translate/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"table": "This is a fantastic periodic table you see atoms with colorful style and you can click to see the details",
"TableResult": "You look for a special atom? you can find it here",
"info": "Information about {{name}} atom is visible in here:",
"document": "document of Elen Atomic World api, you're in",
"document": "document of Elen Atomic World api, you're in {{action}}",
"error": "oh no, i get an error, we can't get anything"
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/translate/langs/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"table": "یک جدول تناوبی فوق العاده ی رنگی که میتونین با کلیک روی هر اتم اطلاعاتی درباره ی اون کسب کنید",
"TableResult": "دنبال اتم خاصی میگری؟\nاینجا میتونی پیداش کنی",
"info": "کلی اطلاعات درباره ی اتم {{name}} اینجا موجوده کدومشو میخوای؟",
"document": "مستندات api دنیای اتمی الن",
"document": "مستندات api دنیای اتمی الن شما در {{action}} هستید",
"error": "وای، اینجا یه ارور هست، نمیتونیم کاری کنیم..."
}
}
Expand Down

0 comments on commit f63623a

Please sign in to comment.