feat: implement internationalization for duty calendar
All checks were successful
CI / lint-and-test (push) Successful in 14s

- Introduced a new `i18n.js` module for handling translations and language detection, supporting both Russian and English.
- Updated various components to utilize the new translation functions, enhancing user experience by providing localized messages for errors, hints, and UI elements.
- Refactored existing code in `api.js`, `calendar.js`, `dutyList.js`, `hints.js`, and `ui.js` to replace hardcoded strings with translated messages, improving maintainability and accessibility.
- Enhanced the initialization process in `main.js` to set the document language and update UI elements based on the user's language preference.
This commit is contained in:
2026-02-19 16:00:00 +03:00
parent a5f7a5a0ef
commit 4c2d95e776
9 changed files with 262 additions and 51 deletions

View File

@@ -3,6 +3,7 @@
*/
import {
state,
calendarEl,
dutyListEl,
loadingEl,
@@ -13,6 +14,7 @@ import {
prevBtn,
nextBtn
} from "./dom.js";
import { t } from "./i18n.js";
/**
* Show access-denied view and hide calendar/list/loading/error.
@@ -26,7 +28,8 @@ export function showAccessDenied(serverDetail) {
if (loadingEl) loadingEl.classList.add("hidden");
if (errorEl) errorEl.hidden = true;
if (accessDeniedEl) {
accessDeniedEl.innerHTML = "<p>Доступ запрещён.</p>";
const msg = t(state.lang, "access_denied");
accessDeniedEl.innerHTML = "<p>" + msg + "</p>";
if (serverDetail && serverDetail.trim()) {
const detail = document.createElement("p");
detail.className = "access-denied-detail";