feat: i18n for dates

This commit is contained in:
Raj Nandan Sharma
2025-01-18 23:10:07 +05:30
parent 7247a54c08
commit 130b70c6af
4 changed files with 11 additions and 3 deletions
+1
View File
@@ -34,6 +34,7 @@ You can pass the following parameters to the embed code
- `theme`: You can pass `light` or `dark` theme
- `monitor`: The monitor url
- `bgc`: Background color of the monitor. Only supports hex color codes. DO NOT include the `#` symbol
- `locale`: The locale of the monitor. You can pass the code of the locale you have enabled in your kener settings
Replace `[hostname]` with your kener hostname and `[tag]` with your monitor tag.
+7 -1
View File
@@ -28,10 +28,16 @@ description: Roadmap for Kener
☐ Introduce sitemap.xml
Migrate from moment to date-fns
~~Migrate from moment to date-fns for status page~~ (moment remains in dashboard. Will remove later)
~~Create Admin UI~~ Released in (3.0.0)
☐ Webhook customization
☐ Monitor Update Screen
☐ i18n for admin dashboard
---
Request a feature or start a discussion [here](https://github.com/rajnandan1/kener/discussions/119)
+1 -1
View File
@@ -14,7 +14,7 @@
Hello world
<script
async
src="http://localhost:3000/embed/monitor-earth/js?theme=light&monitor=http://localhost:3000/embed/monitor-earth"
src="http://localhost:3000/embed/monitor-earth/js?theme=dark&bgc=111&locale=hi&monitor=http://localhost:3000/embed/monitor-earth"
></script>
</body>
</html>
@@ -6,6 +6,7 @@ export async function GET({ url, params }) {
const uriEmbedded = query.get("monitor");
const theme = query.get("theme") || "light";
const bgc = query.get("bgc") || "transparent";
const locale = query.get("locale") || "en";
const uriOriginal = uriEmbedded;
const currentSlug = tag;
@@ -15,7 +16,7 @@ export async function GET({ url, params }) {
var uid = "KENER_" + ~~(new Date().getTime() / 86400000);
var uriOriginal = "${uriOriginal}";
var uriOriginalNoProtocol = uriOriginal.split("//").pop();
var uriEmbedded = "${uriEmbedded}?theme=${theme}&bgc=${bgc}";
var uriEmbedded = "${uriEmbedded}?theme=${theme}&bgc=${bgc}&locale=${locale}";
var currentSlug = "${currentSlug}";
var target = document.querySelector("script[src*='" + uriOriginalNoProtocol + "']");
var iframe = document.createElement("iframe");