lib/i18n_checker/unused/result.rb
# Apply the detected unused translated text to the current translation file.
# Unused text has been deleted from the translation file.
#
# @param target_locale_files [Array<I18nChecker::Locale::File>]
# @return [Array<I18nChecker::Locale::File>]
Apply the detected unused translated text to the current translation file.
Unused text has been deleted from the translation file.
Apply the detected unused translated text to the current translation file . Unused text has been deleted from the translation file .
def apply(target_locale_files)
        locale_files = target_locale_files.
                         group_by(&:file_name).
                         map { |k, v| [k, v.first] }
        cleanup_locale_files = locale_files.map do |file_name, locale_file|
          return locale_file unless @locale_files.key?(file_name)
          unused_texts = @locale_files[file_name]
          locale_file.remove_texts(unused_texts.map(&:text))
        end
        cleanup_locale_files.each(&:save)
      end
def apply ( target_locale_files ) locale_files = target_locale_files . group_by ( & :file_name ) . map { | k , v | [ k , v . first ] } cleanup_locale_files = locale_files . map do | file_name , locale_file | return locale_file unless @locale_files . key? ( file_name ) unused_texts = @locale_files [ file_name ] locale_file . remove_texts ( unused_texts . map ( & :text ) ) end cleanup_locale_files . each ( & :save ) end
Apply the detected unused translated text to the current translation file.
Apply the detected unused translated text to the current translation file .
None
Array<I18nChecker::Locale::File>
target_locale_files
<not_specific>
<not_specific>
None