
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Admin panel to translate Rails apps with I18n::Backend::KeyValue
stores.
Warning : Only PostgreSQL is supported due to HSTORE field type usage to store translations
It works by creating a I18n backend chain and plugging a custom backend before the original YAML backend.
When you translate a key, it is stored in a HSTORE
field, with one database
row per locale. This allows for fast translations fetching on request start.
The translations are then merged with the ones existing in the YAML, and cached for the request duration using the RequestStore gem.
Add to your Gemfile and bundle :
gem 'i18n_admin', github: 'glyph-fr/i18n_admin'
Run the install generator which will mount the engine and create an initializer template to configure the gem, and create necessary migration :
rails generate i18n_admin:install
I18nAdmin gives you an admin panel to translate your static contents. It's accessible at the Engine mount point that you choosed when running the install generator.
The default URL is /i18n-admin
To plug the engine with your authentication system, you can pass a method
name to execute in a before_action
filter in the I18nAdmin controllers.
This can be done in the initializer file generated at
config/initializers/i18n_admin.rb
:
I18nAdmin.config do |config|
config.authentication_method = :authenticate_user!
end
To avoid some keys to be displayed in the translation admin, you can use a Regex in the initializer file. The regex is matched against the whole key path (e.g. "time.formats.short")
I18nAdmin.config do |config|
# Exclude all date and time formats from translations
config.excluded_keys_pattern = /^(date|time)/
end
The locale is defined from the rails' I18n.locale
, which is automatically
added in the <html>
tag lang
attribute.
The JS app then taps into this locale to set its default locale and allow displaying side-by-side the content with the default locale and the current locale's translation for the key
This project rocks and uses MIT-LICENSE.
FAQs
Unknown package
We found that i18n_admin 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
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.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.