Git Product home page Git Product logo

Comments (8)

madc avatar madc commented on August 23, 2024

If we think about implementing more URL styles in the future, we could also use one setting to define the URL type, like routing_style: [default/hide_default/domain/...]

from translate.

SahAssar avatar SahAssar commented on August 23, 2024

@madc: My original idea was that the default "automatic" routing would be for users who just wanted to get started without all the configuring, so I made it disableable so that one could do hostname based or other types of routing in the routing.yml file, but if we can implement a routing_style option that works well that'd be great!

The hide_default_slug style is easy to automatically make the actual routing for, but the issue will be to make bolt "get" that the same record should get different link styles based on a parameter bolt basically does not "care about" IIRC.

So, I'm all for this if we can get it to work well :) One thing to take into consideration is that everything we do in many parts basically has to be implemented in both legacy and proper storage since legacy is used on the frontend and proper is used on the backend.

from translate.

madc avatar madc commented on August 23, 2024

I'm totally with you on that. The default configuration should reflect the usual use case and work right out of the box. Thing is, I'll have to take some time soon to implement this and I'm sure, its interesting for other users too.

I'd suggest to implement the routing_style option, even if it just toggles the default language slug for now. Do you agree?

from translate.

SahAssar avatar SahAssar commented on August 23, 2024

Yeah, routing_style gives us the freedom to add different styles in the future, so that sounds good!

If you have any questions/notes/criticism about/of my code please just throw them out there and I'll answer ASAP :)

from translate.

madc avatar madc commented on August 23, 2024

Believe me, I'm not the guy holding back on criticism.. .. as for questions, they will come for sure.
I'll touch this thing the week after next one. Meanwhile, if you have any thought on the topic, just throw them in here..

from translate.

madc avatar madc commented on August 23, 2024

Just a quick heads up: I'm currently working on this feature here: madc/bolt-translate

from translate.

benwallis avatar benwallis commented on August 23, 2024

I think I have this working just by setting my own route. But it's only a very simple single-page site with only one contenttype.

/app/config/routing.yml

# first route
templatebinding:
    path: /{_locale}
    defaults:
        _controller: controller.frontend:template
        template: index
    requirements:
        _locale: '(en|fr|ru)'

# also need the default homepage route
homepage:
    path: / 
    defaults:
        _controller: controller.frontend:homepage

All options in translate.animal.yml are set to false.

from translate.

SahAssar avatar SahAssar commented on August 23, 2024

While this is possible with some routing hacks like @benwallis mentioned, I don't think we can do it on a larger scale as long as we do prefix routing. Basically we can't check for the locale when building the routing, so we can't exclude the locale then (sorta a catch-22 problem) and we can't have optional parameters before required ones so we can't make the locale optional since the rest of the route params need to be required. If we did suffix routing like /page/about-us/en instead we could do it, but that looks really ugly and can be done in ones own routing if one prefers.

Closing for now, if we find a way to do it we can reopen.

from translate.

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.