mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-27 04:29:50 +01:00
feat: simplified imports
This commit is contained in:
1 parent
9592c0b55f
commit
791a09daae
4 files changed
+18
-20
No files matched your search
@@ -1,19 +1,13 @@
|
|||||||
import { readFileSync } from 'fs';
|
import { readFileSync } from 'fs';
|
||||||
import satori from 'satori';
|
import satori from 'satori';
|
||||||
|
import robotoBlack from './Roboto-Black.ttf';
|
||||||
|
import robotoBold from './Roboto-Bold.ttf';
|
||||||
|
import roboto from './Roboto.ttf';
|
||||||
|
|
||||||
const fonts = [
|
const fonts = [
|
||||||
{
|
{ file: roboto, weight: 400 as const },
|
||||||
file: require('./Roboto.ttf') as string,
|
{ file: robotoBold, weight: 700 as const },
|
||||||
weight: 400 as const,
|
{ file: robotoBlack, weight: 900 as const },
|
||||||
},
|
|
||||||
{
|
|
||||||
file: require('./Roboto-Bold.ttf') as string,
|
|
||||||
weight: 700 as const,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
file: require('./Roboto-Black.ttf') as string,
|
|
||||||
weight: 900 as const,
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export default async function jsxToSvg(jsx: JSX.Element) {
|
export default async function jsxToSvg(jsx: JSX.Element) {
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
import { Locale } from 'discord.js';
|
import { Locale } from 'discord.js';
|
||||||
|
|
||||||
export const SUPPORTED_LOCALES: Locale[] = [Locale.EnglishUS, Locale.SpanishES];
|
export const SUPPORTED_LOCALES: Locale[] = [Locale.SpanishES];
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Locale } from 'discord.js';
|
import { Locale } from 'discord.js';
|
||||||
|
import enUS from '../../../lang/en-US.json';
|
||||||
import { SUPPORTED_LOCALES } from './constants';
|
import { SUPPORTED_LOCALES } from './constants';
|
||||||
|
|
||||||
export type TranslationFragmentTree = {
|
export type TranslationFragmentTree = {
|
||||||
@@ -10,11 +11,13 @@ export type TranslationFragment = string | TranslationFragmentTree;
|
|||||||
|
|
||||||
export const translations = SUPPORTED_LOCALES.map((locale) => ({
|
export const translations = SUPPORTED_LOCALES.map((locale) => ({
|
||||||
locale,
|
locale,
|
||||||
translations: require(`../../lang/${locale}.json`),
|
translations: require(`../../../lang/${locale}.json`),
|
||||||
})).reduce(
|
})).reduce(
|
||||||
(table, { locale, translations }) => ({
|
(table, { locale, translations }) => ({
|
||||||
...table,
|
...table,
|
||||||
[locale]: translations,
|
[locale]: translations,
|
||||||
}),
|
}),
|
||||||
{},
|
{
|
||||||
) as Record<Locale, TranslationFragment>;
|
[Locale.EnglishUS]: enUS,
|
||||||
|
},
|
||||||
|
) as Partial<Record<Locale, TranslationFragment>>;
|
||||||
@@ -3,10 +3,11 @@ import { translations } from './strings';
|
|||||||
import { SUPPORTED_LOCALES } from './strings/constants';
|
import { SUPPORTED_LOCALES } from './strings/constants';
|
||||||
|
|
||||||
export function translator(localeRaw: Locale) {
|
export function translator(localeRaw: Locale) {
|
||||||
const locale = SUPPORTED_LOCALES.includes(localeRaw)
|
const locale =
|
||||||
? localeRaw
|
localeRaw !== Locale.EnglishUS && SUPPORTED_LOCALES.includes(localeRaw)
|
||||||
: Locale.EnglishUS;
|
? localeRaw
|
||||||
const strings = translations[locale];
|
: Locale.EnglishUS;
|
||||||
|
const strings = translations[locale]!;
|
||||||
|
|
||||||
function translate(path: string, literals?: string[]): string {
|
function translate(path: string, literals?: string[]): string {
|
||||||
const pathArray = path.split('.');
|
const pathArray = path.split('.');
|
||||||
|
|||||||
Reference in new issue
Block a user