Method: ExtractI18n.key

Defined in:
lib/extract_i18n.rb

.key(string, length: 25) ⇒ Object



42
43
44
45
46
47
# File 'lib/extract_i18n.rb', line 42

def self.key(string, length: 25)
  string.strip.
    unicode_normalize(:nfkd).gsub(/(\p{Letter})\p{Mark}+/, '\\1').
    gsub(/\W+/, '_').downcase[0..length].
    gsub(/_+$|^_+/, '')
end