Sha256: 7c0ac088646cad6db2c6160987d3366b86ae19dc5a6b9207e68bcac27fd7d628

Contents?: true

Size: 929 Bytes

Versions: 1

Compression:

Stored size: 929 Bytes

Contents

module ActiveLdap
  module GetTextFallback
    class << self
      def included(base)
        base.extend(self)
      end
    end

    module_function
    def bindtextdomain(domain_name, *args)
    end

    def gettext(msg_id)
      msg_id
    end

    def ngettext(arg1, arg2, arg3=nil)
      if arg1.kind_of?(Array)
        msg_id = arg1[0]
        msg_id_plural = arg1[1]
        n = arg2
      else
        msg_id = arg1
        msg_id_plural = arg2
        n = arg3
      end
      n == 1 ? msg_id : msg_id_plural
    end

    def N_(msg_id)
      msg_id
    end

    def Nn_(msg_id, msg_id_plural)
      [msg_id, msg_id_plural]
    end

    def sgettext(msg_id, div='|')
      index = msg.rindex(div)
      if index
        msg[(index + 1)..-1]
      else
        msg
      end
    end

    alias_method(:_, :gettext)
    alias_method(:n_, :ngettext)
    alias_method(:s_, :sgettext)
  end

  GetText = GetTextFallback
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-activeldap-0.8.3.1 lib/active_ldap/get_text_fallback.rb