Module: I18nProofreading
- Defined in:
- lib/i18n_proofreading.rb,
lib/i18n_proofreading/seeds.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/tag_helper.rb,
lib/i18n_proofreading/configuration.rb,
app/models/i18n_proofreading/suggestion.rb,
app/models/i18n_proofreading/application_record.rb,
lib/generators/i18n_proofreading/migration_helpers.rb,
app/controllers/i18n_proofreading/widgets_controller.rb,
app/controllers/i18n_proofreading/dashboard_controller.rb,
app/controllers/i18n_proofreading/application_controller.rb,
app/controllers/i18n_proofreading/submissions_controller.rb,
app/controllers/i18n_proofreading/suggestions_controller.rb,
app/controllers/concerns/i18n_proofreading/request_context.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, RequestContext, Seeds, TagHelper, Widget Classes: ApplicationController, ApplicationRecord, Configuration, DashboardController, Engine, Middleware, SubmissionsController, Suggestion, SuggestionsController, WidgetsController
Constant Summary collapse
- VERSION =
'1.0.1'
Class Method Summary collapse
- .admin?(request) ⇒ Boolean
-
.available?(request) ⇒ Boolean
Is the tool available for this request? True only in an enabled environment and when the host's
enabledpredicate passes. -
.base_controller ⇒ Object
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. - .config ⇒ Object
- .configure {|config| ... } ⇒ Object
Class Method Details
.admin?(request) ⇒ Boolean
43 44 45 |
# File 'lib/i18n_proofreading.rb', line 43 def admin?(request) !!config..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.
28 29 30 |
# File 'lib/i18n_proofreading.rb', line 28 def available?(request) config.environment_enabled? && !!config.enabled.call(request) end |
.base_controller ⇒ Object
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.
The class I18nProofreading::DashboardController inherits from. Resolved on
every call rather than memoized, so a host that reassigns
base_controller_class in a reloadable initializer is not pinned to a stale,
unloaded constant.
39 40 41 |
# File 'lib/i18n_proofreading.rb', line 39 def base_controller config.base_controller_class.to_s.constantize end |
.config ⇒ Object
17 18 19 |
# File 'lib/i18n_proofreading.rb', line 17 def config @config ||= Configuration.new end |
.configure {|config| ... } ⇒ Object
21 22 23 |
# File 'lib/i18n_proofreading.rb', line 21 def configure yield config end |