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";
@ -8,5 +8,5 @@ export default defineConfig({
output: "hybrid",
adapter: node({
mode: "middleware",
})
});
}),
});

View file

@ -1,12 +1,12 @@
import { createBareServer } from "@tomphttp/bare-server-node"
import { uvPath } from "@nebula-services/ultraviolet"
import http from 'node:http';
import path from 'node:path';
import express from 'express';
import { handler as ssrHandler } from './dist/server/entry.mjs';
import dotenv from 'dotenv';
import compression from "compression"
import chalk from "chalk"
import { createBareServer } from "@tomphttp/bare-server-node";
import { uvPath } from "@nebula-services/ultraviolet";
import http from "node:http";
import path from "node:path";
import express from "express";
import { handler as ssrHandler } from "./dist/server/entry.mjs";
import dotenv from "dotenv";
import compression from "compression";
import chalk from "chalk";
dotenv.config();
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("/uv/", express.static(uvPath));
app.use(express.json());
app.use(express.urlencoded({
extended: true
app.use(
express.urlencoded({
extended: true,
})
);
app.use("/", express.static('dist/client/'));
app.use("/", express.static("dist/client/"));
app.use(ssrHandler);
app.get('*', function(req, res){
res.status(200).sendFile("404.html", {root: path.resolve("dist/client")});
app.get("*", function (req, res) {
res.status(200).sendFile("404.html", { root: path.resolve("dist/client") });
});
server.on("request", (req, res) => {
@ -37,7 +38,7 @@ server.on("request", (req, res) => {
app(req, res);
}
});
server.on("upgrade", (req, socket, head) => {
if (bareServer.shouldRoute(req)) {
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", () => {
console.log(chalk.green(`Server running at http://localhost:${PORT}/.`));
});
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",
"type": "module",
"version": "0.0.1",
"scripts": {
"start": "node .",
"build": "astro build"
},
"dependencies": {
"@astrojs/check": "^0.4.0",
"@astrojs/node": "^7.0.4",
"@nebula-services/ultraviolet": "^1.0.1-1.patch.5",
"@tomphttp/bare-server-node": "^2.0.1",
"astro": "^4.1.1",
"astro-i18n": "^2.2.4",
"astro-i18next": "^1.0.0-beta.21",
"chalk": "^5.3.0",
"compression": "^1.7.4",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"i": "^0.3.7",
"i18next": "^23.7.18",
"i18next-browser-languagedetector": "^7.2.0",
"npm": "^10.2.5",
"typescript": "^5.3.3"
}
"name": "alus-unblocker",
"type": "module",
"version": "0.0.1",
"scripts": {
"start": "node .",
"build": "astro build",
"lint": "prettier --write .",
"lint:check": "prettier --check ."
},
"dependencies": {
"@astrojs/check": "^0.4.0",
"@astrojs/node": "^7.0.4",
"@nebula-services/ultraviolet": "^1.0.1-1.patch.5",
"@tomphttp/bare-server-node": "^2.0.1",
"astro": "^4.3.3",
"astro-i18n": "^2.2.4",
"astro-i18next": "^1.0.0-beta.21",
"chalk": "^5.3.0",
"compression": "^1.7.4",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"i": "^0.3.7",
"i18next": "^23.7.18",
"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": {
"brand": "Alu",
"games": "Games",
"settings": "Settings"
}
}
"nav": {
"brand": "Alu",
"games": "Games",
"settings": "Settings"
}
}

View file

@ -1,5 +1,5 @@
{
"brand": "アルー",
"games": "ゲーム",
"settings": "設定"
}
"brand": "アルー",
"games": "ゲーム",
"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.
* 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.config.js');
importScripts("/uv/uv.bundle.js");
importScripts("/uv.config.js");
importScripts(__uv$config.sw);
self.addEventListener("install", (event) => {
self.skipWaiting();
self.skipWaiting();
});
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*/
self.__uv$config = {
prefix: '/service/',
bare: '/bare/',
encodeUrl: Ultraviolet.codec.xor.encode,
decodeUrl: Ultraviolet.codec.xor.decode,
handler: '/uv/uv.handler.js',
client: '/uv/uv.client.js',
bundle: '/uv/uv.bundle.js',
config: '/uv/uv.config.js',
sw: '/uv/uv.sw.js',
};
prefix: "/service/",
bare: "/bare/",
encodeUrl: Ultraviolet.codec.xor.encode,
decodeUrl: Ultraviolet.codec.xor.decode,
handler: "/uv/uv.handler.js",
client: "/uv/uv.client.js",
bundle: "/uv/uv.bundle.js",
config: "/uv/uv.config.js",
sw: "/uv/uv.sw.js",
};

440
src/env.d.ts vendored
View file

@ -1,205 +1,247 @@
/// <reference types="astro/client" />
// ###> astro-i18n/type-generation ###
type PrimaryLocale = "en"
type SecondaryLocale = ""
type Locale = PrimaryLocale | SecondaryLocale
type RouteParameters = {"/games":undefined;"/":undefined;"/settings":undefined;"/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"
type PrimaryLocale = "en";
type SecondaryLocale = "";
type Locale = PrimaryLocale | SecondaryLocale;
type RouteParameters = {
"/games": undefined;
"/": undefined;
"/settings": undefined;
"/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" {
type GetStaticPathsProps = {paginate:Function;rss:Function}
type GetStaticPathsItem = {params:Record<string,number|string|undefined>;props?:Record<string,unknown>}
type DeepStringRecord = {[key: string]:string|DeepStringRecord}
type TranslationDirectory = {i18n?:string;pages?: string}
export type Translations = {[group: string]:{[locale: string]: DeepStringRecord}}
export type TranslationFormatters = {[formatterName: string]:(value:unknown,...args:unknown[])=>unknown}
export type TranslationLoadingRules = {groups:string[];routes: string[]}[]
export type SegmentTranslations = {[secondaryLocale: string]:{[segment: string]:string}}
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;}
/** Typed astro-i18n config definition. */
export function defineAstroI18nConfig(config: Partial<AstroI18nConfig>): Partial<AstroI18nConfig>
/** The `astro-i18n` middleware. */
export function useAstroI18n(
config?: Partial<AstroI18nConfig> | string,
formatters?: TranslationFormatters,
): (...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: (
props: GetStaticPathsProps,
) => GetStaticPathsItem[] | Promise<GetStaticPathsItem[]>,
): (props: GetStaticPathsProps & {
astroI18n?: {
locale: string;
};
}) => Promise<GetStaticPathsItem[]>
/**
* @param key The translation key, for example `"my.nested.translation.key"`.
* @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 t<T extends Translation>(
key: T | string & {},
...args: undefined extends TranslationVariables[T]
? [
properties?: keyof TranslationVariables extends T
? Record<string, unknown>
: TranslationVariables[T],
options?: {
route?: Route | string & {}
locale?: Locale | string & {}
fallbackLocale?: Locale | string & {}
}
]
: [
properties: TranslationVariables[T],
options?: {
route?: Route | string & {}
locale?: Locale | string & {}
fallbackLocale?: Locale | string & {}
}
]
): string
/**
* @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 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.
*/
export function l<T extends Route>(
route: T | string & {},
...args: T extends keyof RouteParameters
? undefined extends RouteParameters[T]
? [
parameters?: Record<string, string>,
options?: {
targetLocale?: string,
routeLocale?: string,
showPrimaryLocale?: string,
query?: Record<string, unknown>
}
]
: [
parameters: RouteParameters[T],
options?: {
targetLocale?: string,
routeLocale?: string,
showPrimaryLocale?: string,
query?: Record<string, unknown>
}
]
: [
parameters?: Record<string, string>,
options?: {
targetLocale?: string,
routeLocale?: string,
showPrimaryLocale?: string,
query?: Record<string, unknown>
}
]
): string
class AstroI18n {
/** The detected runtime environment. */
environment: Environment
/** The current page route. */
route: string
/** All page routes. For example: `["/", "/about", "/posts/[slug]"]` */
pages: string[]
/** 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
/** All configured locales. */
locales: Locale[]
/** The default/primary locale. */
primaryLocale: PrimaryLocale
/** Locales other than the default/primary one. */
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. */
isInitialized: boolean
/**
* @param key The translation key, for example `"my.nested.translation.key"`.
* @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.
*/
t<T extends Translation>(
key: T | string & {},
...args: undefined extends TranslationVariables[T]
? [
properties?: keyof TranslationVariables extends T
? Record<string, unknown>
: TranslationVariables[T],
options?: {
route?: Route | string & {}
locale?: Locale | string & {}
fallbackLocale?: Locale | string & {}
}
]
: [
properties: TranslationVariables[T],
options?: {
route?: Route | string & {}
locale?: Locale | string & {}
fallbackLocale?: Locale | string & {}
}
]
): string
/**
* @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 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.
*/
l<T extends Route>(
route: T | string & {},
...args: T extends keyof RouteParameters
? undefined extends RouteParameters[T]
? [
parameters?: Record<string, string>,
options?: {
targetLocale?: string,
routeLocale?: string,
showPrimaryLocale?: string,
query?: Record<string, unknown>
}
]
: [
parameters: RouteParameters[T],
options?: {
targetLocale?: string,
routeLocale?: string,
showPrimaryLocale?: string,
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
type GetStaticPathsProps = { paginate: Function; rss: Function };
type GetStaticPathsItem = {
params: Record<string, number | string | undefined>;
props?: Record<string, unknown>;
};
type DeepStringRecord = { [key: string]: string | DeepStringRecord };
type TranslationDirectory = { i18n?: string; pages?: string };
export type Translations = {
[group: string]: { [locale: string]: DeepStringRecord };
};
export type TranslationFormatters = {
[formatterName: string]: (value: unknown, ...args: unknown[]) => unknown;
};
export type TranslationLoadingRules = {
groups: string[];
routes: string[];
}[];
export type SegmentTranslations = {
[secondaryLocale: string]: { [segment: string]: string };
};
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;
}
/** Typed astro-i18n config definition. */
export function defineAstroI18nConfig(
config: Partial<AstroI18nConfig>
): Partial<AstroI18nConfig>;
/** The `astro-i18n` middleware. */
export function useAstroI18n(
config?: Partial<AstroI18nConfig> | string,
formatters?: TranslationFormatters
): (...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: (
props: GetStaticPathsProps
) => GetStaticPathsItem[] | Promise<GetStaticPathsItem[]>
): (
props: GetStaticPathsProps & {
astroI18n?: {
locale: string;
};
}
) => Promise<GetStaticPathsItem[]>;
/**
* @param key The translation key, for example `"my.nested.translation.key"`.
* @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 t<T extends Translation>(
key: T | (string & {}),
...args: undefined extends TranslationVariables[T]
? [
properties?: keyof TranslationVariables extends T
? Record<string, unknown>
: TranslationVariables[T],
options?: {
route?: Route | (string & {});
locale?: Locale | (string & {});
fallbackLocale?: Locale | (string & {});
},
]
: [
properties: TranslationVariables[T],
options?: {
route?: Route | (string & {});
locale?: Locale | (string & {});
fallbackLocale?: Locale | (string & {});
},
]
): string;
/**
* @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 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.
*/
export function l<T extends Route>(
route: T | (string & {}),
...args: T extends keyof RouteParameters
? undefined extends RouteParameters[T]
? [
parameters?: Record<string, string>,
options?: {
targetLocale?: string;
routeLocale?: string;
showPrimaryLocale?: string;
query?: Record<string, unknown>;
},
]
: [
parameters: RouteParameters[T],
options?: {
targetLocale?: string;
routeLocale?: string;
showPrimaryLocale?: string;
query?: Record<string, unknown>;
},
]
: [
parameters?: Record<string, string>,
options?: {
targetLocale?: string;
routeLocale?: string;
showPrimaryLocale?: string;
query?: Record<string, unknown>;
},
]
): string;
class AstroI18n {
/** The detected runtime environment. */
environment: Environment;
/** The current page route. */
route: string;
/** All page routes. For example: `["/", "/about", "/posts/[slug]"]` */
pages: string[];
/** 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;
/** All configured locales. */
locales: Locale[];
/** The default/primary locale. */
primaryLocale: PrimaryLocale;
/** Locales other than the default/primary one. */
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. */
isInitialized: boolean;
/**
* @param key The translation key, for example `"my.nested.translation.key"`.
* @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.
*/
t<T extends Translation>(
key: T | (string & {}),
...args: undefined extends TranslationVariables[T]
? [
properties?: keyof TranslationVariables extends T
? Record<string, unknown>
: TranslationVariables[T],
options?: {
route?: Route | (string & {});
locale?: Locale | (string & {});
fallbackLocale?: Locale | (string & {});
},
]
: [
properties: TranslationVariables[T],
options?: {
route?: Route | (string & {});
locale?: Locale | (string & {});
fallbackLocale?: Locale | (string & {});
},
]
): string;
/**
* @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 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.
*/
l<T extends Route>(
route: T | (string & {}),
...args: T extends keyof RouteParameters
? undefined extends RouteParameters[T]
? [
parameters?: Record<string, string>,
options?: {
targetLocale?: string;
routeLocale?: string;
showPrimaryLocale?: string;
query?: Record<string, unknown>;
},
]
: [
parameters: RouteParameters[T],
options?: {
targetLocale?: string;
routeLocale?: string;
showPrimaryLocale?: string;
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 ###

View file

@ -1,48 +1,47 @@
{
"ultraviolet": "Ultraviolet",
"ultraviolet": "Ultraviolet",
"pages.home": "Home | Alu",
"pages.games": "Games | Alu",
"pages.settings": "Settings | Alu",
"pages.home": "Home | Alu",
"pages.games": "Games | Alu",
"pages.settings": "Settings | Alu",
"nav.brand": "Alu",
"nav.games": "Games",
"nav.settings": "Settings",
"nav.brand": "Alu",
"nav.games": "Games",
"nav.settings": "Settings",
"menu.welcome": "Welcome to Alu",
"menu.search": "Search...",
"menu.welcome": "Welcome to Alu",
"menu.search": "Search...",
"footer.brand": "Alu",
"footer.madeWithLove": "Made with ❤️ by wearr",
"footer.services": "Services",
"footer.socials": "Socials",
"footer.aluProject": "Alu Project",
"footer.brand": "Alu",
"footer.madeWithLove": "Made with ❤️ by wearr",
"footer.services": "Services",
"footer.socials": "Socials",
"footer.aluProject": "Alu Project",
"games.title": "Games",
"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.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.customization": "Customization",
"settings.customization.theme": "Theme",
"settings.customization.theme.Alu": "Alu",
"settings.customization.theme.Macchiato": "Macchiato",
"settings.customization.theme.Mocha": "Mocha",
"settings.customization.language": "Language",
"settings.customization": "Customization",
"settings.customization.theme": "Theme",
"settings.customization.theme.Alu": "Alu",
"settings.customization.theme.Macchiato": "Macchiato",
"settings.customization.theme.Mocha": "Mocha",
"settings.customization.language": "Language",
"settings.cloaking": "Cloaking",
"settings.cloaking.subtext": "Change how your tab looks...",
"settings.cloaking": "Cloaking",
"settings.cloaking.subtext": "Change how your tab looks...",
"settings.credits": "Credits",
"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": "ウルトラバイオレット",
"pages.home": "ホーム | アルー",
"pages.games": "ゲーム | アルー",
"pages.settings": "設定 | アルー",
"ultraviolet": "ウルトラバイオレット",
"nav.brand": "アルー",
"nav.games": "ゲーム",
"nav.settings": "設定",
"pages.home": "ホーム | アルー",
"pages.games": "ゲーム | アルー",
"pages.settings": "設定 | アルー",
"menu.welcome": "アルーにようこそ",
"menu.search": "検索...",
"nav.brand": "アルー",
"nav.games": "ゲーム",
"nav.settings": "設定",
"footer.brand": "アルー",
"footer.madeWithLove": "wearrによる❤で作られました",
"footer.services": "サービス",
"footer.socials": "ソーシャル",
"footer.aluProject": "アループロジェクト",
"menu.welcome": "アルーにようこそ",
"menu.search": "検索...",
"games.title": "ゲーム",
"footer.brand": "アルー",
"footer.madeWithLove": "wearrによる❤で作られました",
"footer.services": "サービス",
"footer.socials": "ソーシャル",
"footer.aluProject": "アループロジェクト",
"settings.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",
"games.title": "ゲーム",
"settings.customization": "カスタマイズ",
"settings.customization.theme": "テーマ",
"settings.customization.theme.Alu": "アルー",
"settings.customization.theme.Macchiato": "マキアート",
"settings.customization.theme.Mocha": "モカ",
"settings.customization.language": "言語",
"settings.cloaking": "クローキング",
"settings.cloaking.subtext": "タブの外観を変更します...",
"settings.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.credits": "クレジット",
"settings.credits.mochaandmacchiatothemes": "モカとマキアートテーマ",
"settings.credits.japaneseTranslations": "日本語翻訳"
}
"settings.customization": "カスタマイズ",
"settings.customization.theme": "テーマ",
"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 jp from './jp.json';
import en from "./en.json";
import jp from "./jp.json";
export const defaultLang = "en";
export const defaultLang = 'en';
export const ui = {
en,
jp
};
en,
jp,
};

View file

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

View file

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