Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"tabWidth": 4,
"useTabs": false,
"bracketSameLine": true
}
71 changes: 69 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "eslint ."
"lint": "eslint .",
"format": "prettier --write --plugin-search-dir=. .",
"formatfile": "prettier --write --plugin-search-dir=."
},
"devDependencies": {
"@steeze-ui/heroicons": "^2.2.1",
Expand All @@ -24,6 +26,8 @@
"eslint": "^8.28.0",
"eslint-plugin-svelte3": "^4.0.0",
"postcss": "^8.4.20",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"svelte": "^3.54.0",
"svelte-check": "^2.9.2",
"svelte-meta-tags": "^2.6.4",
Expand All @@ -34,6 +38,8 @@
},
"type": "module",
"dependencies": {
"daisyui": "^2.46.0"
"daisyui": "^2.46.0",
"marked": "^5.1.0",
"sveltekit-i18n": "^2.2.2"
}
}
17 changes: 17 additions & 0 deletions src/lib/PageTitle.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script lang="ts">
import { t } from "$lib/translations"

export let key;

const pageTitle = $t(
"common.sitetitle",
{
sitename: $t("common.watsonindustries"),
pagename: $t(key)
} as any // TS moment
);
</script>

<svelte:head>
<title>{pageTitle}</title>
</svelte:head>
10 changes: 10 additions & 0 deletions src/lib/lang/en/about.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"pagename": "About",
"header": "About",
"watsonindustrieslogo.alttext": "Watson Industries logo",
"description": "Watson Industries was founded on **Amelia's Birthday, January 6th**, and is the embodiment of the best parts of Ame, TeaMates, and Investigators:\n- creativity\n- talent\n- innovation\n- humor\n\nThe website is a living, non-profit open source project and is open to contributions.\n<br/><br/>\nWatsonIndustries.live is a fan project dedicated to [Amelia Watson](https://hololive.hololivepro.com/en/talents/watson-amelia/) of HololiveEN and is not associated with Cover Corp or Hololive Productions in any way. The project falls under the [Fan Work Guidelines](https://en.hololive.tv/terms).",
"featured": {
"header": "Want your content featured here?",
"description": "A process will come soon, for now you can simply DM [@DaniruKun on Twitter](https://twitter.com/danirukun)."
}
}
5 changes: 5 additions & 0 deletions src/lib/lang/en/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"watsonindustries": "Watson Industries",
"learnmore": "Learn more",
"sitetitle": "{{sitename}} - {{pagename}}"
}
25 changes: 25 additions & 0 deletions src/lib/lang/en/home.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"pagename": "Home",
"watsonindustries": {
"description": "Innovation knows no bounds at Watson Industries, where we push the limits of what's possible in rail, ametaverse, NFATs, Artificial Intelligence, groundpounding, and even time travel. Join us on the cutting edge of progress.",
"joinbutton.label": "Join Us"
},
"watsonrailways": {
"header": "Watson Railways",
"description": "Experience the future of transportation with Watson Railways, a subsidiary of Watson Industries. With cutting-edge technology and a dedication to safety and efficiency, we are revolutionizing the way we travel by rail.",
"logo.alttext": "Watson Railways logo"
},
"partners": {
"header": "Our Partners",
"description": "We would be nothing without our amazing partners, who supply us with nutrition and energy to keep pounding those grounds.",
"takoeats.logo.alttext": "Tako Eats logo",
"ubersheep.logo.alttext": "Uber Sheep logo by totangtotan",
"kfp.logo.alttext": "KFP logo with black background"
},
"opensource": {
"image.alttext": "Watson Industries loves open source",
"header": "Open Source",
"description": "At Watson Industries, we believe in the power of collaboration and sharing knowledge. That's why we make our projects open source, allowing others to contribute, learn, and innovate with us.",
"browsebutton.label": "Browse Projects"
}
}
27 changes: 27 additions & 0 deletions src/lib/lang/en/layout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"header.menu": {
"home": "Homepage",
"watsonrailways": "Watson Railways",
"ametaverse": "Ametaverse",
"amedoko": "AmeDoko App",
"about": "About"
},
"footer": {
"services": {
"header": "Services",
"watsonrailways": "Watson Railways",
"ametaverse": "Ametaverse",
"amedoko": "AmeDoko"
},
"company": {
"header": "Company",
"about": "About",
"credits": "Credits",
"github": "GitHub"
},
"legal": {
"header": "Legal",
"privacy": "Privacy & Cookie policy"
}
}
}
7 changes: 7 additions & 0 deletions src/lib/lang/en/privacy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"pagename": "Privacy",
"header": "Privacy Policy",
"tagline": "We don't want or need your cookies.",
"cookieimage.alttext": "Cookies from Irasutoya",
"description": "We only use [Plausible Analytics](https://plausible.io/) for statistics purposes and do not use any cookies or collect personal information.\n\nYou can read more about how Plausible collects analytics [on their official website](https://plausible.io/data-policy).\n\nHowever, pages that include iframes like YouTube embeds may use additional trackers. By visiting these pages you agree to [YouTube's privacy policy](https://support.google.com/youtube/answer/10364219)."
}
1 change: 1 addition & 0 deletions src/lib/lang/ja/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions src/lib/lang/ja/home.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions src/lib/lang/ko/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions src/lib/lang/ko/home.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
9 changes: 9 additions & 0 deletions src/lib/lang/lang.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"en": "English",
"ja": "日本語",
"ko": "한국어",
"nl": "Nederlands",
"de": "Deutsch",
"id": "Bahasa Indonesia",
"ru": "Русский"
}
20 changes: 20 additions & 0 deletions src/lib/lang/localizationIndex.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[
{
"key": "common"
},
{
"key": "layout"
},
{
"key": "home",
"routes": ["/"]
},
{
"key": "about",
"routes": ["/about"]
},
{
"key": "privacy",
"routes": ["/privacy"]
}
]
48 changes: 48 additions & 0 deletions src/lib/translations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import i18n from "sveltekit-i18n";
import lang from "./lang/lang.json";
import localizationIndex from "./lang/localizationIndex.json";

type Locale = keyof typeof lang;

type SyncTranslationsObject = {
[langcode: string]: {lang: typeof lang},
}

type AsyncLocaleLoader = {
locale: Locale,
key: string,
routes?: string[],
loader: () => Promise<object>
}

type LocaleFileDetails = {
key: string,
routes?: string[]
}

const syncTranslations: SyncTranslationsObject = {};
const asyncTranslations: AsyncLocaleLoader[] = [];

Object.keys(lang).forEach(langcode => {
syncTranslations[langcode] = { lang };
localizationIndex.forEach((localeFileDetails: LocaleFileDetails) => {
const { key, routes } = localeFileDetails;
const loader: AsyncLocaleLoader = {
locale: langcode as Locale,
key: key,
routes: routes,
loader: async () => (
await import(`./lang/${langcode}/${key}.json`)
).default,
};
asyncTranslations.push(loader)
});
});

/** @type {import("sveltekit-i18n").Config} */
const config = ({
loaders: asyncTranslations,
translations: syncTranslations
});

export const { t, locale, locales, loading, loadTranslations } = new i18n(config);
Loading