Class: InertiaI18n::Parsers::VueParser

Inherits:
BaseParser
  • Object
show all
Includes:
JavascriptParsing
Defined in:
lib/inertia_i18n/parsers/vue_parser.rb

Instance Method Summary collapse

Methods inherited from BaseParser

#extract_keys, #initialize

Constructor Details

This class inherits a constructor from InertiaI18n::Parsers::BaseParser

Instance Method Details

#extract_keys_from_content(content) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/inertia_i18n/parsers/vue_parser.rb', line 10

def extract_keys_from_content(content)
  # Use common JS parsing for everything first

  result = extract_javascript_keys(content)

  # Add Vue-specific v-t directive support

  vt_keys = extract_vt_directive_keys(content)

  {

    static: (result[:static] + vt_keys).uniq,

    dynamic: result[:dynamic]

  }
end