Belgelere geç
Ruby

client.languages

Bu ad alanındaki her yöntem: imzası, parametreleri, döndürdüğü değer ve bir örnek.

Yöntemler

Every language a translated send or preview accepts.

languages.list

List every language a message can be sent in

Kapsam yok
İmza
list(api_key: nil) -> Array<Hash>

Returns the whole language table in one response, with no cursor. It sits behind a key like every other endpoint but needs no scope, because it names no data belonging to anybody. The table is around two hundred rows and changes a handful of times a year, so fetch it once and keep it.

The order is meaningful. The languages people are most likely to be emailed in come first, then regional variants, then the rest by region. A picker should render the rows in the order they arrive until somebody types, then search native, label and code together. Show native first, since it is the word someone looking for their own language is scanning for, and never show flag on its own: a flag names a country, not a language.

Any row's code, label or native is accepted by translate.to on emails.send and by emails.translate. The gem also ships the same table as OpenEmail::LANGUAGES with OpenEmail.resolve_language, which is useful before the first request, while this call returns the server's current rows.

Parametreler

api_keyString

Authenticates this call with a different key.

Döndürür

An Array of Hashes, each with code (BCP-47), label (English name), native (endonym), flag and rtl.

Örnek

languages = client.languages.list german = languages.find { |language| language[:code] == "de" } puts german[:native] if germanputs languages.count { |language| language[:rtl] }

Notlar

  • rtl marks right-to-left targets. A translated body for one of them is wrapped in dir="rtl" before it is sent.

  • The bundled OpenEmail::LANGUAGES table can lag the server by however old your installed gem is, so prefer this call when a newly added language matters.

Şurada da var

API
GET /languages
TypeScript
languages.list()
Python
languages.list()
CLI
openemail languages list