Module: I18nProofreading::Widget
- Defined in:
- lib/i18n_proofreading/widget.rb
Overview
Serves the self-contained browser widget. The JavaScript is plain ES (no framework, no build step) and styles itself inline, so it drops into any Rails app regardless of its CSS or JS setup. It is served by the engine's own controller (see WidgetsController) rather than through an asset pipeline, to avoid any dependency on the host's asset setup.
Constant Summary collapse
- SOURCE =
Lives under lib/ (not app/assets/), so a host that runs an asset pipeline never ingests it: Rails auto-registers every engine's app/assets/* directory, which would put this file in the host's asset namespace as a bare "widget.js" and into its precompiled output.
File.('widget.js', __dir__)
- RTL_LANGUAGES =
Right-to-left scripts, so the popover renders mirrored for those locales. Matched on the language subtag, so region variants ("ar-EG") count too.
%w[ar arc ckb dv fa ha he ks ku ps sd ug ur yi].freeze
Class Method Summary collapse
-
.fingerprint ⇒ Object
Content fingerprint for the cache-busting script URL: a changed file is a changed URL, so no browser can ever run stale widget code — Safari has been caught ignoring must-revalidate on same-URL scripts.
- .javascript ⇒ Object
-
.snippet(endpoint:, locale:, active:, nonce: nil) ⇒ Object
The two