Skip to content

lightweight, client-only calendar web application. All data persists in the URL hash for instant sharing, No backend required. Optional AES-GCM password protection keeps shared links locked without a server

JavaScript

feat: Enhance internationalization support by adding i18n attributes and translations for app launcher and mobile drawer labels

Supun Lakmal314bbfee3529
diff --git a/Dockerfile b/Dockerfile
index b63a53f..cff6f88 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,7 +4,7 @@ FROM node:18-alpine AS base
WORKDIR /app
# Copy only the necessary files for serving
-COPY index.html styles.css script.js planner_logic.js sw.js manifest.json ./
+COPY index.html styles.css script.js sw.js manifest.json ./
COPY modules/ ./modules/
COPY demo/ ./demo/
COPY logo.png favicon.ico apple-touch-icon.png ./
diff --git a/index.html b/index.html
index de99e56..881e78e 100644
--- a/index.html
+++ b/index.html
@@ -450,7 +450,7 @@
<div class="modal-backdrop"></div>
<div class="app-launcher-modal-panel" role="document">
<div class="app-launcher-modal-header">
- <h3 id="app-launcher-modal-title" class="app-launcher-modal-title">Apps</h3>
+ <h3 id="app-launcher-modal-title" class="app-launcher-modal-title" data-i18n="launcher.appsTitle">Apps</h3>
<button id="app-launcher-close" type="button" class="app-launcher-modal-close" aria-label="Close app launcher">
<i class="fa-solid fa-xmark" aria-hidden="true"></i>
</button>
@@ -522,14 +522,14 @@
<div id="mobile-drawer-backdrop" class="mobile-drawer-backdrop mobile-only"></div>
<aside id="mobile-drawer" class="mobile-drawer mobile-only">
<div class="mobile-drawer-header">
- <span class="mobile-drawer-title">Menu</span>
+ <span class="mobile-drawer-title" data-i18n="label.menu">Menu</span>
<button id="mobile-drawer-close" type="button" class="icon-btn" aria-label="Close menu">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="mobile-drawer-body">
<div class="mobile-drawer-section">
- <span class="mobile-drawer-label">Views</span>
+ <span class="mobile-drawer-label" data-i18n="label.views">Views</span>
<div class="mobile-drawer-view-toggle" role="tablist">
<button data-view="day" role="tab">Day</button>
<button data-view="week" role="tab">Week</button>
@@ -562,7 +562,7 @@
</div>
<div class="mobile-drawer-section">
- <span class="mobile-drawer-label">Actions</span>
+ <span class="mobile-drawer-label" data-i18n="label.actions">Actions</span>
<button id="mobile-world-planner-btn" type="button" class="mobile-drawer-item">
<i class="fa-solid fa-earth-americas"></i> <span>Planner</span>
</button>
@@ -601,7 +601,7 @@
</div>
<div class="mobile-drawer-section">
- <span class="mobile-drawer-label">Settings</span>
+ <span class="mobile-drawer-label" data-i18n="label.settings">Settings</span>
<button id="mobile-weekstart-toggle" type="button" class="mobile-drawer-item">
<i class="fa-solid fa-calendar-week"></i> <span>Week starts Sunday</span>
</button>
@@ -639,4 +639,4 @@
<script type="module" src="script.js"></script>
</body>
-</html>
\ No newline at end of file
+</html>
diff --git a/locales/en.js b/locales/en.js
index 0a16b7a..2cbfa1d 100644
--- a/locales/en.js
+++ b/locales/en.js
@@ -43,6 +43,7 @@ export default {
"planner.homeTitle": "Make Home",
"planner.removeTitle": "Remove",
"launcher.ariaLabel": "App Launcher",
+ "launcher.appsTitle": "Apps",
"app.calendar": "Hash Calendar",
"app.spreadsheet": "Spreadsheet Live",
@@ -174,6 +175,9 @@ export default {
"label.language": "Language",
"label.close": "Close",
"label.menu": "Menu",
+ "label.views": "Views",
+ "label.actions": "Actions",
+ "label.settings": "Settings",
// Countdown widget
"countdown.upNext": "Up Next",
diff --git a/locales/it.js b/locales/it.js
index 30af107..24ef9dc 100644
--- a/locales/it.js
+++ b/locales/it.js
@@ -43,6 +43,7 @@ export default {
'planner.homeTitle': 'Imposta come Home',
'planner.removeTitle': 'Rimuovi',
'launcher.ariaLabel': 'Lanciatore app',
+ 'launcher.appsTitle': 'App',
'app.calendar': 'Hash Calendar',
'app.spreadsheet': 'Foglio di calcolo in tempo reale',
@@ -174,6 +175,9 @@ export default {
'label.language': 'Lingua',
'label.close': 'Chiudi',
'label.menu': 'Menù',
+ 'label.views': 'Viste',
+ 'label.actions': 'Azioni',
+ 'label.settings': 'Impostazioni',
// Countdown widget
'countdown.upNext': 'Prossimo',
diff --git a/locales/si.js b/locales/si.js
index 7f89a83..b6767af 100644
--- a/locales/si.js
+++ b/locales/si.js
@@ -43,6 +43,7 @@ export default {
"planner.homeTitle": "ප්‍රධාන වේලාව ලෙස සකසන්න",
"planner.removeTitle": "ඉවත් කරන්න",
"launcher.ariaLabel": "යෙදුම් මෙනුව",
+ "launcher.appsTitle": "යෙදුම්",
"app.calendar": "Hash Calendar",
"app.spreadsheet": "Spreadsheet Live",
@@ -174,6 +175,9 @@ export default {
"label.language": "භාෂාව",
"label.close": "වසන්න",
"label.menu": "මෙනුව",
+ "label.views": "දර්ශන",
+ "label.actions": "ක්‍රියා",
+ "label.settings": "සැකසුම්",
// Countdown widget
"countdown.upNext": "ඊළඟට",
diff --git a/locales/ta.js b/locales/ta.js
index 79e2e5f..6a3dd63 100644
--- a/locales/ta.js
+++ b/locales/ta.js
@@ -43,6 +43,7 @@ export default {
'planner.homeTitle': 'முகப்பு நேரமாக்கு',
'planner.removeTitle': 'அகற்று',
'launcher.ariaLabel': 'செயலி துவக்கி',
+ 'launcher.appsTitle': 'செயலிகள்',
'app.calendar': 'Hash Calendar',
'app.spreadsheet': 'Spreadsheet Live',
@@ -174,6 +175,9 @@ export default {
'label.language': 'மொழி',
'label.close': 'மூடு',
'label.menu': 'மெனு',
+ 'label.views': 'காட்சிகள்',
+ 'label.actions': 'செயல்கள்',
+ 'label.settings': 'அமைப்புகள்',
// Countdown widget
'countdown.upNext': 'அடுத்து வருவது',
diff --git a/modules/worldPlannerModule.js b/modules/worldPlannerModule.js
index 020efb7..acfd22e 100644
--- a/modules/worldPlannerModule.js
+++ b/modules/worldPlannerModule.js
@@ -11,6 +11,7 @@ import {
PLANNER_HOURS_PER_DAY,
PLANNER_MAX_ZONES,
} from "./constants.js";
+import { t } from "./i18n.js";
import { AVAILABLE_ZONES, getLocalZone, getZoneInfo, parseOffsetSearchTerm } from "./timezoneManager.js";
export class WorldPlanner {
@@ -338,10 +339,34 @@ export class WorldPlanner {
if (!isHome) {
const controls = document.createElement("div");
controls.className = "wp-row-controls";
- controls.innerHTML = `
- <button class="wp-control-btn" data-action="promote" data-zone="${zone}" title="Make Home"><i class="fa-solid fa-arrow-up"></i></button>
- <button class="wp-control-btn" data-action="remove" data-zone="${zone}" title="Remove"><i class="fa-solid fa-xmark"></i></button>
- `;
+
+ const promoteTitle = t("planner.homeTitle");
+ const promoteBtn = document.createElement("button");
+ promoteBtn.type = "button";
+ promoteBtn.className = "wp-control-btn";
+ promoteBtn.dataset.action = "promote";
+ promoteBtn.dataset.zone = zone;
+ promoteBtn.title = promoteTitle;
+ promoteBtn.setAttribute("aria-label", promoteTitle);
+ const promoteIcon = document.createElement("i");
+ promoteIcon.className = "fa-solid fa-arrow-up";
+ promoteIcon.setAttribute("aria-hidden", "true");
+ promoteBtn.appendChild(promoteIcon);
+
+ const removeTitle = t("planner.removeTitle");
+ const removeBtn = document.createElement("button");
+ removeBtn.type = "button";
+ removeBtn.className = "wp-control-btn";
+ removeBtn.dataset.action = "remove";
+ removeBtn.dataset.zone = zone;
+ removeBtn.title = removeTitle;
+ removeBtn.setAttribute("aria-label", removeTitle);
+ const removeIcon = document.createElement("i");
+ removeIcon.className = "fa-solid fa-xmark";
+ removeIcon.setAttribute("aria-hidden", "true");
+ removeBtn.appendChild(removeIcon);
+
+ controls.append(promoteBtn, removeBtn);
div.appendChild(controls);
} else {
// Home icon