mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 16:46:12 +08:00
13 lines
270 B
Ruby
13 lines
270 B
Ruby
# frozen_string_literal: true
|
|
|
|
class I18nInterpolationKeysFinder
|
|
def self.find(text)
|
|
pattern = Regexp.union([*I18n.config.interpolation_patterns, /\{\{(\w+)\}\}/])
|
|
keys = text.scan(pattern)
|
|
keys.flatten!
|
|
keys.compact!
|
|
keys.uniq!
|
|
keys
|
|
end
|
|
end
|