Class: Granite::Translations

Inherits:
Object
  • Object
show all
Defined in:
lib/granite/translations.rb

Class Method Summary collapse

Class Method Details

.combine_paths(paths1, paths2) ⇒ Object



4
5
6
7
8
# File 'lib/granite/translations.rb', line 4

def combine_paths(paths1, paths2)
  paths1.flat_map do |path1|
    paths2.map { |path2| [*path1, *path2].join('.') }
  end
end

.scope_translation_args(scopes, key, **options) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/granite/translations.rb', line 10

def scope_translation_args(scopes, key, *, **options)
  lookups = expand_relative_key(scopes, key) + Array(options[:default])

  key = lookups.shift
  options[:default] = lookups

  [key, options]
end