
Security News
Oxlint Introduces Type-Aware Linting Preview
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Minimalistic toolkit to localize routes in rails.
I did this gem to:
Put this line in your Gemfile:
gem 'localizable_routes'
Then bundle:
$ bundle
In your config/routes.rb use the localized method to decide wich routes will be localized:
localized strategy: :param, locales: %i(es en) do
get 'page' => 'pages#show', as: :param
end
localized strategy: :subdomain, locales: { 'es' => :es, 'www' => :en } do
get 'page' => 'pages#show', as: :subdomain
end
localized strategy: :domain, locales: { 'domain.es' => :es, 'domain.com' => :en } do
get 'page' => 'pages#show', as: :domain
end
Put your localizations inside the routes key in your locales yamls:
es:
routes:
page: "pagina"
NOTE: There is no need to put the full path, just localize each part individually.
Url helpers will continue working the same:
param_path
# => /en/pagina if I18n.locale is :es
subdomain_url
# => http://es.domain.com/pagina if current subdomain is es
domain_url
# => http://domain.es/pagina if current domain is domain.es
And you can change the locale by passing the corresponding parameter:
param_path locale: :en
# => /en/page
subdomain_url sudomain: 'es'
# => http://es.domain.com/pagina
domain_url domain: 'domain.com'
# => http://domain.com/page
Any issue, pull request, comment of any kind is more than welcome!
I will mainly ensure compatibility to Rails, AWS, PostgreSQL, Redis, Elasticsearch and FreeBSD.
This gem is maintained and funded by museways.
It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
FAQs
Unknown package
We found that localizable_routes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.