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

Feature Request: i18n prefix_except_default strategy #158

Closed
reslear opened this issue Jan 17, 2024 · 8 comments
Closed

Feature Request: i18n prefix_except_default strategy #158

reslear opened this issue Jan 17, 2024 · 8 comments
Labels
enhancement New feature or request Question More information was requested

Comments

@reslear
Copy link

reslear commented Jan 17, 2024

Implement strategy like prefix_except_default

is default language en for /[locale]/blog/[id]:

expected:

  • /en/blog/123 -> /blog/123
  • /es/blog/123 -> /es/blog/123

also problem with whitespace prefixes (//blog/123):

@boazpoolman boazpoolman added the enhancement New feature or request label Jan 17, 2024
@boazpoolman
Copy link
Member

So, I'm seeing two topics here.

You have an issue with duplicate forward slashes.
Weirdly enough, because there is code in place to remove those, see: https://github.com/boazpoolman/strapi-plugin-sitemap/blob/master/server/services/pattern.js#L140C79-L140C79
If you can write up a new issue about that with proper steps to reproduce I can take a look at that.

For the prefix_except_default feature. You should allready be able to do this, but with a slightly different strategy.
You can create different patterns for different locales.

So the EN pattern would be /blog/[id]
And then you would have another pattern for ES, which would be /[locale]/blog/[id]. Or even /es/blog/[id] should do.

Does that work for you?

@boazpoolman boazpoolman added the Question More information was requested label Jan 18, 2024
@reslear
Copy link
Author

reslear commented Jan 18, 2024

@boazpoolman thx for answering, so...

You have an issue with duplicate forward slashes. Weirdly enough, because there is code in place to remove those, see: https://github.com/boazpoolman/strapi-plugin-sitemap/blob/master/server/services/pattern.js#L140C79-L140C79 If you can write up a new issue about that with proper steps to reproduce I can take a look at that.

Well, it is still to come to this (if the option to make locale empty by default is developed), because by default locale cannot be `` empty. By the way, this is an idea.

So the EN pattern would be /blog/[id] And then you would have another pattern for ES, which would be /[locale]/blog/[id]. Or even /es/blog/[id] should do.

Yes I thought about that, but when ~20 languages is it worth it to manually do it for each one separately? if there was an exception option.

@boazpoolman
Copy link
Member

About the double slashes; I'm still not quite sure how this is happening.
Please create another issue and follow the issue template, providing me with steps to reproduce.

About this issue (#158), in the case of 20 languages you could just make one generic URL pattern, and create a single one for a specific language. That second pattern will then override the generic one.

@reslear
Copy link
Author

reslear commented Jan 18, 2024

No concerns about the double slashes; originally, I anticipated a potential issue down the road, especially if there were plans to develop an empty default language. However, the code already addresses this scenario.

To streamline, might want to contemplate incorporating a boolean setting such as "replace default language with empty value."

@boazpoolman
Copy link
Member

I'll take that in consideration!

@reslear
Copy link
Author

reslear commented Jan 18, 2024

About this issue (#158), in the case of 20 languages you could just make one generic URL pattern, and create a single one for a specific language. That second pattern will then override the generic one.

ok, and I'll try this, as it looks like a potentially working workaround

@reslear
Copy link
Author

reslear commented Jan 27, 2024

Yes you are right this setup is overwritten and works as expected. Thank you

Screenshot 2024-01-27 at 06 39 27

@boazpoolman
Copy link
Member

Great! I'll close this issue then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Question More information was requested
Projects
None yet
Development

No branches or pull requests

2 participants