diff --git a/src/core/blitzkrieg/jsxToSvg/index.ts b/src/core/blitzkrieg/jsxToSvg/index.ts index 791bcd719..66f0b5b07 100644 --- a/src/core/blitzkrieg/jsxToSvg/index.ts +++ b/src/core/blitzkrieg/jsxToSvg/index.ts @@ -1,19 +1,13 @@ import { readFileSync } from 'fs'; import satori from 'satori'; +import robotoBlack from './Roboto-Black.ttf'; +import robotoBold from './Roboto-Bold.ttf'; +import roboto from './Roboto.ttf'; const fonts = [ - { - file: require('./Roboto.ttf') as string, - weight: 400 as const, - }, - { - file: require('./Roboto-Bold.ttf') as string, - weight: 700 as const, - }, - { - file: require('./Roboto-Black.ttf') as string, - weight: 900 as const, - }, + { file: roboto, weight: 400 as const }, + { file: robotoBold, weight: 700 as const }, + { file: robotoBlack, weight: 900 as const }, ]; export default async function jsxToSvg(jsx: JSX.Element) { diff --git a/src/core/localization/strings/constants.ts b/src/core/localization/strings/constants.ts index d3e372cf3..333ea32a2 100644 --- a/src/core/localization/strings/constants.ts +++ b/src/core/localization/strings/constants.ts @@ -1,3 +1,3 @@ import { Locale } from 'discord.js'; -export const SUPPORTED_LOCALES: Locale[] = [Locale.EnglishUS, Locale.SpanishES]; +export const SUPPORTED_LOCALES: Locale[] = [Locale.SpanishES]; diff --git a/src/core/localization/strings/index.ts b/src/core/localization/strings/index.ts index 249994594..fa6057bc6 100644 --- a/src/core/localization/strings/index.ts +++ b/src/core/localization/strings/index.ts @@ -1,4 +1,5 @@ import { Locale } from 'discord.js'; +import enUS from '../../../lang/en-US.json'; import { SUPPORTED_LOCALES } from './constants'; export type TranslationFragmentTree = { @@ -10,11 +11,13 @@ export type TranslationFragment = string | TranslationFragmentTree; export const translations = SUPPORTED_LOCALES.map((locale) => ({ locale, - translations: require(`../../lang/${locale}.json`), + translations: require(`../../../lang/${locale}.json`), })).reduce( (table, { locale, translations }) => ({ ...table, [locale]: translations, }), - {}, -) as Record; + { + [Locale.EnglishUS]: enUS, + }, +) as Partial>; diff --git a/src/core/localization/translator.ts b/src/core/localization/translator.ts index 891cc6c38..a4f8c4265 100644 --- a/src/core/localization/translator.ts +++ b/src/core/localization/translator.ts @@ -3,10 +3,11 @@ import { translations } from './strings'; import { SUPPORTED_LOCALES } from './strings/constants'; export function translator(localeRaw: Locale) { - const locale = SUPPORTED_LOCALES.includes(localeRaw) - ? localeRaw - : Locale.EnglishUS; - const strings = translations[locale]; + const locale = + localeRaw !== Locale.EnglishUS && SUPPORTED_LOCALES.includes(localeRaw) + ? localeRaw + : Locale.EnglishUS; + const strings = translations[locale]!; function translate(path: string, literals?: string[]): string { const pathArray = path.split('.');