Sha256: 771ff4a015ee14c2e1cf13fcb5acbfd21d55e799fe868f8ad3ea896223d4f7fa

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Decidim
  module TermCustomizer
    module Context
      # A context object resolves and stores the translation context for
      # different application contexts. Contexts can be e.g.
      # - Controller context, which is used to display translations in
      #   controller messages and the views.
      # - Job context, which is used to display messages within jobs, mainly
      #   when sending emails.
      #
      # The initialization method gets the data for the context which is used
      # to resolve the translation context objects (organization, participatory
      # space and component). These are then used to load the correct
      # translations for each context based on the translation set constraints.
      class Base
        attr_reader :organization, :space, :component

        def initialize(data)
          @data = data

          # Implement the resolve! method in the sub-classes
          resolve!
        end

        protected

        attr_reader :data
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-term_customizer-0.23.0 lib/decidim/term_customizer/context/base.rb
decidim-term_customizer-0.22.0 lib/decidim/term_customizer/context/base.rb
decidim-term_customizer-0.21.0 lib/decidim/term_customizer/context/base.rb
decidim-term_customizer-0.20.0 lib/decidim/term_customizer/context/base.rb
decidim-term_customizer-0.19.1 lib/decidim/term_customizer/context/base.rb
decidim-term_customizer-0.19.0 lib/decidim/term_customizer/context/base.rb
decidim-term_customizer-0.18.0 lib/decidim/term_customizer/context/base.rb