Module: I18nFeedback::Marking
- Defined in:
- lib/i18n_feedback/marking.rb
Overview
Appends a "⟦namespace.key⟧" marker to each translated string so the widget can map rendered text back to its i18n key. The marker is never shown to the user: the widget strips every token out of the DOM on load and stashes the key on the element. Marking is a per-request, per-thread toggle (see Middleware), so pages stay clean unless a proofreader has switched the tool on.
Defined Under Namespace
Modules: Backend
Constant Summary collapse
- LEFT =
'⟦'- RIGHT =
'⟧'- SKIP =
Skip format/lookup namespaces — marking these would corrupt number, date, and currency formatting and interpolation strings.
/(\A|\.)(number|date|time|datetime|support)(\.|\z)|formats?\z/
Class Method Summary collapse
Class Method Details
.enabled=(value) ⇒ Object
22 23 24 |
# File 'lib/i18n_feedback/marking.rb', line 22 def enabled=(value) Thread.current[:i18n_feedback_marking] = value end |
.enabled? ⇒ Boolean
18 19 20 |
# File 'lib/i18n_feedback/marking.rb', line 18 def enabled? Thread.current[:i18n_feedback_marking] || false end |