Add linting with prettier.

This commit is contained in:
wearrrrr 2024-02-06 11:53:55 -06:00
parent c5b054d5ec
commit 39fc988bce
16 changed files with 11073 additions and 11077 deletions

2
.prettierignore Normal file
View file

@ -0,0 +1,2 @@
dist
node_modules

View file

@ -1,4 +1,4 @@
import { defineConfig } from 'astro/config'; import { defineConfig } from "astro/config";
import node from "@astrojs/node"; import node from "@astrojs/node";
@ -8,5 +8,5 @@ export default defineConfig({
output: "hybrid", output: "hybrid",
adapter: node({ adapter: node({
mode: "middleware", mode: "middleware",
}) }),
}); });

View file

@ -1,12 +1,12 @@
import { createBareServer } from "@tomphttp/bare-server-node" import { createBareServer } from "@tomphttp/bare-server-node";
import { uvPath } from "@nebula-services/ultraviolet" import { uvPath } from "@nebula-services/ultraviolet";
import http from 'node:http'; import http from "node:http";
import path from 'node:path'; import path from "node:path";
import express from 'express'; import express from "express";
import { handler as ssrHandler } from './dist/server/entry.mjs'; import { handler as ssrHandler } from "./dist/server/entry.mjs";
import dotenv from 'dotenv'; import dotenv from "dotenv";
import compression from "compression" import compression from "compression";
import chalk from "chalk" import chalk from "chalk";
dotenv.config(); dotenv.config();
const PORT = process.env.PORT || 3000; const PORT = process.env.PORT || 3000;
@ -19,15 +19,16 @@ app.use(express.static(path.join(process.cwd(), "static")));
app.use(express.static(path.join(process.cwd(), "build"))); app.use(express.static(path.join(process.cwd(), "build")));
app.use("/uv/", express.static(uvPath)); app.use("/uv/", express.static(uvPath));
app.use(express.json()); app.use(express.json());
app.use(express.urlencoded({ app.use(
extended: true express.urlencoded({
extended: true,
}) })
); );
app.use("/", express.static('dist/client/')); app.use("/", express.static("dist/client/"));
app.use(ssrHandler); app.use(ssrHandler);
app.get('*', function(req, res){ app.get("*", function (req, res) {
res.status(200).sendFile("404.html", {root: path.resolve("dist/client")}); res.status(200).sendFile("404.html", { root: path.resolve("dist/client") });
}); });
server.on("request", (req, res) => { server.on("request", (req, res) => {
@ -37,7 +38,7 @@ server.on("request", (req, res) => {
app(req, res); app(req, res);
} }
}); });
server.on("upgrade", (req, socket, head) => { server.on("upgrade", (req, socket, head) => {
if (bareServer.shouldRoute(req)) { if (bareServer.shouldRoute(req)) {
bareServer.routeUpgrade(req, socket, head); bareServer.routeUpgrade(req, socket, head);
@ -46,11 +47,11 @@ server.on("upgrade", (req, socket, head) => {
} }
}); });
console.log(chalk.gray("Starting Alu...")) console.log(chalk.gray("Starting Alu..."));
server.on("listening", () => { server.on("listening", () => {
console.log(chalk.green(`Server running at http://localhost:${PORT}/.`)); console.log(chalk.green(`Server running at http://localhost:${PORT}/.`));
}); });
server.listen({ server.listen({
port: PORT port: PORT,
}); });

21370
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,27 +1,32 @@
{ {
"name": "alus-unblocker", "name": "alus-unblocker",
"type": "module", "type": "module",
"version": "0.0.1", "version": "0.0.1",
"scripts": { "scripts": {
"start": "node .", "start": "node .",
"build": "astro build" "build": "astro build",
}, "lint": "prettier --write .",
"dependencies": { "lint:check": "prettier --check ."
"@astrojs/check": "^0.4.0", },
"@astrojs/node": "^7.0.4", "dependencies": {
"@nebula-services/ultraviolet": "^1.0.1-1.patch.5", "@astrojs/check": "^0.4.0",
"@tomphttp/bare-server-node": "^2.0.1", "@astrojs/node": "^7.0.4",
"astro": "^4.1.1", "@nebula-services/ultraviolet": "^1.0.1-1.patch.5",
"astro-i18n": "^2.2.4", "@tomphttp/bare-server-node": "^2.0.1",
"astro-i18next": "^1.0.0-beta.21", "astro": "^4.3.3",
"chalk": "^5.3.0", "astro-i18n": "^2.2.4",
"compression": "^1.7.4", "astro-i18next": "^1.0.0-beta.21",
"dotenv": "^16.3.1", "chalk": "^5.3.0",
"express": "^4.18.2", "compression": "^1.7.4",
"i": "^0.3.7", "dotenv": "^16.3.1",
"i18next": "^23.7.18", "express": "^4.18.2",
"i18next-browser-languagedetector": "^7.2.0", "i": "^0.3.7",
"npm": "^10.2.5", "i18next": "^23.7.18",
"typescript": "^5.3.3" "i18next-browser-languagedetector": "^7.2.0",
} "npm": "^10.2.5",
"typescript": "^5.3.3"
},
"devDependencies": {
"prettier": "3.2.5"
}
} }

10
prettier.config.js Normal file
View file

@ -0,0 +1,10 @@
const config = {
tabWidth: 2,
semi: true,
trailingComma: "es5",
bracketSpacing: true,
bracketSameLine: true,
arrowParens: "always",
};
export default config;

View file

@ -1,7 +1,7 @@
{ {
"nav": { "nav": {
"brand": "Alu", "brand": "Alu",
"games": "Games", "games": "Games",
"settings": "Settings" "settings": "Settings"
} }
} }

View file

@ -1,5 +1,5 @@
{ {
"brand": "アルー", "brand": "アルー",
"games": "ゲーム", "games": "ゲーム",
"settings": "設定" "settings": "設定"
} }

View file

@ -5,14 +5,14 @@
* Ideally, this will be registered under the scope in uv.config.js so it will not need to be modified. * Ideally, this will be registered under the scope in uv.config.js so it will not need to be modified.
* However, if a user changes the location of uv.bundle.js/uv.config.js or sw.js is not relative to them, they will need to modify this script locally. * However, if a user changes the location of uv.bundle.js/uv.config.js or sw.js is not relative to them, they will need to modify this script locally.
*/ */
importScripts('/uv/uv.bundle.js'); importScripts("/uv/uv.bundle.js");
importScripts('/uv.config.js'); importScripts("/uv.config.js");
importScripts(__uv$config.sw); importScripts(__uv$config.sw);
self.addEventListener("install", (event) => { self.addEventListener("install", (event) => {
self.skipWaiting(); self.skipWaiting();
}); });
const sw = new UVServiceWorker(); const sw = new UVServiceWorker();
self.addEventListener('fetch', (event) => event.respondWith(sw.fetch(event))); self.addEventListener("fetch", (event) => event.respondWith(sw.fetch(event)));

View file

@ -1,12 +1,12 @@
/*global Ultraviolet*/ /*global Ultraviolet*/
self.__uv$config = { self.__uv$config = {
prefix: '/service/', prefix: "/service/",
bare: '/bare/', bare: "/bare/",
encodeUrl: Ultraviolet.codec.xor.encode, encodeUrl: Ultraviolet.codec.xor.encode,
decodeUrl: Ultraviolet.codec.xor.decode, decodeUrl: Ultraviolet.codec.xor.decode,
handler: '/uv/uv.handler.js', handler: "/uv/uv.handler.js",
client: '/uv/uv.client.js', client: "/uv/uv.client.js",
bundle: '/uv/uv.bundle.js', bundle: "/uv/uv.bundle.js",
config: '/uv/uv.config.js', config: "/uv/uv.config.js",
sw: '/uv/uv.sw.js', sw: "/uv/uv.sw.js",
}; };

440
src/env.d.ts vendored
View file

@ -1,205 +1,247 @@
/// <reference types="astro/client" /> /// <reference types="astro/client" />
// ###> astro-i18n/type-generation ### // ###> astro-i18n/type-generation ###
type PrimaryLocale = "en" type PrimaryLocale = "en";
type SecondaryLocale = "" type SecondaryLocale = "";
type Locale = PrimaryLocale | SecondaryLocale type Locale = PrimaryLocale | SecondaryLocale;
type RouteParameters = {"/games":undefined;"/":undefined;"/settings":undefined;"/404":undefined;} type RouteParameters = {
type Route = keyof RouteParameters "/games": undefined;
type TranslationVariables = {"nav.brand":object|undefined;"nav.games":object|undefined;"nav.settings":object|undefined;} "/": undefined;
type Translation = keyof TranslationVariables "/settings": undefined;
type Environment = "none"|"node"|"browser" "/404": undefined;
};
type Route = keyof RouteParameters;
type TranslationVariables = {
"nav.brand": object | undefined;
"nav.games": object | undefined;
"nav.settings": object | undefined;
};
type Translation = keyof TranslationVariables;
type Environment = "none" | "node" | "browser";
declare module "astro-i18n" { declare module "astro-i18n" {
type GetStaticPathsProps = {paginate:Function;rss:Function} type GetStaticPathsProps = { paginate: Function; rss: Function };
type GetStaticPathsItem = {params:Record<string,number|string|undefined>;props?:Record<string,unknown>} type GetStaticPathsItem = {
type DeepStringRecord = {[key: string]:string|DeepStringRecord} params: Record<string, number | string | undefined>;
type TranslationDirectory = {i18n?:string;pages?: string} props?: Record<string, unknown>;
export type Translations = {[group: string]:{[locale: string]: DeepStringRecord}} };
export type TranslationFormatters = {[formatterName: string]:(value:unknown,...args:unknown[])=>unknown} type DeepStringRecord = { [key: string]: string | DeepStringRecord };
export type TranslationLoadingRules = {groups:string[];routes: string[]}[] type TranslationDirectory = { i18n?: string; pages?: string };
export type SegmentTranslations = {[secondaryLocale: string]:{[segment: string]:string}} export type Translations = {
export interface AstroI18nConfig {primaryLocale:string;secondaryLocales:string[];fallbackLocale:string;showPrimaryLocale:boolean;trailingSlash:"always"|"never";run:"server"|"client+server";translations:Translations;translationLoadingRules:TranslationLoadingRules;translationDirectory:TranslationDirectory;routes:SegmentTranslations;srcDir:string;} [group: string]: { [locale: string]: DeepStringRecord };
/** Typed astro-i18n config definition. */ };
export function defineAstroI18nConfig(config: Partial<AstroI18nConfig>): Partial<AstroI18nConfig> export type TranslationFormatters = {
/** The `astro-i18n` middleware. */ [formatterName: string]: (value: unknown, ...args: unknown[]) => unknown;
export function useAstroI18n( };
config?: Partial<AstroI18nConfig> | string, export type TranslationLoadingRules = {
formatters?: TranslationFormatters, groups: string[];
): (...args: any[]) => any routes: string[];
/** Workaround function to make astroI18n work inside getStaticPaths. This is because Astro's getStaticPaths runs before everything which doesn't allows astroI18n to update its state automatically. */ }[];
function createGetStaticPaths( export type SegmentTranslations = {
callback: ( [secondaryLocale: string]: { [segment: string]: string };
props: GetStaticPathsProps, };
) => GetStaticPathsItem[] | Promise<GetStaticPathsItem[]>, export interface AstroI18nConfig {
): (props: GetStaticPathsProps & { primaryLocale: string;
astroI18n?: { secondaryLocales: string[];
locale: string; fallbackLocale: string;
}; showPrimaryLocale: boolean;
}) => Promise<GetStaticPathsItem[]> trailingSlash: "always" | "never";
/** run: "server" | "client+server";
* @param key The translation key, for example `"my.nested.translation.key"`. translations: Translations;
* @param properties An object containing your interpolation variables and/or your variants, for example `{ variant: 3, interpolation: "text" }`. translationLoadingRules: TranslationLoadingRules;
* @param options `route`: Overrides the current route, you will be able to access that route's translations. `locale`: Overrides the current locale, this allows you to control which language you want to translate to. `fallbackLocale`: Overrides the fallback locale. translationDirectory: TranslationDirectory;
*/ routes: SegmentTranslations;
export function t<T extends Translation>( srcDir: string;
key: T | string & {}, }
...args: undefined extends TranslationVariables[T] /** Typed astro-i18n config definition. */
? [ export function defineAstroI18nConfig(
properties?: keyof TranslationVariables extends T config: Partial<AstroI18nConfig>
? Record<string, unknown> ): Partial<AstroI18nConfig>;
: TranslationVariables[T], /** The `astro-i18n` middleware. */
options?: { export function useAstroI18n(
route?: Route | string & {} config?: Partial<AstroI18nConfig> | string,
locale?: Locale | string & {} formatters?: TranslationFormatters
fallbackLocale?: Locale | string & {} ): (...args: any[]) => any;
} /** Workaround function to make astroI18n work inside getStaticPaths. This is because Astro's getStaticPaths runs before everything which doesn't allows astroI18n to update its state automatically. */
] function createGetStaticPaths(
: [ callback: (
properties: TranslationVariables[T], props: GetStaticPathsProps
options?: { ) => GetStaticPathsItem[] | Promise<GetStaticPathsItem[]>
route?: Route | string & {} ): (
locale?: Locale | string & {} props: GetStaticPathsProps & {
fallbackLocale?: Locale | string & {} astroI18n?: {
} locale: string;
] };
): string }
/** ) => Promise<GetStaticPathsItem[]>;
* @param route A route in any of the configured languages, for example `"/en/my/english/route/[param]"`. /**
* @param parameters An object containing your route parameters, for example `{ slug: "my-blog-post-slug" }`. * @param key The translation key, for example `"my.nested.translation.key"`.
* @param options `targetLocale`: Overrides the target locale. `routeLocale`: Overrides the given route locale, this is useful if astro-i18n cannot figure out the route's locale. `showPrimaryLocale`: Overrides the showPrimaryLocale parameter. `query`: Adds these query parameters at the end of the translated route. * @param properties An object containing your interpolation variables and/or your variants, for example `{ variant: 3, interpolation: "text" }`.
*/ * @param options `route`: Overrides the current route, you will be able to access that route's translations. `locale`: Overrides the current locale, this allows you to control which language you want to translate to. `fallbackLocale`: Overrides the fallback locale.
export function l<T extends Route>( */
route: T | string & {}, export function t<T extends Translation>(
...args: T extends keyof RouteParameters key: T | (string & {}),
? undefined extends RouteParameters[T] ...args: undefined extends TranslationVariables[T]
? [ ? [
parameters?: Record<string, string>, properties?: keyof TranslationVariables extends T
options?: { ? Record<string, unknown>
targetLocale?: string, : TranslationVariables[T],
routeLocale?: string, options?: {
showPrimaryLocale?: string, route?: Route | (string & {});
query?: Record<string, unknown> locale?: Locale | (string & {});
} fallbackLocale?: Locale | (string & {});
] },
: [ ]
parameters: RouteParameters[T], : [
options?: { properties: TranslationVariables[T],
targetLocale?: string, options?: {
routeLocale?: string, route?: Route | (string & {});
showPrimaryLocale?: string, locale?: Locale | (string & {});
query?: Record<string, unknown> fallbackLocale?: Locale | (string & {});
} },
] ]
: [ ): string;
parameters?: Record<string, string>, /**
options?: { * @param route A route in any of the configured languages, for example `"/en/my/english/route/[param]"`.
targetLocale?: string, * @param parameters An object containing your route parameters, for example `{ slug: "my-blog-post-slug" }`.
routeLocale?: string, * @param options `targetLocale`: Overrides the target locale. `routeLocale`: Overrides the given route locale, this is useful if astro-i18n cannot figure out the route's locale. `showPrimaryLocale`: Overrides the showPrimaryLocale parameter. `query`: Adds these query parameters at the end of the translated route.
showPrimaryLocale?: string, */
query?: Record<string, unknown> export function l<T extends Route>(
} route: T | (string & {}),
] ...args: T extends keyof RouteParameters
): string ? undefined extends RouteParameters[T]
class AstroI18n { ? [
/** The detected runtime environment. */ parameters?: Record<string, string>,
environment: Environment options?: {
/** The current page route. */ targetLocale?: string;
route: string routeLocale?: string;
/** All page routes. For example: `["/", "/about", "/posts/[slug]"]` */ showPrimaryLocale?: string;
pages: string[] query?: Record<string, unknown>;
/** The equivalent page for the current route. For example if route is equal to `"/posts/my-cool-cat"` this could return `"/posts/[slug]"`. */ },
page: string ]
/** The current page locale. */ : [
locale: Locale parameters: RouteParameters[T],
/** All configured locales. */ options?: {
locales: Locale[] targetLocale?: string;
/** The default/primary locale. */ routeLocale?: string;
primaryLocale: PrimaryLocale showPrimaryLocale?: string;
/** Locales other than the default/primary one. */ query?: Record<string, unknown>;
secondaryLocales: SecondaryLocale[] },
/** The fallback locale, when a translation is missing in a locale the fallback locale will be used to find a replacement. */ ]
fallbackLocale: Locale : [
/** True when astro-i18n is initialized. */ parameters?: Record<string, string>,
isInitialized: boolean options?: {
/** targetLocale?: string;
* @param key The translation key, for example `"my.nested.translation.key"`. routeLocale?: string;
* @param properties An object containing your interpolation variables and/or your variants, for example `{ variant: 3, interpolation: "text" }`. showPrimaryLocale?: string;
* @param options `route`: Overrides the current route, you will be able to access that route's translations. `locale`: Overrides the current locale, this allows you to control which language you want to translate to. `fallbackLocale`: Overrides the fallback locale. query?: Record<string, unknown>;
*/ },
t<T extends Translation>( ]
key: T | string & {}, ): string;
...args: undefined extends TranslationVariables[T] class AstroI18n {
? [ /** The detected runtime environment. */
properties?: keyof TranslationVariables extends T environment: Environment;
? Record<string, unknown> /** The current page route. */
: TranslationVariables[T], route: string;
options?: { /** All page routes. For example: `["/", "/about", "/posts/[slug]"]` */
route?: Route | string & {} pages: string[];
locale?: Locale | string & {} /** The equivalent page for the current route. For example if route is equal to `"/posts/my-cool-cat"` this could return `"/posts/[slug]"`. */
fallbackLocale?: Locale | string & {} page: string;
} /** The current page locale. */
] locale: Locale;
: [ /** All configured locales. */
properties: TranslationVariables[T], locales: Locale[];
options?: { /** The default/primary locale. */
route?: Route | string & {} primaryLocale: PrimaryLocale;
locale?: Locale | string & {} /** Locales other than the default/primary one. */
fallbackLocale?: Locale | string & {} secondaryLocales: SecondaryLocale[];
} /** The fallback locale, when a translation is missing in a locale the fallback locale will be used to find a replacement. */
] fallbackLocale: Locale;
): string /** True when astro-i18n is initialized. */
/** isInitialized: boolean;
* @param route A route in any of the configured languages, for example `"/en/my/english/route/[param]"`. /**
* @param parameters An object containing your route parameters, for example `{ slug: "my-blog-post-slug" }`. * @param key The translation key, for example `"my.nested.translation.key"`.
* @param options `targetLocale`: Overrides the target locale. `routeLocale`: Overrides the given route locale, this is useful if astro-i18n cannot figure out the route's locale. `showPrimaryLocale`: Overrides the showPrimaryLocale parameter. `query`: Adds these query parameters at the end of the translated route. * @param properties An object containing your interpolation variables and/or your variants, for example `{ variant: 3, interpolation: "text" }`.
*/ * @param options `route`: Overrides the current route, you will be able to access that route's translations. `locale`: Overrides the current locale, this allows you to control which language you want to translate to. `fallbackLocale`: Overrides the fallback locale.
l<T extends Route>( */
route: T | string & {}, t<T extends Translation>(
...args: T extends keyof RouteParameters key: T | (string & {}),
? undefined extends RouteParameters[T] ...args: undefined extends TranslationVariables[T]
? [ ? [
parameters?: Record<string, string>, properties?: keyof TranslationVariables extends T
options?: { ? Record<string, unknown>
targetLocale?: string, : TranslationVariables[T],
routeLocale?: string, options?: {
showPrimaryLocale?: string, route?: Route | (string & {});
query?: Record<string, unknown> locale?: Locale | (string & {});
} fallbackLocale?: Locale | (string & {});
] },
: [ ]
parameters: RouteParameters[T], : [
options?: { properties: TranslationVariables[T],
targetLocale?: string, options?: {
routeLocale?: string, route?: Route | (string & {});
showPrimaryLocale?: string, locale?: Locale | (string & {});
query?: Record<string, unknown> fallbackLocale?: Locale | (string & {});
} },
] ]
: [ ): string;
parameters?: Record<string, string>, /**
options?: { * @param route A route in any of the configured languages, for example `"/en/my/english/route/[param]"`.
targetLocale?: string, * @param parameters An object containing your route parameters, for example `{ slug: "my-blog-post-slug" }`.
routeLocale?: string, * @param options `targetLocale`: Overrides the target locale. `routeLocale`: Overrides the given route locale, this is useful if astro-i18n cannot figure out the route's locale. `showPrimaryLocale`: Overrides the showPrimaryLocale parameter. `query`: Adds these query parameters at the end of the translated route.
showPrimaryLocale?: string, */
query?: Record<string, unknown> l<T extends Route>(
} route: T | (string & {}),
] ...args: T extends keyof RouteParameters
): string ? undefined extends RouteParameters[T]
/** Adds new translations at runtime. */ ? [
addTranslations(translations: Translations): this parameters?: Record<string, string>,
/** Adds new translation formatters at runtime. */ options?: {
addFormatters(translationFormatters: TranslationFormatters): this targetLocale?: string;
/** Adds new translation loading rules at runtime. */ routeLocale?: string;
addTranslationLoadingRules(translationLoadingRules: TranslationLoadingRules): this showPrimaryLocale?: string;
/** Adds new route segment translations at runtime. */ query?: Record<string, unknown>;
addRoutes(routes: SegmentTranslations): this },
/** Tries to parse one of the configured locales out of the given route. If no configured locale is found it will return `null`. */ ]
extractRouteLocale(route: string): string|null : [
/** Initializes astro-i18n on the server-side. */ parameters: RouteParameters[T],
initialize(config?: Partial<AstroI18nConfig> | string, formatters?: TranslationFormatters = {}): Promise<void> options?: {
/** Redirects the user to the given destination. */ targetLocale?: string;
redirect(destination: string | URL, status = 301) routeLocale?: string;
} showPrimaryLocale?: string;
export const astroI18n: AstroI18n query?: Record<string, unknown>;
},
]
: [
parameters?: Record<string, string>,
options?: {
targetLocale?: string;
routeLocale?: string;
showPrimaryLocale?: string;
query?: Record<string, unknown>;
},
]
): string;
/** Adds new translations at runtime. */
addTranslations(translations: Translations): this;
/** Adds new translation formatters at runtime. */
addFormatters(translationFormatters: TranslationFormatters): this;
/** Adds new translation loading rules at runtime. */
addTranslationLoadingRules(
translationLoadingRules: TranslationLoadingRules
): this;
/** Adds new route segment translations at runtime. */
addRoutes(routes: SegmentTranslations): this;
/** Tries to parse one of the configured locales out of the given route. If no configured locale is found it will return `null`. */
extractRouteLocale(route: string): string | null;
/** Initializes astro-i18n on the server-side. */
initialize(
config?: Partial<AstroI18nConfig> | string,
formatters?: TranslationFormatters = {}
): Promise<void>;
/** Redirects the user to the given destination. */
redirect(destination: string | URL, status = 301);
}
export const astroI18n: AstroI18n;
} }
// ###< astro-i18n/type-generation ### // ###< astro-i18n/type-generation ###

View file

@ -1,48 +1,47 @@
{ {
"ultraviolet": "Ultraviolet", "ultraviolet": "Ultraviolet",
"pages.home": "Home | Alu", "pages.home": "Home | Alu",
"pages.games": "Games | Alu", "pages.games": "Games | Alu",
"pages.settings": "Settings | Alu", "pages.settings": "Settings | Alu",
"nav.brand": "Alu",
"nav.games": "Games",
"nav.settings": "Settings",
"nav.brand": "Alu", "menu.welcome": "Welcome to Alu",
"nav.games": "Games", "menu.search": "Search...",
"nav.settings": "Settings",
"menu.welcome": "Welcome to Alu", "footer.brand": "Alu",
"menu.search": "Search...", "footer.madeWithLove": "Made with ❤️ by wearr",
"footer.services": "Services",
"footer.socials": "Socials",
"footer.aluProject": "Alu Project",
"footer.brand": "Alu", "games.title": "Games",
"footer.madeWithLove": "Made with ❤️ by wearr",
"footer.services": "Services",
"footer.socials": "Socials",
"footer.aluProject": "Alu Project",
"games.title": "Games", "settings.title": "Settings",
"settings.proxy": "Proxy",
"settings.proxy.auto": "Auto",
"settings.proxy.selectedProxy": "Selected Proxy",
"settings.proxy.searchEngine": "Search Engine",
"settings.proxy.openPageWith": "Open With",
"settings.proxy.openPageWith.embed": "Embed",
"settings.proxy.openPageWith.newTab": "New Tab",
"settings.proxy.searxngURL": "Searx URL",
"settings.proxy.bareURL": "Bare URL",
"settings.title": "Settings", "settings.customization": "Customization",
"settings.proxy": "Proxy", "settings.customization.theme": "Theme",
"settings.proxy.auto": "Auto", "settings.customization.theme.Alu": "Alu",
"settings.proxy.selectedProxy": "Selected Proxy", "settings.customization.theme.Macchiato": "Macchiato",
"settings.proxy.searchEngine": "Search Engine", "settings.customization.theme.Mocha": "Mocha",
"settings.proxy.openPageWith": "Open With", "settings.customization.language": "Language",
"settings.proxy.openPageWith.embed": "Embed",
"settings.proxy.openPageWith.newTab": "New Tab",
"settings.proxy.searxngURL": "Searx URL",
"settings.proxy.bareURL": "Bare URL",
"settings.customization": "Customization", "settings.cloaking": "Cloaking",
"settings.customization.theme": "Theme", "settings.cloaking.subtext": "Change how your tab looks...",
"settings.customization.theme.Alu": "Alu",
"settings.customization.theme.Macchiato": "Macchiato",
"settings.customization.theme.Mocha": "Mocha",
"settings.customization.language": "Language",
"settings.cloaking": "Cloaking", "settings.credits": "Credits",
"settings.cloaking.subtext": "Change how your tab looks...", "settings.credits.mochaandmacchiatothemes": "Mocha & Macchiato Themes",
"settings.credits.japaneseTranslations": "Japanese Translations"
"settings.credits": "Credits", }
"settings.credits.mochaandmacchiatothemes": "Mocha & Macchiato Themes",
"settings.credits.japaneseTranslations": "Japanese Translations"
}

View file

@ -1,46 +1,46 @@
{ {
"ultraviolet": "ウルトラバイオレット", "ultraviolet": "ウルトラバイオレット",
"pages.home": "ホーム | アルー",
"pages.games": "ゲーム | アルー",
"pages.settings": "設定 | アルー",
"nav.brand": "アルー", "pages.home": "ホーム | アルー",
"nav.games": "ゲーム", "pages.games": "ゲーム | アルー",
"nav.settings": "設定", "pages.settings": "設定 | アルー",
"menu.welcome": "アルーにようこそ", "nav.brand": "アルー",
"menu.search": "検索...", "nav.games": "ゲーム",
"nav.settings": "設定",
"footer.brand": "アルー", "menu.welcome": "アルーにようこそ",
"footer.madeWithLove": "wearrによる❤で作られました", "menu.search": "検索...",
"footer.services": "サービス",
"footer.socials": "ソーシャル",
"footer.aluProject": "アループロジェクト",
"games.title": "ゲーム", "footer.brand": "アルー",
"footer.madeWithLove": "wearrによる❤で作られました",
"footer.services": "サービス",
"footer.socials": "ソーシャル",
"footer.aluProject": "アループロジェクト",
"settings.title": "設定", "games.title": "ゲーム",
"settings.proxy": "プロキシ",
"settings.proxy.selectedProxy": "選択されたプロキシ",
"settings.proxy.searchEngine": "検索エンジン",
"settings.proxy.openPageWith": "開く",
"settings.proxy.searxngURL": "SearxのURL",
"settings.proxy.openPageWith.embed": "埋め込み",
"settings.proxy.openPageWith.newTab": "新しいタブ",
"settings.proxy.bareURL": "BareのURL",
"settings.customization": "カスタマイズ", "settings.title": "設定",
"settings.customization.theme": "テーマ", "settings.proxy": "プロキシ",
"settings.customization.theme.Alu": "アルー", "settings.proxy.selectedProxy": "選択されたプロキシ",
"settings.customization.theme.Macchiato": "マキアート", "settings.proxy.searchEngine": "検索エンジン",
"settings.customization.theme.Mocha": "モカ", "settings.proxy.openPageWith": "開く",
"settings.customization.language": "言語", "settings.proxy.searxngURL": "SearxのURL",
"settings.proxy.openPageWith.embed": "埋め込み",
"settings.cloaking": "クローキング", "settings.proxy.openPageWith.newTab": "新しいタブ",
"settings.cloaking.subtext": "タブの外観を変更します...", "settings.proxy.bareURL": "BareのURL",
"settings.credits": "クレジット", "settings.customization": "カスタマイズ",
"settings.credits.mochaandmacchiatothemes": "モカとマキアートテーマ", "settings.customization.theme": "テーマ",
"settings.credits.japaneseTranslations": "日本語翻訳" "settings.customization.theme.Alu": "アルー",
} "settings.customization.theme.Macchiato": "マキアート",
"settings.customization.theme.Mocha": "モカ",
"settings.customization.language": "言語",
"settings.cloaking": "クローキング",
"settings.cloaking.subtext": "タブの外観を変更します...",
"settings.credits": "クレジット",
"settings.credits.mochaandmacchiatothemes": "モカとマキアートテーマ",
"settings.credits.japaneseTranslations": "日本語翻訳"
}

View file

@ -1,9 +1,9 @@
import en from './en.json'; import en from "./en.json";
import jp from './jp.json'; import jp from "./jp.json";
export const defaultLang = "en";
export const defaultLang = 'en';
export const ui = { export const ui = {
en, en,
jp jp,
}; };

View file

@ -1,14 +1,14 @@
import { ui, defaultLang } from './ui'; import { ui, defaultLang } from "./ui";
export function getLangFromUrl(url: URL) { export function getLangFromUrl(url: URL) {
// comma lol // comma lol
const [, lang] = url.pathname.split('/'); const [, lang] = url.pathname.split("/");
if (lang in ui) return lang as keyof typeof ui; if (lang in ui) return lang as keyof typeof ui;
return defaultLang; return defaultLang;
} }
export function useTranslations(lang: keyof typeof ui) { export function useTranslations(lang: keyof typeof ui) {
return function t(key: keyof typeof ui[typeof defaultLang]) { return function t(key: keyof (typeof ui)[typeof defaultLang]) {
return ui[lang][key] || ui[defaultLang][key]; return ui[lang][key] || ui[defaultLang][key];
} };
} }

View file

@ -1,3 +1,6 @@
{ {
"extends": "astro/tsconfigs/strict" "extends": "astro/tsconfigs/strict",
} "compilerOptions": {
"verbatimModuleSyntax": false
}
}