MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / applyLocale

Function applyLocale

deployments/desktop/static/desktop.js:1275–1468  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1273 }
1274
1275 function applyLocale() {
1276 const text = ui();
1277 document.documentElement.lang = text.htmlLang;
1278 document.title = text.documentTitle;
1279
1280 if ($("languageLabel")) $("languageLabel").textContent = text.language.label;
1281 const languageSelect = $("languageSelect");
1282 if (languageSelect) {
1283 languageSelect.value = state.locale;
1284 languageSelect.title = text.language.title;
1285 languageSelect.setAttribute("aria-label", text.language.title);
1286 setAllText("#languageSelect option", [text.language.zh, text.language.en]);
1287 }
1288
1289 Object.entries(text.nav).forEach(([view, label]) => {
1290 setText(`.rail-item[data-view="${view}"] span:last-child`, label);
1291 setAttr(`.rail-item[data-view="${view}"]`, "title", label);
1292 });
1293
1294 setText(".user-picker span", text.topbar.profile);
1295 setAttr("#userSelect", "aria-label", text.topbar.profile);
1296 setAttr("#refreshUsersBtn", "title", text.topbar.refreshUsers);
1297 setAttr("#refreshUsersBtn", "aria-label", text.topbar.refreshUsers);
1298 if ([i18n.zh.status.ready, i18n.en.status.ready].includes($("statusText")?.textContent)) setStatus(text.status.ready);
1299 if ([i18n.zh.status.error, i18n.en.status.error].includes($("statusText")?.textContent)) setStatus(text.status.error);
1300
1301 setAttr("#prevDayBtn", "title", text.papers.prevDay);
1302 setAttr("#prevDayBtn", "aria-label", text.papers.prevDay);
1303 setAttr("#nextDayBtn", "title", text.papers.nextDay);
1304 setAttr("#nextDayBtn", "aria-label", text.papers.nextDay);
1305 setAttr("#paperDate", "aria-label", text.papers.date);
1306 setText(".days-control span:first-child", text.papers.rangePrefix);
1307 setText(".days-control span:last-child", text.papers.rangeSuffix);
1308 setAttr("#daysInput", "aria-label", text.papers.daysLabel);
1309 setAllText(".metric-strip div span", [text.papers.candidate, text.papers.filtered, text.papers.selected, text.papers.wikiNodes]);
1310 setAllText(".metric-strip div em", [text.papers.countUnit, text.papers.countUnit, text.papers.countUnit, text.papers.nodeUnit]);
1311 setText(".source-toolbar strong", text.papers.sourceTitle);
1312 setText(".source-toolbar span", text.papers.sourceDesc);
1313 setText("#selectAllSourcesBtn", text.papers.selectAll);
1314 setText("#clearSourcesBtn", text.papers.clear);
1315 setAllText(".source-head strong", ["arXiv", text.papers.conference, text.papers.journal]);
1316 document.querySelectorAll("[data-source-toggle]").forEach((button) => {
1317 button.textContent = text.papers.toggle;
1318 });
1319 if ($("arxivCategories")?.classList.contains("empty")) $("arxivCategories").textContent = text.papers.loadingCategories;
1320 if ($("conferenceSources")?.classList.contains("empty")) $("conferenceSources").textContent = text.papers.loadingConferences;
1321 if ($("journalSources")?.classList.contains("empty")) $("journalSources").textContent = text.papers.loadingJournals;
1322 if ($("pushMeta")?.classList.contains("empty") || $("pushMeta")?.textContent === i18n.zh.papers.pushEmpty || $("pushMeta")?.textContent === i18n.en.papers.pushEmpty) $("pushMeta").textContent = text.papers.pushEmpty;
1323 if ($("paperList")?.classList.contains("empty") && !$("paperList")?.classList.contains("syncing")) $("paperList").textContent = text.papers.listEmpty;
1324 setText(".submit-bar p", text.papers.selectionHelp);
1325 if ($("submitFeedbackBtn") && !$("submitFeedbackBtn").disabled) $("submitFeedbackBtn").textContent = text.papers.submitFeedback;
1326 if ($("submitAndReadBtn") && !$("submitAndReadBtn").disabled) $("submitAndReadBtn").textContent = text.papers.submitAndRead;
1327
1328 setText(".report-list-pane .pane-head h2", text.reports.listTitle);
1329 setAttr("#reportDays", "title", text.reports.rangeTitle);
1330 setAllText("#reportDays option", [text.reports.days7, text.reports.days30, text.reports.days90, text.reports.all]);
1331 setText("#refreshReportsBtn", text.reports.refresh);
1332 setAttr("#reportQuery", "placeholder", text.reports.queryPlaceholder);

Callers 2

setLocaleFunction · 0.85
initFunction · 0.85

Calls 15

uiFunction · 0.85
setAllTextFunction · 0.85
setTextFunction · 0.85
setAttrFunction · 0.85
setLabelTextsFunction · 0.85
renderConferenceSettingsFunction · 0.85
updateSourceAuthStatusFunction · 0.85
envMapFunction · 0.85
updatePageTitleFunction · 0.85
syncDateControlsFunction · 0.85
renderWikiGraphFunction · 0.85
renderWikiListFunction · 0.85

Tested by

no test coverage detected