Replies: 1 comment 2 replies
-
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm re-implementing rubygems.org authentication using Rodauth for my own interest. This app has a language switcher which is a link to the current page with the locale added as a query parameter. Another option for localizing routes is using locale prefixes, as I showed in an example for rodauth-i18n.
I would like to find an easy way to implement such a language switcher, ideally something that would work for both localization strategies. This is easy to do when I know the action I'm generating the URL for:
However, if I want to add this to the layout template, I don't a reliable way to determine what Rodauth route am I currently on. I was considering matching the current path with
Rodauth::Auth.route_hash
, but that seemed cumbersome and not 100% bullet proof.I was thinking that ideally Rodauth would provide a
#current_path
and/or#current_url
method, that would delegate to the corresponding*_path
or*_url
route helper. Alternatively, maybe Rodauth could set the current action in an instance variable?Beta Was this translation helpful? Give feedback.
All reactions