-
-
Notifications
You must be signed in to change notification settings - Fork 477
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
Different domains with multiple languages each #1161
Comments
I would appreciate that too. |
Hello all, I face the same requirement and attempted to forked this repo and add (in a quick and dirty manner) support for this. See commit visayasolutions@af22fda If you want to try it out
The configuration I use is the following:
Haven't tested it extensively, consider it a proof of concept. I'm open to any feedback, thanks |
Hi @lfglopes |
This is a lot to write when there's a lot of domains (6) and couple of languages (4), in total 24 "locales". |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I face the same requirements. Would be great if the solution provide by @lfglopes could be merged. |
I have the same requirements for a page that has multiple locales on each domain. This seems like a common usecase, so would be great if this can get merged! |
Same here, it'd be great if this gets merged! 🤞 |
Our company has been using a forked version of the plugin for quite some time now due to this issue being staled, it would be cool to have it merged. Is there something I can do to get this moving forward? |
I don't see any PR that could be merged. |
@lfglopes think you can get a PR open with your changes? If not I can raise one, just don't want to take your credits for it 😄 |
@MarcoBomfim thanks for reaching out! I didn't open a PR back then because I assumed the code was not good enough as it is. Which after reading the contributing guidelines and running I can attempt some changes tomorrow and see if it works out. I'd assume one might need to update docs as well? Something else? |
@MarcoBomfim please go ahead and submit a PR :) I haven't used nuxt for a little while and I need more time than I can afford right now to fix the code. |
I don't want to discourage anyone but a certain level of quality is required for a PR to be accepted. The change should have tests, be added to documentation if it's a feature or behavior change, pass the lint checks and in general fit the design of the module. The last one is a bit hard to quantify so it could be discussed before the PR to avoid wasting anyone's time. |
Thanks folks. I'll be working on the PR mentioned above, but it may take some time since I'm slowly getting the hang of how everything works. @rchl should I move any further discussion to the PR instead? |
The high level design of the change could be discussed before PR to avoid wasting time on implementation that would potentially be rejected but it's up to you. |
My initial idea was to create a new strategy, and follow the logic for Assuming the following configuration:
What needs to happen then, is that to build the
As far as I've seen walking around the module this seems to cover enough ground for a multi-lang per domain feature to be implemented. Although I have a couple of questions still:
|
What about my path for fix this problem - https://github.com/golubvladimir/nuxt-i18n-different-domains-and-prefixes , I use https://github.com/nuxt-community/router-module for creating custom Nuxt router. |
Any updates on this? |
This seems to be a common use case, and it would be great if it could be supported. |
It would be great to have this supported 🙏 ! |
We'd need exactly that as well! |
This is exactly what I need. |
Thanks a lot. It helps me! Please, keep alive https://github.com/visayasolutions/i18n-module.git#feature/domains-with-prefix |
@rchl Did you have any input on the solution proposal from @MarcoBomfim ? |
I don't have time to work on new features like that. The bulk of the effort (not from me) goes into the Nuxt 3 version right now. |
I am in a need for similar feature and couldn't find any up-to-date workaround so thought I would have a go for it myself. It should support the various strategies except This feature did break some of the differentDomains tests and I couldn't get my head around the reason for following line in the current code: Line 47 in dd86b7b
For me, it looks like no_prefix is implied when using differentDomains in the current codebase. Setting the no_prefix strategy in those tests did resolve them.
Also posted this in following issue: https://volta.net/nuxt-modules/i18n/issues/2418 |
Any updates on this? |
@DarthGigi This has been implemented in #2705. The release is out since last week. I tried to migrate from our manual solution, and I am still having some use cases which I can't implement with this - so I haven't tested it properly. |
@toooni Thank you for your response, however, it doesn't quite fit our use case. We are looking for something that works as follows: If something like this is our config: export default defineNuxtConfig({
// ...
i18n: {
locales: [
{
code: 'en',
},
{
code: 'nl',
domain: 'mydomain.nl',
domainDefault: true
},
{
code: 'be',
domain: 'mydomain.be',
domainDefault: true
},
{
code: 'de',
domain: 'mydomain.de',
domainDefault: true
},
{
code: 'fr',
domain: 'mydomain.fr',
domainDefault: true
}
],
strategy: 'prefix_except_default',
differentDomains: true
},
// ...
}) We would like to achieve the following result:
Do you have an idea on how we can achieve this behavior? We tried setting an unique code for each domain locale: {
code: 'de-fr',
domain: 'mydomain.de',
domainDefault: false
},
{
code: 'fr-de',
domain: 'mydomain.fr',
domainDefault: false
} But that results in paths like Any help would be appreciated 😊. |
@DarthGigi You are right. And this was exactly what I meant by
I will reopen the issue. I also have use cases where I want to overwrite the prefix inside page components like this:
When we started, I was fairly new to nuxt. I am now pretty content that I might be able to contribute here. But I am not having much time right now. If you want, I could maybe provide you the files plugin we wrote to achieve a working solution without this module in www.weekend4two.ch. It's not very sexy, but it works. |
@toooni Thanks for reopening this issue! The plugin files would be great to have for the time being. Maybe an idea is to make the following config possible: locales : [
{
code : 'nl',
domains : [ 'mydomain.nl', 'mydomain.be', 'mydomain.de', 'mydomain.fr' ],
defaultDomain : 'mydomain.nl'
},
{
code : 'be',
domains : [ 'mydomain.nl', 'mydomain.be', 'mydomain.de', 'mydomain.fr' ],
defaultDomain : 'mydomain.be'
},
{
code : 'en',
domains : [ 'mydomain.nl', 'mydomain.be', 'mydomain.de', 'mydomain.fr' ],
},
] |
I've created a public repo: https://github.com/toooni/nuxt-i18n-poc. It might be easier for you to adapt a similar solution for now and move further if this module is ready for our use cases. If you have question, you can @ me inside the repository, so we do not spam this issue anymore. |
@DarthGigi, I have this config in my implementation, I've made patch for version 8.20 a few weeks ago. Maybe it will help as a starting point: |
@e-kravtsov I've forked the official repo and added the changes found in your commit. If wanted, I could make a pull request for it to be included in the official package. |
I've created a pull request: #2914 |
I think I've added everything to the pull request. The logic, documentation and tests have been added, all tests pass as well. So for those who (really) need it, you can give it a try 😊 |
I am not a 100% sure if this really isn't possible yet, but it seems like it isn't. We have multiple TLD's and one of them (.ch) needs to have two languages which should result in the following domain/path/locale combinations:
de-CH
fr-CH
de-DE
de-AT
fr-FR
(We do not really care since the .fr TLD does only need one language)I've tried a few configs to achieve what I need but had no success. This one was the closest:
The seems to result in a working solution where all the domains/path exist. But when going to
weekend4two.ch/fr
, the locale is set tode-CH
. Whatever I do, it takes the locale of the first entry with the same domain.Describe the solution you'd like
It would be cool if the locales config in
nuxt.config.js
could be extended with aprefix
property like this:Describe alternatives you've considered
I am open to all alternatives. It may be possible that it even is possible in a way I haven't figured out yet. I am new to NUXT.
The text was updated successfully, but these errors were encountered: