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: add internationalization (i18n) support with English, Sinhala, and Tamil locales.

Supun Lakmal52b96ef2db3d
diff --git a/locales/en.js b/locales/en.js
index 39c1269..6637102 100644
--- a/locales/en.js
+++ b/locales/en.js
@@ -117,6 +117,7 @@ export default {
// Language names
'lang.en': 'English',
'lang.si': 'සිංහල',
+ 'lang.ta': 'Tamil',
// Toast messages
'toast.linkCopied': 'Link copied',
diff --git a/locales/si.js b/locales/si.js
index fcdbce7..052bc04 100644
--- a/locales/si.js
+++ b/locales/si.js
@@ -117,6 +117,7 @@ export default {
// Language names
'lang.en': 'English',
'lang.si': 'සිංහල',
+ 'lang.ta': 'දෙමළ (Tamil)',
// Toast messages
'toast.linkCopied': 'සබැඳිය පිටපත් විය',
diff --git a/locales/ta.js b/locales/ta.js
new file mode 100644
index 0000000..2a3a4d7
--- /dev/null
+++ b/locales/ta.js
@@ -0,0 +1,239 @@
+export default {
+ // Navigation
+ 'nav.prev': 'முந்தைய',
+ 'nav.today': 'இன்று',
+ 'nav.next': 'அடுத்த',
+ 'nav.prevMonth': 'முந்தைய மாதம்',
+ 'nav.nextMonth': 'அடுத்த மாதம்',
+
+ // View toggles
+ 'view.day': 'நாள்',
+ 'view.week': 'வாரம்',
+ 'view.month': 'மாதம்',
+ 'view.year': 'ஆண்டு',
+ 'view.agenda': 'நிகழ்ச்சி நிரல்',
+
+ // Action buttons
+ 'btn.addEvent': 'நிகழ்வைச் சேர்',
+ 'btn.copyLink': 'இணைப்பை நகலெடு',
+ 'btn.shareQr': 'QR பகிரவும்',
+ 'btn.lock': 'பூட்டு',
+ 'btn.unlock': 'திற',
+ 'btn.removeLock': 'பூட்டை அகற்று',
+ 'btn.focus': 'கவனம்',
+ 'btn.exitFocus': 'கவனத்திலிருந்து வெளியேறு',
+ 'btn.save': 'சேமி',
+ 'btn.cancel': 'ரத்துசெய்',
+ 'btn.delete': 'அழி',
+ 'btn.addEventForDay': 'இந்த நாளுக்கு நிகழ்வைச் சேர்',
+ 'btn.viewJson': 'JSON காண்க',
+ 'btn.exportJson': 'JSON ஏற்றுமதி',
+ 'btn.importIcs': '.ics இறக்குமதி',
+ 'btn.clearCalendar': 'நாட்காட்டியை அழி',
+ 'btn.addTimezone': 'நேர மண்டலத்தைச் சேர்',
+ 'btn.gotIt': 'சரி',
+ 'btn.copyJson': 'JSON நகலெடு',
+ 'btn.copyHash': 'Hash நகலெடு',
+ 'btn.downloadJson': 'JSON தரவிறக்கம்',
+ 'btn.copyTextLink': 'உரை இணைப்பை நகலெடு',
+ 'btn.worldPlanner': 'திட்டமிடுபவர்',
+ 'planner.notFound': 'நேர மண்டலம் காணப்படவில்லை',
+ 'planner.homeTitle': 'முகப்பு நேரமாக்கு',
+ 'planner.removeTitle': 'அகற்று',
+ 'launcher.ariaLabel': 'செயலி துவக்கி',
+ 'app.calendar': 'Hash Calendar',
+ 'app.spreadsheet': 'Spreadsheet Live',
+
+ // Modal titles
+ 'modal.addEvent': 'நிகழ்வைச் சேர்',
+ 'modal.editEvent': 'நிகழ்வைத் திருத்து',
+ 'modal.unlockCalendar': 'நாட்காட்டியைத் திற',
+ 'modal.setPassword': 'கடவுச்சொல்லை அமை',
+ 'modal.shareData': 'தரவைப் பகிரவும்',
+ 'modal.scanQr': 'மொபைலில் திறக்க ஸ்கேன் செய்யவும்',
+ 'modal.selectTimezone': 'நேர மண்டலத்தைத் தேர்ந்தெடு',
+ 'modal.worldPlanner': 'உலகளாவிய திட்டமிடுபவர்',
+
+ // Event form fields
+ 'event.title': 'தலைப்பு',
+ 'event.date': 'தேதி',
+ 'event.start': 'தொடக்கம்',
+ 'event.duration': 'கால அளவு (நிமிடங்கள்)',
+ 'event.allDay': 'நாள் முழுவதும்',
+ 'event.recurrence': 'மீண்டும் நிகழ்தல்',
+ 'event.color': 'நிறம்',
+
+ // Recurrence options
+ 'recurrence.none': 'எதுவுமில்லை',
+ 'recurrence.daily': 'தினசரி',
+ 'recurrence.weekly': 'வாராந்திர',
+ 'recurrence.monthly': 'மாதாந்திர',
+ 'recurrence.yearly': 'ஆண்டுதோறும்',
+
+ // Password form
+ 'password.password': 'கடவுச்சொல்',
+ 'password.confirmPassword': 'கடவுச்சொல்லை உறுதிப்படுத்து',
+ 'password.setDesc': 'இணைப்பு மற்றும் கடவுச்சொல் உள்ளவர்கள் மட்டுமே இந்த நாட்காட்டியைப் பார்க்கும்படி கடவுச்சொல்லைச் சேர்க்கவும்.',
+ 'password.unlockDesc': 'இந்த நாட்காட்டியைத் திறக்க கடவுச்சொல்லை உள்ளிடவும்.',
+ 'password.required': 'கடவுச்சொல் தேவை.',
+ 'password.mismatch': 'கடவுச்சொற்கள் பொருந்தவில்லை.',
+
+ // Side panel sections
+ 'panel.selectedDay': 'தேர்ந்தெடுக்கப்பட்ட நாள்',
+ 'panel.shareExport': 'பகிர்வு மற்றும் ஏற்றுமதி',
+ 'panel.dangerZone': 'ஆபத்தான பகுதி',
+ 'panel.urlLength': 'URL நீளம்',
+ 'panel.urlWarning': 'எச்சரிக்கை: நீண்ட URLகள் பகிரப்படும்போது துண்டிக்கப்படலாம்.',
+
+ // Timezone/world clock
+ 'tz.worldClock': 'உலகக் கடிகாரம்',
+ 'tz.subtitle': 'உள்ளூர் நேரம் மற்றும் சேமிக்கப்பட்ட மண்டலங்கள்',
+ 'tz.search': 'தேடு',
+ 'tz.searchPlaceholder': 'தேடு (எ.கா. லண்டன்)',
+ 'tz.noMatches': 'பொருத்தங்கள் இல்லை. நகரம் அல்லது UTC+5:30 முயற்சிக்கவும்.',
+ 'tz.addToCompare': 'ஒப்பிட நேர மண்டலத்தைச் சேர்க்கவும்.',
+ 'tz.notSupported': 'இந்த உலாவியில் நேர மண்டலத் தேடல் ஆதரிக்கப்படவில்லை.',
+
+ // Focus mode
+ 'focus.nextUpIn': 'அடுத்து வருவது',
+ 'focus.allClear': 'அனைத்தும் முடிந்தது',
+ 'focus.inProgress': 'நடைபெறுகிறது',
+ 'focus.noUpcoming': 'அடுத்த நிகழ்வுகள் இல்லை',
+ 'focus.upLater': 'பின்னர் வருவது',
+
+ // Calendar display
+ 'calendar.allDay': 'நாள் முழுவதும்',
+ 'calendar.moreEvents': '+{{count}} கூடுதல்',
+ 'calendar.noUpcoming': 'அடுத்த நிகழ்வுகள் இல்லை',
+ 'calendar.noEvents': 'நிகழ்வுகள் ஏதுமில்லை.',
+
+ // Settings
+ 'settings.weekStartsSunday': 'வாரம் ஞாயிற்றுக்கிழமை தொடங்குகிறது',
+ 'settings.weekStartsMonday': 'வாரம் திங்கட்கிழமை தொடங்குகிறது',
+ 'settings.themeLight': 'தோற்றம்: வெளிச்சம்',
+ 'settings.themeDark': 'தோற்றம்: இருள்',
+ 'settings.language': 'மொழி',
+
+ // Language names
+ 'lang.en': 'English',
+ 'lang.si': 'සිංහල',
+ 'lang.ta': 'தமிழ்',
+
+ // Toast messages
+ 'toast.linkCopied': 'இணைப்பு நகலெடுக்கப்பட்டது',
+ 'toast.eventsImported': 'நிகழ்வுகள் இறக்குமதி செய்யப்பட்டன',
+ 'toast.eventDeleted': 'நிகழ்வு அழிக்கப்பட்டது',
+ 'toast.eventsCleared': 'நிகழ்வுகள் அழிக்கப்பட்டன',
+ 'toast.jsonCopied': 'JSON நகலெடுக்கப்பட்டது',
+ 'toast.hashCopied': 'Hash நகலெடுக்கப்பட்டது',
+ 'toast.lockRemoved': 'பூட்டு அகற்றப்பட்டது',
+ 'toast.calendarLocked': 'நாட்காட்டி பூட்டப்பட்டது',
+ 'toast.calendarUnlocked': 'நாட்காட்டி திறக்கப்பட்டது',
+ 'toast.incorrectPassword': 'தவறான கடவுச்சொல்',
+ 'toast.unableToCopyLink': 'இணைப்பை நகலெடுக்க முடியவில்லை',
+ 'toast.unableToCopyJson': 'JSON ஐ நகலெடுக்க முடியவில்லை',
+ 'toast.unableToCopyHash': 'Hash ஐ நகலெடுக்க முடியவில்லை',
+ 'toast.noEventsFound': 'நிகழ்வுகள் ஏதுமில்லை',
+ 'toast.qrLibraryFailed': 'QR நூலகம் ஏற்றப்படவில்லை',
+ 'toast.qrError': 'QR குறியீட்டை உருவாக்குவதில் பிழை',
+
+ // Confirmation dialogs
+ 'confirm.deleteEvent': 'இந்த நிகழ்வை அழிக்கவா?',
+ 'confirm.clearAll': 'அனைத்து நிகழ்வுகளையும் அழிக்கவா? இதை மாற்ற முடியாது.',
+ 'confirm.removeLock': 'கடவுச்சொல் பாதுகாப்பை அகற்றவா? தரவு URL இல் குறியாக்கம் செய்யப்படாமல் சேமிக்கப்படும்.',
+
+ // Mobile warning
+ 'mobile.title': 'மொபைல் காட்சி அறிவிப்பு',
+ 'mobile.message': 'இந்த செயலி இன்னும் மொபைல் மற்றும் டேப்லெட் காட்சிக்கு மேம்படுத்தப்படவில்லை.',
+
+ // QR modal
+ 'qr.warning': 'எச்சரிக்கை: URL {{length}} எழுத்துகள் கொண்டது. சில QR ஸ்கேனர்கள் இவ்வளவு பெரிய குறியீடுகளைப் படிக்க சிரமப்படலாம்.',
+ 'qr.helper': 'உங்கள் நாட்காட்டியைத் திறக்க உங்கள் மொபைல் கேமராவை இந்தக் குறியீட்டை நோக்கி வைக்கவும்.',
+
+ // JSON modal
+ 'json.urlHash': 'URL Hash',
+ 'json.jsonData': 'JSON தரவு',
+
+ // Locked overlay
+ 'locked.title': 'குறியாக்கம் செய்யப்பட்ட நாட்காட்டி',
+ 'locked.message': 'இந்த நாட்காட்டியைத் திறந்து திருத்த கடவுச்சொல்லை உள்ளிடவும்.',
+
+ // Labels
+ 'label.details': 'விவரங்கள்',
+ 'label.events': 'நிகழ்வுகள்',
+ 'label.clock': 'கடிகாரம்',
+ 'label.calendar': 'நாட்காட்டி',
+ 'label.language': 'மொழி',
+ 'label.close': 'மூடு',
+ 'label.menu': 'மெனு',
+
+ // Countdown widget
+ 'countdown.upNext': 'அடுத்து வருவது',
+ 'countdown.startsAt': '{{time}} மணிக்கு தொடங்குகிறது',
+ 'countdown.starts': '{{date}} அன்று {{time}} மணிக்கு தொடங்குகிறது',
+
+ // Agenda view
+ 'agenda.title': 'நிகழ்ச்சி நிரல்',
+ 'agenda.rangeLabel': 'நிகழ்ச்சி நிரல் · {{range}}',
+
+ // Brand
+ 'brand.subtitle': 'சர்வர் இல்லாத தனிப்பயனாக்கப்பட்ட நாட்காட்டி. உங்கள் URL தான் உங்கள் கோப்பு.',
+
+ // World Planner
+ 'planner.addTimezone': 'நேர மண்டலத்தைச் சேர் (எ.கா. லண்டன்)',
+
+ // Month names
+ 'month.january': 'ஜனவரி',
+ 'month.february': 'பிப்ரவரி',
+ 'month.march': 'மார்ச்',
+ 'month.april': 'ஏப்ரல்',
+ 'month.may': 'மே',
+ 'month.june': 'ஜூன்',
+ 'month.july': 'ஜூலை',
+ 'month.august': 'ஆகஸ்ட்',
+ 'month.september': 'செப்டம்பர்',
+ 'month.october': 'அக்டோபர்',
+ 'month.november': 'நவம்பர்',
+ 'month.december': 'டிசம்பர்',
+
+ // Short month names
+ 'month.short.jan': 'ஜன',
+ 'month.short.feb': 'பிப்',
+ 'month.short.mar': 'மார்',
+ 'month.short.apr': 'ஏப்',
+ 'month.short.may': 'மே',
+ 'month.short.jun': 'ஜூன்',
+ 'month.short.jul': 'ஜூலை',
+ 'month.short.aug': 'ஆக',
+ 'month.short.sep': 'செப்',
+ 'month.short.oct': 'அக்',
+ 'month.short.nov': 'நவ',
+ 'month.short.dec': 'டிச',
+
+ // Weekday names
+ 'weekday.sunday': 'ஞாயிறு',
+ 'weekday.monday': 'திங்கள்',
+ 'weekday.tuesday': 'செவ்வாய்',
+ 'weekday.wednesday': 'புதன்',
+ 'weekday.thursday': 'வியாழன்',
+ 'weekday.friday': 'வெள்ளி',
+ 'weekday.saturday': 'சனி',
+
+ // Short weekday names
+ 'weekday.short.sun': 'ஞாயி',
+ 'weekday.short.mon': 'திங்',
+ 'weekday.short.tue': 'செவ்',
+ 'weekday.short.wed': 'புதன்',
+ 'weekday.short.thu': 'வியா',
+ 'weekday.short.fri': 'வெள்',
+ 'weekday.short.sat': 'சனி',
+
+ // Narrow weekday names (for year view)
+ 'weekday.narrow.sun': 'ஞா',
+ 'weekday.narrow.mon': 'தி',
+ 'weekday.narrow.tue': 'செ',
+ 'weekday.narrow.wed': 'பு',
+ 'weekday.narrow.thu': 'வி',
+ 'weekday.narrow.fri': 'வெ',
+ 'weekday.narrow.sat': 'ச',
+};
diff --git a/modules/i18n.js b/modules/i18n.js
index c4bed8b..4d50f97 100644
--- a/modules/i18n.js
+++ b/modules/i18n.js
@@ -1,10 +1,12 @@
import en from "../locales/en.js";
import si from "../locales/si.js";
+import ta from "../locales/ta.js";
-const translations = { en, si };
+const translations = { en, si, ta };
export const SUPPORTED_LANGUAGES = [
{ code: 'en', nameKey: 'lang.en' },
- { code: 'si', nameKey: 'lang.si' }
+ { code: 'si', nameKey: 'lang.si' },
+ { code: 'ta', nameKey: 'lang.ta' }
];
let currentLang = "en";
const updateCallbacks = [];
@@ -78,7 +80,9 @@ export function getCurrentLanguage() {
* @returns {string} Locale string ('en-US' or 'si-LK')
*/
export function getCurrentLocale() {
- return currentLang === 'si' ? 'si-LK' : 'en-US';
+ if (currentLang === 'si') return 'si-LK';
+ if (currentLang === 'ta') return 'ta-IN';
+ return 'en-US';
}
// Date helpers using translations
diff --git a/script.js b/script.js
index 0a978a9..738261c 100644
--- a/script.js
+++ b/script.js
@@ -24,6 +24,7 @@ import {
getCurrentLocale,
getTranslatedMonthName,
getTranslatedWeekday,
+ SUPPORTED_LANGUAGES,
} from "./modules/i18n.js";
const DEFAULT_COLORS = ["#ff6b6b", "#ffd43b", "#4dabf7", "#63e6be", "#9775fa"];
@@ -202,7 +203,8 @@ function normalizeState(raw) {
next.s.m = raw.s.m ? 1 : 0;
next.s.v = getStoredView(raw.s.v);
if (raw.s.l && typeof raw.s.l === "string") {
- next.s.l = raw.s.l === "si" ? "si" : "en";
+ const allowed = SUPPORTED_LANGUAGES.map((lang) => lang.code);
+ next.s.l = allowed.includes(raw.s.l) ? raw.s.l : "en";
}
}