Module: ActiveLdap::GetTextFallback

Defined in:
lib/active_ldap/get_text_fallback.rb

Class Method Summary collapse

Class Method Details

.bindtextdomain(domain_name, *args) ⇒ Object



10
11
# File 'lib/active_ldap/get_text_fallback.rb', line 10

def bindtextdomain(domain_name, *args)
end

.gettext(msg_id) ⇒ Object Also known as: _



13
14
15
# File 'lib/active_ldap/get_text_fallback.rb', line 13

def gettext(msg_id)
  msg_id
end

.included(base) ⇒ Object



4
5
6
# File 'lib/active_ldap/get_text_fallback.rb', line 4

def included(base)
  base.extend(self)
end

.N_(msg_id) ⇒ Object



30
31
32
# File 'lib/active_ldap/get_text_fallback.rb', line 30

def N_(msg_id)
  msg_id
end

.ngettext(arg1, arg2, arg3 = nil) ⇒ Object Also known as: n_



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/active_ldap/get_text_fallback.rb', line 17

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

.Nn_(msg_id, msg_id_plural) ⇒ Object



34
35
36
# File 'lib/active_ldap/get_text_fallback.rb', line 34

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

.sgettext(msg_id, div = '|') ⇒ Object Also known as: s_



38
39
40
41
42
43
44
45
# File 'lib/active_ldap/get_text_fallback.rb', line 38

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