Giter VIP home page Giter VIP logo

Comments (11)

meeroslav avatar meeroslav commented on July 19, 2024 1

It's a sensible request generally.
However, if you have only one locale, why use localize-router in the first place?

from localize-router.

meeroslav avatar meeroslav commented on July 19, 2024 1

@thebarada Just checked the code quickly... There is a possibility to enable this functionality if only single locale is provided in the config.
However, you have to understand that at the moment this has low priority and would require some additional changes which are planned only for the future version (spoiler: fully configurable localize-router).

from localize-router.

antonbarada avatar antonbarada commented on July 19, 2024

in my case, user can set up one or more langs in your profile
so, it is locales is dynamic

from localize-router.

Chuvisco88 avatar Chuvisco88 commented on July 19, 2024

Well you still need to support n languages in this case, which means there should be multiple routes to the same page based on the language, right? :)
So even if your user has only set 1 locale, you support more than 1 locale so you need to prefix it nonetheless

from localize-router.

antonbarada avatar antonbarada commented on July 19, 2024

but if user set up only one language, I think it will be more correctly if url will still without lang prefix :)

from localize-router.

Chuvisco88 avatar Chuvisco88 commented on July 19, 2024

Okay, let's see it from the point of a route.
Let's say you have for example /en/my-profile. In english it will stay the same, for german it would be /de/mein-profil and in french it would be /fr/mon-profil.
It does not matter if your user has only set French for example, as the other possibilities still can be used by other users.

Or could you give an example?

EDIT: Well it would be possible for you to omit the language itself if you define the routes manually.

{ path: 'my-profile', component: ProfileComponent },
{ path: 'mein-profil', component: ProfileComponent },
{ path: 'mon-profil', component: ProfileComponent },

In this case you wouldn't need localize-router and would set the language probably based on the route or the browser or some other detection mechanism.

from localize-router.

antonbarada avatar antonbarada commented on July 19, 2024

Said user, I did not mean person that use application
I've mean user who set up you own application (like CMS)

from localize-router.

meeroslav avatar meeroslav commented on July 19, 2024

Well, I can say that such functionality would most likely never be implemented because there are multiple unclear (and potentially breaking) scenarios:

  • if user goes to www.yoursite.com/person which language should the application be rendered in if this word exists in both German and English language?
  • in order for application to apply translation and localization it has to load the correct translation file. If you provide only text e.g. mon-profil, we need to load all the languages to distinguish which one of them has this text (and then manually run route checking to see if it's even possible route) and then translate all the routes. All this while application is waiting in bootstrap loop. I can't even try to explain how (almost) impossible this is. Of course this only works in case scenario one does not happen
  • no link sharing would be possible, unless two users share the same language
  • etc.

Just from the top of my head, I'd say that's quite a lot of good reasons to justify "annoyance" of language prefix.

from localize-router.

Chuvisco88 avatar Chuvisco88 commented on July 19, 2024

Beside of that, if you as the user (setting up the application) decide to have just one language, why using localize-router? You decide the spectrum of languages so you should decide as well if the module is needed.

from localize-router.

antonbarada avatar antonbarada commented on July 19, 2024

@Chuvisco88 so, you suggest check number of languages before bootstrapping of application?

from localize-router.

antonbarada avatar antonbarada commented on July 19, 2024

@meeroslav ok, I've see you
if you'll include this functionality to future version - it will be great)
will waiting for update)

from localize-router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.