Installation
Add the gem, create a config file, and point it at your LLM provider.
Add the gem#
In your app's Gemfile.
locallingo is a development-time tool — it never runs in production — so put it in the :development group. It pulls in RubyLLM as its provider client.
group :development do
gem "locallingo"
endThen bundle install.
Generate the binstub#
The gem installs an executable called lingo. Generate a binstub so you can run it via bin/lingo inside your app's bundle:
bundle binstubs locallingoProvider credentials#
locallingo never stores API keys. The simplest setup is an environment variable named for your provider — for example OPENAI_API_KEY for OpenAI or ANTHROPIC_API_KEY for Anthropic.
OPENAI_API_KEY=sk-...If your key lives somewhere other than ENV, configure the gem from Ruby in a .locallingo.rb file at your app root — the CLI loads it on start, no Rails boot required. See Providers & models for the full credential resolution order.
Locallingo.configure do |config|
config.anthropic_api_key = -> { AppConf.anthropic_api_key }
endCreate the config file#
Add a .locallingo.yml at your app root. The smallest useful config names your source and target locales; every other key has a sensible default (see the Configuration reference).
defaults:
source_locale: en
target_locales: [de, sv]
provider: openai
translate:
model: gpt-5-mini
quality:
model: gpt-4o-mini
context: "Acme, a business application"
glossary:
entity: "business/company account holder"That's it — head to the Quick start.