Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
i18n-ai is a gem that converts your rails locales into different languages automatically. Uses the en.yml
file as base by default and creates accompanying es.yml
, it.yml
and others depending on your configuration.
Currently uses OpenAI (gpt4o-mini
) to generate the translations but support for other AI models and APIs will be added soon.
Simply add to your gemfile:
gem "i18n-ai"
And do bundle install
.
To use I18nAi, you need to set the appropriate environment variables based on the AI service you wish to use.
If you are using OpenAI, set ENV["OPENAI_ACCESS_TOKEN"]
To configure and enable other locales, create a file config/initializers/i18n_aii.rb
and add the following:
# config/initializers/i18n_ai.rb
I18nAi.configure do |config|
config.ai_settings = {
provider: "openai",
model: "gpt-4o-mini",
access_token: ENV["OPENAI_ACCESS_TOKEN"]
}
config.generate_locales = [:es, :it] # add your other supported locales to this array
end
If you prefer to use Anthropic's Claude, set ENV[ANTHROPIC_API_KEY]
To configure and enable other locales, create a file config/initializers/i18n_ai.rb
and add the following:
I18nAi.configure do |config|
config.ai_settings = {
provider: "anthropic",
model: "claude-3-haiku-20240307",
access_token: ENV["ANTHROPIC_ACCESS_TOKEN"]
}
config.generate_locales = [:es]
end
Every page reload, the gem will check if the en.yml
file changed and if it did, it will automatically generate the configured locale files.
The gem has been setup to generate a es.yml
file by default.
To disable locale generation simply set the generate_locales
to an empty array.
I18nAi.configure do |config|
config.generate_locales = []
end
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the I18n::Ai project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that i18n-ai demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.