
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
A multi-language website requires some way to detect a user's locale. Subdomain is one option.
Add the gem to your Gemfile. Set a default subdomain.
# config/application.rb
# I18n library now recommends you to enforce available locales.
config.i18n.enforce_available_locales = true
config.i18n.available_locales = :en, :ru
# See "Configuration" for difference between these:
config.default_locale = :ru
config.i18n.default_locale = :en
Subdomains will now determine the current locale:
Add links to the new subdomains using :locale URL parameter:
<% [:ru, :en].each do |locale| %>
<%= link_to locale, params.merge(locale: locale) %>
<% end %>
You can hook a special subdomain name with a locale:
config.subdomain_locale["us"] = :"en-US" # us.lvh.me
config.subdomain_locale["ca"] = :"en-CA" # ca.lvh.me
config.subdomain_locale["ua"] = :uk # ua.lvh.me
Default locale will link to the default subdomain (main domain by default: lvh.me). If you prefer "www" use this config option:
config.default_subdomain = "www"
English developers prefer to see English in console and other places. This is why we have a separate default locale for the website:
config.default_locale = :ru
config.i18n.default_locale = :en
For example, with this config example.com will be in Russian, while validation errors in console are still in English.
You can also override our controller method to completely ignore subdomain locale. For example, if you want admin panel to always be in English:
class AdminController
# This is alrady an around_filter
def set_locale(&block)
I18n.with_locale(:en, &block)
end
end
This gem is tested against Rails 3.2, 4.0 and 4.1.
gem install isolate
rake test:all
1.2.0
Support Rails 4.2 and I18n 0.7; drop Rails 3.2.
Note: Rails 4.2 is more strict about _path/_url
helpers. Make sure to use _url
helper whenever you specify locale parameter:
root_path(locale: :ru) # bad, will raise deprecation warning
root_url(locale: :ru) # good
1.1.0
1.0.0
0.1.1
0.1.0. Minor internal changes & fixes, documentation.
0.0.1—0.0.3. Initial releases.
FAQs
Unknown package
We found that subdomain_locale 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.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.