Sha256: 2a3aeeeecafc69851bad536f34c8300c0529374823a7210a3dd0a03ee313610a
Contents?: true
Size: 1000 Bytes
Versions: 6
Compression:
Stored size: 1000 Bytes
Contents
module I18n::Tasks::UntranslatedKeys # Get all the missing translations as an array of missing keys as hashes with the following options: # :locale # :key # :type — :blank, :missing, or :eq_base # :base_value — translation value in base locale if one is present # @return [Array<Hash{Symbol => String,Symbol,nil}>] def untranslated_keys keys = keys_missing_from_base.map { |key| {locale: base_locale, key: key, type: :none} } + non_base_locales.map { |locale| keys_missing_value(locale).map { |key| {locale: locale, key: key, type: :blank, base_value: t(base_locale, key)}} + keys_where_value_eq_base(locale).map { |key| {locale: locale, key: key, type: :eq_base, base_value: t(base_locale, key)} } }.flatten sort_keys keys end # sort first by locale, then by type # @return Array{Hash} def sort_keys(keys) keys.sort { |a, b| (l = a[:locale] <=> b[:locale]).zero? ? a[:type] <=> b[:type] : l } end end
Version data entries
6 entries across 6 versions & 1 rubygems