Sha256: 5f86aaa9ee35fd19f506f0d57cb959cad6302db0f167068a3761ea94dc5db98e

Contents?: true

Size: 709 Bytes

Versions: 6

Compression:

Stored size: 709 Bytes

Contents

require_relative "../delegate"

module PhraseApp
  module InContextEditor
    module Delegate
      class FastGettext < Base
        def initialize(method, *args)
          @method = method
          params = params_from_args(args)
          @display_key = params[:msgid]
        end

        private

        def params_from_args(args)
          case @method
          when :_
            {msgid: args.first}
          when :n_
            {msgid: args.first, msgid_plural: args[1], count: args.last}
          when :s_
            {msgid: args.first}
          else
            self.class.log("Unsupported FastGettext method #{@method}")
            {}
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
phraseapp-in-context-editor-ruby-3.2.0 lib/phraseapp-in-context-editor-ruby/delegate/fast_gettext.rb
phraseapp-in-context-editor-ruby-3.1.1 lib/phraseapp-in-context-editor-ruby/delegate/fast_gettext.rb
phraseapp-in-context-editor-ruby-3.1.0 lib/phraseapp-in-context-editor-ruby/delegate/fast_gettext.rb
phraseapp-in-context-editor-ruby-3.0.1 lib/phraseapp-in-context-editor-ruby/delegate/fast_gettext.rb
phraseapp-in-context-editor-ruby-2.1.1 lib/phraseapp-in-context-editor-ruby/delegate/fast_gettext.rb
phraseapp-in-context-editor-ruby-2.0.0 lib/phraseapp-in-context-editor-ruby/delegate/fast_gettext.rb