Giter VIP home page Giter VIP logo

Comments (9)

gi-lunaweb avatar gi-lunaweb commented on August 11, 2024

Hi,

route_translator translates routes inside a localized call for each available locales, as declared in I18n configuration with I18n.available_locales.

If translations for a path part are not available in a locale, the exact result of the routes translation process depends on the way you handle missing translations in your app (fallback to another locale, fallback to humanized key name or exception).

from route_translator.

enriclluelles avatar enriclluelles commented on August 11, 2024

Basically, you have [:es, :en, :de] as the result of your I18n.available locales call. If that's not ideal for you, maybe we could add an option for whiltelisted_locales or something like that. It seems reasonable. If you want to contribute that change, please go ahead.

What do you think @gi-lunaweb?

from route_translator.

mattherick avatar mattherick commented on August 11, 2024

What happens if I just edit this in the application.rb - for example to:

I18n.available_locales = [:de]

Shouldnยดt that do the trick already?

from route_translator.

enriclluelles avatar enriclluelles commented on August 11, 2024

yeah, it should, but what I meant is that maybe you want to use some locales for the routes and have some others for the content translations we would need a special option.

If you don't wan that, just setting the availabe_locales should work fine.

from route_translator.

mattherick avatar mattherick commented on August 11, 2024

Ah okay I understand. In my current project I only use one locale for the routes and the content.

But in general your idea is good. I will think about a possible pull request.

from route_translator.

gi-lunaweb avatar gi-lunaweb commented on August 11, 2024

@enriclluelles

The default behavior in Rails is to enable fallbacks for translations in production environment. If you don't want to provides full translations for all your views and routes in a specific locale, you can just set up correct fallback to a default one.
I don't think we need any additional option for that in route_translator.

from route_translator.

enriclluelles avatar enriclluelles commented on August 11, 2024

@gi-lunaweb that's right but even if it fallbacks, the translated route is still generated and maybe the user doesn't want that. But anyway, it looks like @mattherick doesn't need that so let's not clutter the app until we feel it's needed

from route_translator.

mattherick avatar mattherick commented on August 11, 2024

๐Ÿ‘ thanks guys for your help!

from route_translator.

gi-lunaweb avatar gi-lunaweb commented on August 11, 2024

@enriclluelles : This has a great potential to becomes a real code nightmare for us and/or an incomprehensible mess for gem users if we one day need to implement it ๐Ÿ˜ƒ

from route_translator.

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.