lib/head_music/instrument.rb in head_music-3.0.1 vs lib/head_music/instrument.rb in head_music-4.0.0
- old
+ new
@@ -48,11 +48,11 @@
end
def translation(locale = :en)
return name unless name_key
- I18n.translate(name_key, scope: [:instruments], locale: locale)
+ I18n.translate(name_key, scope: %i[head_music instruments], locale: locale, default: name)
end
def family
return unless family_key
@@ -102,11 +102,11 @@
end
def key_for_name(name)
INSTRUMENTS.each do |key, _data|
I18n.config.available_locales.each do |locale|
- translation = I18n.t("instruments.#{key}", locale: locale)
+ translation = I18n.t("head_music.instruments.#{key}", locale: locale)
return key if translation.downcase == name.downcase
end
end
nil
end
@@ -137,10 +137,10 @@
@classification_keys = family.classification_keys || []
end
def initialize_names(record)
@name_key = record["name_key"].to_sym
- self.name = I18n.translate(name_key, scope: "instruments", locale: "en", default: inferred_name)
+ self.name = I18n.translate(name_key, scope: "head_music.instruments", locale: "en", default: inferred_name)
@alias_name_keys = record["alias_name_keys"] || []
end
def initialize_attributes(record)
@orchestra_section_key ||= record["orchestra_section_key"]