hi catarse folks,
wondering if someone on here could help me make sense of how /pt/ or /en/ gets inserted into urls around the application
i don't see this in the routing and while I expect it to be in the controllers, I can't seem to find it
i was looking for something that does a redirect and insert's the user's locale unless an alternative is provided which lead me to this method in the application.rb
# def set_locale
# return redirect_to url_for(locale: I18n.default_locale, only_path: true) unless is_locale_available?
# I18n.locale = params[:locale] || I18n.default_locale
# end
yet i have commented it out and links are still being inserted with locales
this creates problems in the JS app front end which seems brittle when URLs don't present exactly as they are expected to...
if you can help me understand the architecting of this, I would be very grateful
my understanding is that the following flow takes place
a. user signs up and is by default assigned a locale of 'pt'
b. but if the user visits a url w/ 'en' or 'es', the application servers the expected translation
ANOTHER EXAMPLE:
the logout link in the user menu is declared as:
m(`a.alt-link[href='/logout']`,
from the template in the js app at ~/src/c/menu-profile.js
this seems to break the routing in the JS app and the user is looking at a broken page .
i'd like to understand the mechanics of the how these locales are being inserted into the routing
thanks!
mike