Module: I18nProofreading

Defined in:
lib/i18n_proofreading.rb,
lib/i18n_proofreading/engine.rb,
lib/i18n_proofreading/widget.rb,
lib/i18n_proofreading/marking.rb,
lib/i18n_proofreading/version.rb,
lib/i18n_proofreading/middleware.rb,
lib/i18n_proofreading/configuration.rb,
app/models/i18n_proofreading/suggestion.rb,
app/helpers/i18n_proofreading/tag_helper.rb,
app/models/i18n_proofreading/application_record.rb,
app/controllers/i18n_proofreading/widgets_controller.rb,
app/controllers/i18n_proofreading/application_controller.rb,
app/controllers/i18n_proofreading/suggestions_controller.rb,
lib/generators/i18n_proofreading/install/install_generator.rb

Overview

In-context translation proofreading for Rails. Renders each i18n key alongside its text in the chosen environments, lets a proofreader click any string and suggest a better wording, and stores the suggestions for a developer to apply.

Defined Under Namespace

Modules: Generators, Marking, TagHelper, Widget Classes: ApplicationController, ApplicationRecord, Configuration, Engine, Middleware, Suggestion, SuggestionsController, WidgetsController

Constant Summary collapse

VERSION =
'0.9.6'

Class Method Summary collapse

Class Method Details

.admin?(request) ⇒ Boolean

May this request browse and triage the dashboard? Independent of available? — the dashboard has its own gate so maintainers can review suggestions from production even where the widget itself is off.

Returns:

  • (Boolean)


33
34
35
# File 'lib/i18n_proofreading.rb', line 33

def admin?(request)
  !!config.authorize_admin.call(request)
end

.available?(request) ⇒ Boolean

Is the tool available for this request? True only in an enabled environment and when the host's enabled predicate passes. Checked on the server for every marker, endpoint, and injection, so the client can never turn it on.

Returns:

  • (Boolean)


26
27
28
# File 'lib/i18n_proofreading.rb', line 26

def available?(request)
  config.environment_enabled? && !!config.enabled.call(request)
end

.configObject



15
16
17
# File 'lib/i18n_proofreading.rb', line 15

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



19
20
21
# File 'lib/i18n_proofreading.rb', line 19

def configure
  yield config
end