diff options
| author | Bobby <[email protected]> | 2024-08-12 12:48:41 -0400 |
|---|---|---|
| committer | Bobby <[email protected]> | 2024-08-12 12:48:41 -0400 |
| commit | a010777be6b23f8875f175f78af09b7539709b2d (patch) | |
| tree | b23faeeaa7167885757b83fee7b6d3a8f6ac07ee /static | |
| parent | 28d45547ac5a05ad2e6b11849608e45dc9eeca39 (diff) | |
| download | thatcomputerscientist-a010777be6b23f8875f175f78af09b7539709b2d.tar.xz thatcomputerscientist-a010777be6b23f8875f175f78af09b7539709b2d.zip | |
Using i18n for native `ja` translation::under construction
Diffstat (limited to 'static')
| -rw-r--r-- | static/js/globals.js | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/static/js/globals.js b/static/js/globals.js index c10d9016..9ac8ee7d 100644 --- a/static/js/globals.js +++ b/static/js/globals.js @@ -7,13 +7,21 @@ gtag("js", new Date()); gtag("config", "G-72XTC500FR"); function changeLang(lang) { - if (lang === "ja") { - translateJapanese(); - } else { - restoreLang(); - } + var date = new Date(); + date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000)); // 30 days + var expires = "expires=" + date.toUTCString(); + + // Set the cookie + document.cookie = "site_language=" + lang + ";" + expires + ";path=/"; + + // Debugging: Print cookie value + console.log("Cookie set: site_language=" + lang); + + // Reload the page to apply the new language + location.reload(); } + function copyToClipboard(text) { $("body").append( '<input type="text" value="' + text + '" id="copyToClipboard">' |
