-
Notifications
You must be signed in to change notification settings - Fork 0
🎨 Palette: [UX improvement] #200
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -144,7 +144,8 @@ const messages = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| "work.fourTitle": "작업 흐름", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "work.fourBody": "반복 탐색은 줄이고 근거 확인과 사람의 판단은 남기는 흐름.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "footer.founded": "Founded by", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "footer.line": "Context into judgment. Judgment into action." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "footer.line": "Context into judgment. Judgment into action.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "externalLink": "새 창에서 열림" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| en: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| metaTitle: "Contextual Wisdom Lab", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -291,7 +292,8 @@ const messages = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| "work.fourTitle": "Agentic workflows", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "work.fourBody": "Workflows that reduce repeated search while preserving evidence checks and human judgment.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "footer.founded": "Founded by", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "footer.line": "Context into judgment. Judgment into action." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "footer.line": "Context into judgment. Judgment into action.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "externalLink": "Opens in a new window" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -312,6 +314,7 @@ function preferredLanguage() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // ⚡ Bolt: Cache DOM queries and current state to prevent redundant lookups and layout thrashing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let i18nNodes = null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let i18nTitleNodes = null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let langButtons = null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let metaDesc = null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let ogDesc = null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -367,6 +370,9 @@ function setLanguage(lang) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!i18nNodes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| i18nNodes = document.querySelectorAll("[data-i18n]"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!i18nTitleNodes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| i18nTitleNodes = document.querySelectorAll("[data-i18n-title]"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+373
to
+375
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 기본 한국어 초기화에서도 외부 링크 제목을 설정하세요. 첫 수정 예시+ if (!i18nTitleNodes) {
+ i18nTitleNodes = document.querySelectorAll("[data-i18n-title]");
+ }
+
if (!isInitialDefault) {
if (!i18nNodes) {
i18nNodes = document.querySelectorAll("[data-i18n]");
}
- if (!i18nTitleNodes) {
- i18nTitleNodes = document.querySelectorAll("[data-i18n-title]");
- }
i18nNodes.forEach((node) => {
const newText = dict[node.dataset.i18n];
if (newText && node.textContent !== newText) {
node.textContent = newText;
}
});
-
- i18nTitleNodes.forEach((node) => {
- const newTitle = dict[node.dataset.i18nTitle];
- if (newTitle && node.getAttribute("title") !== newTitle) {
- node.setAttribute("title", newTitle);
- }
- });
}
+
+ i18nTitleNodes.forEach((node) => {
+ const newTitle = dict[node.dataset.i18nTitle];
+ if (newTitle && node.getAttribute("title") !== newTitle) {
+ node.setAttribute("title", newTitle);
+ }
+ });📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Only update textContent if it actually changed to avoid layout recalculations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| i18nNodes.forEach((node) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -375,6 +381,13 @@ function setLanguage(lang) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| node.textContent = newText; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| i18nTitleNodes.forEach((node) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const newTitle = dict[node.dataset.i18nTitle]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (newTitle && node.getAttribute("title") !== newTitle) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| node.setAttribute("title", newTitle); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| langButtons.forEach((button) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| </head> | ||
| <body> | ||
| <div data-i18n="hero.title">맥락지혜 연구실</div> | ||
| <a data-i18n-title="externalLink" title="새 창에서 열림">Link</a> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| <button type="button" data-lang="ko" aria-pressed="true">KO</button> | ||
| <button type="button" data-lang="en" aria-pressed="false">EN</button> | ||
| <img id="footer-logo" src="assets/context-wisdom-lab-logo.svg" alt="맥락지혜 연구실 · Contextual Wisdom Lab"> | ||
|
|
@@ -44,12 +45,15 @@ | |
| setLanguage("en"); | ||
| assertEqual(currentLang, "en", "Language should be 'en' after setting"); | ||
| const titleNode = document.querySelector('[data-i18n="hero.title"]'); | ||
| const titleAttrNode = document.querySelector('[data-i18n-title="externalLink"]'); | ||
| assertEqual(titleNode.textContent, "Contextual Wisdom Lab", "Title text should change to English"); | ||
| assertEqual(titleAttrNode.getAttribute("title"), "Opens in a new window", "Title attr should change to English"); | ||
|
|
||
| // Test 3: Switch back to KO updates nodes correctly | ||
| setLanguage("ko"); | ||
| assertEqual(currentLang, "ko", "Language should be 'ko' after setting back"); | ||
| assertEqual(titleNode.textContent, "맥락지혜 연구실", "Title text back to Korean"); | ||
| assertEqual(titleAttrNode.getAttribute("title"), "새 창에서 열림", "Title attr back to Korean"); | ||
|
|
||
| // Test 4: Sentinel Security - Input Validation for untrusted inputs | ||
| setLanguage("__proto__"); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Korean links lack new-window notice
On an initial Korean visit,
i18nTitleNodesremains uninitialized because the links contain no fallback title. Their new-window notice appears only after changing languages.Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.