Skip to content

Conversation

@BenjaminOddou
Copy link

💬 Description

This PR introduces internationalization (i18n) support to the Nuxt Studio editor, allowing the UI to be translated.

It provides a mechanism for users to add their own translations or override the defaults.

💡 Implementation Details

This PR implements a solution by "injecting" the translations at runtime:

  1. Module (src/module/src/module.ts):

    • Gathers all translations using defu to merge defaults (src/app/locales), user-defined locales (app/locales/studio), app.config options and nuxt.config options.
    • Creates a Vite virtual module (virtual:studio-i18n-messages) to provide this merged JSON.
    • Adds a new Nuxt plugin (studio-i18n-plugin.client.mjs).
  2. Nuxt Plugin (studio-i18n-plugin.client.mjs):

    • This plugin can import from virtual:studio-i18n-messages because it runs within the Nuxt project's context.
    • It attaches the resolved messages to window.__NUXT_STUDIO_I18N_MESSAGES__.
  3. Studio App (src/app):

    • src/app/src/i18n.ts is refactored into a factory function (createStudioI18n) that accepts a messages object.
    • src/app/src/main.ts, during configureApp, now reads the messages from window.__NUXT_STUDIO_I18N_MESSAGES__ and passes them to createStudioI18n to dynamically create the i18n instance.

@vercel
Copy link

vercel bot commented Nov 6, 2025

@BenjaminOddou is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Nov 6, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
content-studio Error Error Nov 7, 2025 5:03pm

@BenjaminOddou BenjaminOddou marked this pull request as ready for review November 7, 2025 08:36
@BenjaminOddou
Copy link
Author

in playground/docus/nuxt.config.ts you can add

export default defineNuxtConfig({
  studio: {
    i18n: {
      defaultLocale: 'fr',
    },
  },
})

the result

image

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 7, 2025

npm i https://pkg.pr.new/nuxt-content/studio/nuxt-studio@70

commit: 934771c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant