nuxt-modules / i18n

I18n module for Nuxt
https://i18n.nuxtjs.org
MIT License
1.74k stars 483 forks source link

Support different domains config at runtime #2602

Open bcadu opened 11 months ago

bcadu commented 11 months ago

Environment

Reproduction

The code https://stackblitz.com/edit/nuxt-starter-lm7gng

And a minimal Apache configuration

<VirtualHost *:443>

    ServerName fr.localhost

    ServerAlias fr.localhost2
    ServerAlias en.localhost
    ServerAlias es.localhost

    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/localhost.crt
    SSLCertificateKeyFile /etc/ssl/certs/localhost.key

    ProxyPass / http://localhost:3000/
    ProxyPassReverse / http://localhost:3000/
</VirtualHost>

Describe the bug

I'm encountering an issue with the Nuxt i18n module where its behavior differs between the development and production environments, specifically after a single build process.

Development Environment:

Production Environment:

I suspect there might be an issue with how the i18n module handles domain values in production, particularly after the initial build. Any insights or suggestions on resolving this discrepancy would be greatly appreciated.

Additional context

No response

Logs

No response

melaniehuet commented 10 months ago

Hi all, Agree with @bcadu, hosting on different domains using process.env variables doesn't work. By adding domains in runtimeConfig, it seems that NuxtLinks are well updated but hosting directly on the runtimeConfig domain does not work. https://github.com/nuxt-modules/i18n/blob/main/specs/different_domains.spec.ts#L121 => Serving on "kr.staging.nuxt-app.localhost" does not work. Thanks :)

existe-deja commented 8 months ago

I coded the fix + tests but I'm unable to push my branch to the repository. @rchl do I need any permissions for this?

bcadu commented 7 months ago

Hi @existe-deja, We're also waiting for a patch for this feature, which we absolutely need. Would it be possible to get yours? Thanks

patrob1 commented 6 months ago

Hi All, Agree with @melaniehuet , I'm also trying to host on different domain for me the env variables are recognized as domain names but I still get language prefixes for all other languages than the default one. I have also tried to use 'no_prefix' strategy but that one is buggy when it is together with differentDomains: true, so it cannot be used. Looking forward for the patch, thank you in advance

nezaBacar commented 5 months ago

Hello, We're also looking forward to this feature working as intended :) We look forward to the patch. Thanks

OlePc commented 4 months ago

Any update on this?

OlePc commented 4 months ago

I coded the fix + tests but I'm unable to push my branch to the repository. @rchl do I need any permissions for this?

You probably need to fork the project, and submit a PR after adding your fix. Can I see your fix anywhere?

Belorusov commented 2 months ago

any update or maybe workaround?

cernymatej commented 2 months ago

none that I'm aware of.. still waiting for these domains issues to be resolved

Belorusov commented 2 months ago

fyi: NUXT_PUBLIC_I18N_BASE_URL not works in runtime too