Skip to content

docs: show how to configure each of the six providers - #18

Merged
Halvanhelv merged 1 commit into
mainfrom
docs/provider-examples
Sep 9, 2026
Merged

docs: show how to configure each of the six providers#18
Halvanhelv merged 1 commit into
mainfrom
docs/provider-examples

Conversation

@Halvanhelv

Copy link
Copy Markdown
Owner

The provider table already listed each provider's options and limits. What it did not have was a working configuration to copy.

Adds one runnable snippet per provider, plus the two things a reader is most likely to get wrong because they break the pattern the others set:

  • LibreTranslate requires libretranslate_api_base and does not require a key — the reverse of every other provider — and can be run locally, so the docker run line is there too.
  • Amazon is signed rather than keyed, and this library does not implement the AWS credential chain: AWS_ACCESS_KEY_ID and friends are not read, credentials are passed explicitly.

Also shows using two providers side by side through TranslationDiff.context and the per-call provider: override, and says plainly that both share one cache keyed per provider, so switching never serves one service's translations for another.

Verification

Every option name in the new snippets is checked against TranslationDiff::Configuration.options, and the snippets that need no network were executed rather than read:

все опции из примеров существуют
null: "Hello there. Second sentence."
context: "Hi."
per-call provider: "Hi."

Suite unchanged and green (398 runs), RuboCop clean. Documentation only — no code touched.

Also: the Ruby 3.4 floor is now stated in Installation, where it is read before bundler refuses the gem rather than after; and the CHANGELOG gained a line naming all five providers this release adds, instead of describing Google in detail and leaving the rest to the diff.

The provider table said which options each one takes; it did not say what
a working configuration looks like. Somebody adopting Azure had to infer
a snippet from a table row, and the two providers that break the usual
pattern -- LibreTranslate, whose base URL is required and whose key is
not, and Amazon, which is signed rather than keyed and reads no AWS
environment variables -- were exactly the ones a reader was most likely
to get wrong.

Every snippet was run: the option names are checked against
`Configuration.options`, and the ones needing no network were executed
rather than eyeballed.

Also records the Ruby 3.4 floor in Installation, where someone looks
before adding the gem rather than after bundler refuses it, and gives the
CHANGELOG a line naming the five providers this release adds. The
existing entry described the Google provider in detail and left the other
four to be discovered in the diff.
@Halvanhelv
Halvanhelv merged commit b4baceb into main Sep 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant