diff --git a/apps/app-frontend/src/components/ui/settings/LanguageSettings.vue b/apps/app-frontend/src/components/ui/settings/LanguageSettings.vue index c458afd80..7f3946a87 100644 --- a/apps/app-frontend/src/components/ui/settings/LanguageSettings.vue +++ b/apps/app-frontend/src/components/ui/settings/LanguageSettings.vue @@ -8,14 +8,14 @@ import { LOCALES, useVIntl, } from '@modrinth/ui' -import { ref, watch } from 'vue' +import { computed, ref, watch } from 'vue' import { get, set } from '@/helpers/settings.ts' import i18n from '@/i18n.config' const { formatMessage } = useVIntl() -const platform = formatMessage(languageSelectorMessages.platformApp) +const platform = computed(() => formatMessage(languageSelectorMessages.platformApp)) const settings = ref(await get()) diff --git a/apps/app-frontend/src/i18n.config.ts b/apps/app-frontend/src/i18n.config.ts index 219981313..c45741f99 100644 --- a/apps/app-frontend/src/i18n.config.ts +++ b/apps/app-frontend/src/i18n.config.ts @@ -1,4 +1,5 @@ import { buildLocaleMessages, createMessageCompiler, type CrowdinMessages } from '@modrinth/ui' +import { uiLocaleModulesEager } from '@modrinth/ui/src/locales.eager.ts' import { createI18n } from 'vue-i18n' const localeModules = import.meta.glob<{ default: CrowdinMessages }>('./locales/*/index.json', { @@ -12,7 +13,7 @@ const i18n = createI18n({ messageCompiler: createMessageCompiler(), missingWarn: false, fallbackWarn: false, - messages: buildLocaleMessages(localeModules), + messages: buildLocaleMessages(localeModules, uiLocaleModulesEager), }) export default i18n diff --git a/packages/assets/generated-icons.ts b/packages/assets/generated-icons.ts index 8c77ae736..ea1d254f2 100644 --- a/packages/assets/generated-icons.ts +++ b/packages/assets/generated-icons.ts @@ -3,8 +3,6 @@ import type { FunctionalComponent, SVGAttributes } from 'vue' -export type IconComponent = FunctionalComponent - import _AffiliateIcon from './icons/affiliate.svg?component' import _AlignLeftIcon from './icons/align-left.svg?component' import _ArchiveIcon from './icons/archive.svg?component' @@ -380,6 +378,8 @@ import _XCircleIcon from './icons/x-circle.svg?component' import _ZoomInIcon from './icons/zoom-in.svg?component' import _ZoomOutIcon from './icons/zoom-out.svg?component' +export type IconComponent = FunctionalComponent + export const AffiliateIcon = _AffiliateIcon export const AlignLeftIcon = _AlignLeftIcon export const ArchiveIcon = _ArchiveIcon diff --git a/packages/moderation/src/data/nags/core.ts b/packages/moderation/src/data/nags/core.ts index 23ea9f7af..a2af5fb9f 100644 --- a/packages/moderation/src/data/nags/core.ts +++ b/packages/moderation/src/data/nags/core.ts @@ -148,7 +148,7 @@ export const coreNags: Nag[] = [ }), status: 'suggestion', shouldShow: (context: NagContext) => { - if (!!context.projectV3?.minecraft_server) return false + if (context.projectV3?.minecraft_server) return false const featuredGalleryImage = context.project.gallery?.find((img) => img.featured) return context.project?.gallery?.length === 0 || !featuredGalleryImage }, diff --git a/packages/moderation/src/data/nags/server-projects.ts b/packages/moderation/src/data/nags/server-projects.ts index eef72a822..177ef69bf 100644 --- a/packages/moderation/src/data/nags/server-projects.ts +++ b/packages/moderation/src/data/nags/server-projects.ts @@ -1,4 +1,5 @@ import { defineMessage } from '@modrinth/ui' + import type { Nag, NagContext } from '../../types/nags' export const serverProjectsNags: Nag[] = [ diff --git a/packages/moderation/src/data/stages/links.ts b/packages/moderation/src/data/stages/links.ts index bc3b49761..bbed9b57b 100644 --- a/packages/moderation/src/data/stages/links.ts +++ b/packages/moderation/src/data/stages/links.ts @@ -21,7 +21,7 @@ const links: Stage = { ), text: async (project, projectV3) => { let text - if (!!projectV3?.minecraft_server) + if (projectV3?.minecraft_server) text = (await import('../messages/checklist-text/links/server.md?raw')).default else text = (await import('../messages/checklist-text/links/base.md?raw')).default diff --git a/packages/ui/src/composables/i18n.ts b/packages/ui/src/composables/i18n.ts index 4c2da9ff6..11dfef7b5 100644 --- a/packages/ui/src/composables/i18n.ts +++ b/packages/ui/src/composables/i18n.ts @@ -94,17 +94,20 @@ const LOCALE_CODES = new Set(LOCALES.map((l) => l.code)) * Usage: buildLocaleMessages(import.meta.glob('./locales/* /index.json', { eager: true })) */ export function buildLocaleMessages( - modules: Record, + ...allModules: Record[] ): Record> { const messages: Record> = {} - for (const [path, module] of Object.entries(modules)) { - // Extract locale code from path like './locales/en-US/index.json' or './src/locales/en-US/index.json' - const match = path.match(/\/([^/]+)\/index\.json$/) - if (match) { - const locale = match[1] - // Only include locales that are in our LOCALES list - if (LOCALE_CODES.has(locale)) { - messages[locale] = transformCrowdinMessages(module.default) + for (const modules of allModules) { + for (const [path, module] of Object.entries(modules)) { + // Extract locale code from path like './locales/en-US/index.json' or './src/locales/en-US/index.json' + const match = path.match(/\/([^/]+)\/index\.json$/) + if (match) { + const locale = match[1] + // Only include locales that are in our LOCALES list + if (LOCALE_CODES.has(locale)) { + const mergedMessages = messages[locale] ?? {} + messages[locale] = Object.assign(mergedMessages, transformCrowdinMessages(module.default)) + } } } } diff --git a/packages/ui/src/locales.eager.ts b/packages/ui/src/locales.eager.ts new file mode 100644 index 000000000..035d25e14 --- /dev/null +++ b/packages/ui/src/locales.eager.ts @@ -0,0 +1,6 @@ +import type { CrowdinMessages } from './composables/i18n' + +export const uiLocaleModulesEager = import.meta.glob<{ default: CrowdinMessages }>( + './locales/*/index.json', + { eager: true }, +)