From 1e6a7eba2e19bde0bdadad6fab44b096f7f4def0 Mon Sep 17 00:00:00 2001 From: Carter Himmel Date: Tue, 2 Jan 2024 16:23:02 -0700 Subject: [PATCH] fix: i18n magics --- apps/web/astro-i18next.config.mjs | 6 + apps/web/package.json | 1 - .../web/public/locales/en-US/translation.json | 287 ------------------ apps/web/src/components/MainHead.astro | 2 +- 4 files changed, 7 insertions(+), 289 deletions(-) delete mode 100644 apps/web/public/locales/en-US/translation.json diff --git a/apps/web/astro-i18next.config.mjs b/apps/web/astro-i18next.config.mjs index 102064c0..4d968b6a 100644 --- a/apps/web/astro-i18next.config.mjs +++ b/apps/web/astro-i18next.config.mjs @@ -1,7 +1,13 @@ +import { URL, fileURLToPath } from 'node:url'; + +const resourcesBasePath = fileURLToPath(new URL('../../packages/locales', import.meta.url)); + +// eslint-disable-next-line tsdoc/syntax /** @type {import('astro-i18next').AstroI18nextConfig} */ export default { defaultLocale: 'en-US', locales: ['en-US'], + resourcesBasePath: '../../../packages/locales', i18nextServer: { supportedLngs: ['en-US'], // debug: true, diff --git a/apps/web/package.json b/apps/web/package.json index de5be408..9d50e546 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -6,7 +6,6 @@ "dev": "astro dev", "start": "astro dev", "build": "astro check && astro build", - "copy-locales": "cp -r ../../packages/locales ./public && rm ./dist/locales/package.json", "preview": "astro preview", "astro": "astro", "lint": "prettier --check . && eslint src --format=pretty", diff --git a/apps/web/public/locales/en-US/translation.json b/apps/web/public/locales/en-US/translation.json deleted file mode 100644 index 67df5dc9..00000000 --- a/apps/web/public/locales/en-US/translation.json +++ /dev/null @@ -1,287 +0,0 @@ -{ - "common": { - "commands": { - "args": { - "limit": { - "name": "limit", - "description": "The maximum amount of results to return (max: 25, max: 100)." - }, - "hide": { - "name": "hide", - "description": "Whether or not to hide the command response from other users (default: True)." - }, - "starts-with": { - "name": "starts-with", - "description": "Only return words that start with this value (mutually exclusive with ends-with)." - }, - "ends-with": { - "name": "ends-with", - "description": "Only return words that end with this value (mutually exclusive with starts-with)." - } - }, - "starts_with_blurb": " that starts with {{word}}", - "ends_with_blurb": " that ends with {{word}}" - }, - "errors": { - "with_clause_exclusivity": "The `starts-with` and `ends-with` options are mutually exclusive -- you can't use them both at the same time.", - "not_found": "I'm sorry, I couldn't find any results for your query!", - "not_found_w_suggestions": "I'm sorry, I couldn't find any results for your query! Perhaps you meant one of these? You have 15 seconds to choose one.", - "unauthorized": "Unauthorized.", - "no_permissions": "You don't have permission to use this command.", - "banned": "I'm afraid you've been banned from using Thoth.\nReason: {{- reason}}", - "limit_outside_range": "The `limit` argument must be between 1 and 100.", - "definition_suggestion_timed_out": "You took too long to respond with an alternative word. Command cancelled." - }, - "titles": { - "definitions": "Definitions" - } - }, - "commands": { - "adjective": { - "meta": { - "name": "adjective", - "description": "Responds with adjectives that describe your query.", - "args": { - "word": { - "name": "word", - "description": "The noun to search relavent adjectives for (eg: ocean)." - } - } - }, - "success": "I found `{{found_count}}` adjectives to describe `{{word}}`: \n\n{{words}}" - }, - "definition": { - "meta": { - "name": "definition", - "description": "Responds with the definition of your query from Merriam Webster.", - "args": { - "word": { - "name": "word", - "description": "The word to search a definition for (eg: ocean)." - }, - "short": { - "name": "short", - "description": "Only return the first definition (default: false)." - } - } - } - }, - "homophones": { - "meta": { - "name": "homophones", - "description": "Responds with homophones (sound-alike words) for your query.", - "args": { - "word": { - "name": "word", - "description": "The word to search homophones for (eg: their)." - } - } - }, - "success": "I found `{{found_count}}` homophones for `{{word}}`: \n\n{{words}}" - }, - "holonyms": { - "meta": { - "name": "holonyms", - "description": "Responds with holonyms (what comprises) for your query.", - "args": { - "word": { - "name": "word", - "description": "The word to search homophones for (eg: car)." - } - } - }, - "success": "I found `{{found_count}}` holonyms for `{{word}}`: \n\n{{words}}" - }, - "hyponyms": { - "meta": { - "name": "hyponyms", - "description": "Responds with hyponyms (more general) for your query.", - "args": { - "word": { - "name": "word", - "description": "The word to search hyponyms for (eg: car)." - } - } - }, - "success": "I found `{{found_count}}` hyponyms for `{{word}}`: \n\n{{words}}" - }, - "close-rhyme": { - "meta": { - "name": "close-rhyme", - "description": "Responds with words that closely rhyme with your query.", - "args": { - "word": { - "name": "word", - "description": "The word to search close rhymes for (eg: forest)." - } - } - }, - "success": "I found `{{found_count}}` words that closely rhyme with `{{word}}`: \n\n{{words}}" - }, - "triggers": { - "meta": { - "name": "triggers", - "description": "Responds with words that are statistically associated with your query.", - "args": { - "word": { - "name": "word", - "description": "The word to search triggers for (eg: cow)." - } - } - }, - "success": "I found `{{found_count}}` words that closely rhyme with `{{word}}`: \n\n{{words}}" - }, - "invite": { - "meta": { - "name": "invite", - "description": "Returns an invite link to add Thoth to your server." - }, - "success": "Want to add Thoth to your server? [Click here]({{- link}})!" - }, - "match-word": { - "meta": { - "name": "match-word", - "description": "Responds with words that match the word you provide (eg: a??le -> apple, d??? -> date).", - "args": { - "word": { - "name": "word", - "description": "The word to find matches for (example: a??le)." - } - } - }, - "success": "I found `{{found_count}}` words that match `{{word}}`: \n\n{{words}}" - }, - "noun": { - "meta": { - "name": "noun", - "description": "Responds with nouns that are often described by your query.", - "args": { - "word": { - "name": "word", - "description": "The adjective to search relevant nouns for (eg: yellow)." - } - } - }, - "success": "I found `{{found_count}}` nouns for `{{word}}`: \n\n{{words}}" - }, - "ping": { - "meta": { - "name": "ping", - "description": "Ensures the bot is responding to commands." - }, - "pongs": [ - "Uhh, hello?", - "What can I do ya' for?", - "Why are you bothering me?", - "Mhm?", - "Yea?", - "What's with you puny humans and the constant desire to bother me?", - "Out of everyone here, you chose to bother me?", - "So *this* is the meaning of life?", - "Can we just get this over with?? I have stuff to do.", - "That's all?", - "Pong!", - "Do it again. I dare you." - ] - }, - "rhyme": { - "meta": { - "name": "rhyme", - "description": "Responds with words that rhyme with your query.", - "args": { - "word": { - "name": "word", - "description": "The word to search rhymes for (eg: dime)." - } - } - }, - "success": "I found `{{found_count}}` words that rhyme with `{{word}}`: \n\n{{words}}" - }, - "setup": { - "meta": { - "name": "setup", - "description": "An assortment of configuration commands." - }, - "wotd": { - "meta": { - "name": "wotd", - "description": "Configure the Word of the Day channel.", - "args": { - "channel": { - "name": "channel", - "description": "The channel to set as the Word of the Day channel." - } - } - }, - "errors": { - "guild_text_only": "The Word of The Day channel must be a text channel!", - "no_perms": "I don't have permissions to create a webhook in {{- channel}}." - }, - "success": "The Word of The Day will be posted in {{- channel}} every day at (12am GMT-5).", - "no_channel": "You must provide a channel to set as the Word of the Day channel." - } - }, - "similar-meaning": { - "meta": { - "name": "similar-meaning", - "description": "Response with words that have a similar meaning to your query.", - "args": { - "word": { - "name": "word", - "description": "The word to search similar words for (eg: transgressions)." - } - } - }, - "generic_success": "I found `{{found_count}}` words that are similar to `{{word}}`: \n\n{{words}}", - "starts_with_success": "I found `{{found_count}}` words that are similar to `{{word}}` and start with `{{starts_with}}`: \n\n{{words}}", - "ends_with_success": "I found `{{found_count}}` words that are similar to `{{word}}` and end with `{{ends_with}}`: \n\n{{words}}" - }, - "similar-spelling": { - "meta": { - "name": "similar-spelling", - "description": "Responds with words that have a similar spelling to your query.", - "args": { - "word": { - "name": "word", - "description": "The word to search similar words for (eg: agile)." - } - } - }, - "success": "I found `{{found_count}}` words that're similarly spelled to `{{word}}`: \n\n{{words}}" - }, - "sounds-like": { - "meta": { - "name": "sounds-like", - "description": "Responds with words that sound like your query.", - "args": { - "word": { - "name": "word", - "description": "The word to search similarly sounding words for (eg: agile)." - } - } - }, - "success": "I found `{{found_count}}` words that sound like `{{word}}`: \n\n{{words}}" - }, - "that-follow": { - "meta": { - "name": "that-follow", - "description": "Responds with words that could logically follow query.", - "args": { - "word": { - "name": "word", - "description": "The word to search following words for (eg: open)." - } - } - }, - "generic_success": "I found `{{found_count}}` words that logically follow `{{word}}`: \n\n{{words}}", - "starts_with_success": "I found `{{found_count}}` words that logically follow `{{word}}` that start with `{{starts_with}}`: \n\n{{words}}", - "ends_with_success": "I found `{{found_count}}` words that logically follow `{{word}}` that end with `{{ends_with}}`: \n\n{{words}}" - }, - "word-of-the-day": { - "meta": { - "name": "word-of-the-day", - "description": "Responds with the word of the day from Merriam Webster." - } - } - } -} diff --git a/apps/web/src/components/MainHead.astro b/apps/web/src/components/MainHead.astro index 99e97ece..74fcbb3c 100644 --- a/apps/web/src/components/MainHead.astro +++ b/apps/web/src/components/MainHead.astro @@ -34,7 +34,7 @@ const { title = 'Thoth', description = 'The site for the Thoth Discord bot.' } = {title} - +