When adding the default language, let’s say English. By default all urls now have /en slur added to them. I can edit the en.php file to get rid of it:
'url' => '/'
First question, why is the language code added to the url by default? This is normal for secondary languages, but for the default language it doesn’t make sense. It just adds bloat to the url.
To me this makes more sense by default:
The issue I’m running into is the scenario when a user adds a default language but know nothing about code. How can I get rid of the language code added to the url? Again, they remove the existing default language “English” and adds “French” instead. How can I make sure /fr isn’t added to the url?
Also, why can’t you edit the default language code? This would in theory fix the issue.
Remove the language code that is added to the default language by default. example.fr/fr doesn’t make sense.
Depending on your setup, especially when you define non-translatable fields, changing the default language can result in empty data fields. You/the future editors should be aware of this. Also, you cannot change the default language from the Panel in the first place, at least not without first removing the other languages (which will result in data loss, if you have already translated stuff).
As to why the language code is the default setting: I don’t know, you could probably argue that showing the language code makes it clearer for users where they are from the URL. Plus, it was always the variant that was easier to handle in routes in the past (I think that argument doesn’t hold true anymore now).
Since setting the default language is usually a one-time thing, it can easily be done in the language configuration file. I’m not aware of a way to change this behavior, especially not if the languages do not exist yet.
Thanks for your insights!
It all boils down to the language code being added to the default language. Again, example.fr/fr doesn’t make sense to me.
Yes, I understand that. But currently, there is no other way than to set the URL to
/ in the language config. Please feel free to add an idea issue.
I do not know whether it would be appropriate to make this setting in the panel, because a (subsequent) change of this setting would probably have an impact on the routes in the config file (e.g. “/site/config/config.php”). Changes here we always have to do outside of the panel.