Sha256: 8167b044d2701e5926d83456d137ecbe902663e35f7e03607e28a1c820d9c1a8

Contents?: true

Size: 1.29 KB

Versions: 7

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------

require 'missing_translation_detector'

namespace :ffcrm do
  namespace :missing_translations do
    desc 'Detects missing translations for a locale - Takes a locale and compares with "en-US".'
    task :detect, [:locale] => [:environment] do |_t, args|
      base_locale = 'en-US'

      [[base_locale, args[:locale]],
       ["#{base_locale}_fat_free_crm", "#{args[:locale]}_fat_free_crm"],
       ["#{base_locale}_ransack", "#{args[:locale]}_ransack"]].each do |locale_file_names|
        detector = MissingTranslationDetector.new locale_file_names.first,
                                                  locale_file_names.last
        detector.detect

        next unless detector.missing_translations?

        puts
        puts "Detected missing translations within \"config/locales/#{locale_file_names.last}.yml\":"
        puts

        detector.missing_translations.each do |missing|
          puts "#{missing.key_path.join(' => ')}: #{missing.value}"
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fat_free_crm-0.22.1 lib/tasks/ffcrm/missing_translations.rake
fat_free_crm-0.22.0 lib/tasks/ffcrm/missing_translations.rake
fat_free_crm-0.21.0 lib/tasks/ffcrm/missing_translations.rake
fat_free_crm-0.20.1 lib/tasks/ffcrm/missing_translations.rake
fat_free_crm-0.20.0 lib/tasks/ffcrm/missing_translations.rake
fat_free_crm-0.19.2 lib/tasks/ffcrm/missing_translations.rake
fat_free_crm-0.19.0 lib/tasks/ffcrm/missing_translations.rake