Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow configuration from app.config.ts and extending (@nuxt/schema).AppConfig #1985

Open
Tracked by #3002
kazupon opened this issue Apr 12, 2023 · 5 comments · May be fixed by #2287
Open
Tracked by #3002

allow configuration from app.config.ts and extending (@nuxt/schema).AppConfig #1985

kazupon opened this issue Apr 12, 2023 · 5 comments · May be fixed by #2287
Labels
good first issue more discussions 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing PR Welcome v9

Comments

@kazupon
Copy link
Collaborator

kazupon commented Apr 12, 2023

          Minor future task: allow configuration from `app.config.ts` and extending `(@nuxt/schema).AppConfig`

Originally posted by @ineshbose in #1973 (comment)

@kazupon kazupon added help wanted good first issue 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing PR Welcome labels Apr 12, 2023
@TitusKirch
Copy link
Contributor

I would try my hand at this

@TitusKirch
Copy link
Contributor

Just to discuss the scope of it:

It is desired, instead of the file i18n.config.ts with the content

export default defineI18nConfig(() => ({
  legacy: false,
  locale: 'en',
  messages: {
    fr: {
      welcome: 'Bienvenue',
      home: 'Accueil',
      profile: 'Profil'
    },
    en: {
      welcome: 'Welcome',
      home: 'Homepage',
      profile: 'Profile'
    }
  }
}))

to be able to use the file app.config.ts with the content

export default defineAppConfig({
  i18n: {
    vueI18n: {
      legacy: false,
      locale: 'en',
      messages: {
        fr: {
          welcome: 'Bienvenue',
          home: 'Accueil',
          profile: 'Profil'
        },
        en: {
          welcome: 'Welcome',
          home: 'Homepage',
          profile: 'Profile'
        }
      }
    }
  }
})

Or have I overlooked something?

@ineshbose
Copy link
Collaborator

That's about right, because app.config.ts is runtime logic (if I'm not wrong).

We can probably flatten i18n.vueI18n to i18n. Somethings to look out for - in cases, where i18n.config.ts is available, either we likely prefer that, or we merge both configs using defu (preferred). If we're able to implement defu with this, we can allow configuration to be highly extensible (more plans on this).

@TitusKirch
Copy link
Contributor

@ineshbose thanks for your quick answer!

I could pack i18n.vueI18n directly into i18n, I just wanted to get some input on this first (especially with regard to other things that might be planned in the future). Exactly, I have already used defu in the first version, as this is also my preferred implementation.

Copy link
Collaborator Author

kazupon commented Aug 2, 2023

@TitusKirch
Thank you for your contribution!
I recognize about nuxt i18n has issue, as I have heard from others (@kiaking) that it should be flat.

nuxt i18n v8 rc was realsed 2 days ago.
This means that breaking changes to the interface will not occur until v8 official releases.

We should work this issue in nuxt i18n v9.

@kazupon kazupon added the v9 label Aug 2, 2023 — with Volta.net
@kazupon kazupon mentioned this issue Jun 28, 2024
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue more discussions 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing PR Welcome v9
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants