Module: Multilocale
- Defined in:
- lib/multilocale.rb,
lib/multilocale/cli.rb,
lib/multilocale/sync.rb,
lib/multilocale/client.rb,
lib/multilocale/errors.rb,
lib/multilocale/phrase.rb,
lib/multilocale/phrases.rb,
lib/multilocale/project.rb,
lib/multilocale/version.rb,
lib/multilocale/encoding.rb,
lib/multilocale/projects.rb,
lib/multilocale/dictionary.rb,
lib/multilocale/config_file.rb,
lib/multilocale/locale_file.rb
Overview
Ruby client for the Multilocale translation API (https://www.multilocale.com).
client = Multilocale.client # reads MULTILOCALE_API_KEY
client.dictionary(project: "website", language: "es").to_h
#=> { "cart.title" => "Carrito", … }
The gem talks to the REST API and writes i18n-shaped locale files; the i18n gem renders them. It deliberately does not wrap I18n itself — a translation backend that makes a network call per lookup is how a marketing page ends up depending on someone else's uptime.
Defined Under Namespace
Modules: Encoding Classes: ApiError, AuthenticationError, CLI, Client, ConfigFile, ConfigurationError, ConnectionError, Dictionary, Error, LocaleFile, NotFoundError, PermissionError, Phrase, Phrases, Project, Projects, RateLimitedError, ServerError, Sync
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
-
.client(**options) ⇒ Object
Builds a client from the environment, or from explicit keywords.
-
.dictionary(project:, language:, **options) ⇒ Object
Convenience for the common one-liner: one language of one project.
Class Method Details
.client(**options) ⇒ Object
Builds a client from the environment, or from explicit keywords.
29 30 31 |
# File 'lib/multilocale.rb', line 29 def client(**) Client.new(**) end |
.dictionary(project:, language:, **options) ⇒ Object
Convenience for the common one-liner: one language of one project.
34 35 36 |
# File 'lib/multilocale.rb', line 34 def dictionary(project:, language:, **) client(**).dictionary(project: project, language: language) end |