module ExtractI18n

Constants

VERSION

Attributes

html_fields_with_plaintext[RW]
ignore_functions[RW]
ignore_hash_keys[RW]
ignorelist[RW]
strip_path[RW]

Public Class Methods

file_key(path) click to toggle source
# File lib/extract_i18n.rb, line 36
def self.file_key(path)
  path.gsub(strip_path, '').
    gsub(%r{^/|/$}, '').
    gsub(/\.(vue|rb|html\.slim|\.slim)$/, '').
    gsub(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z])/, '\1_\2').
    gsub('/_', '.').
    gsub('/', '.').
    tr("-", "_").downcase
end
key(string, length: 25) click to toggle source
# File lib/extract_i18n.rb, line 29
def self.key(string, length: 25)
  string.strip.
    unicode_normalize(:nfkd).gsub(/(\p{Letter})\p{Mark}+/, '\\1').
    gsub(/\W+/, '_').downcase[0..length].
    gsub(/_+$|^_+/, '')
end