def export!
      puts "Exporting translations:\n"
      if config[:split]
        translations.keys.each do |locale|
          if translations[:en].nil?
            puts 'Missing english translation'
            exit
          end
          puts "\nLocale: #{locale}"
          fallback_english_hash = flat_hash(translations[:en])
          translations_hash = flat_hash(translations[locale])
          if locale != :en
            translations_hash.each do |key, value|
              english_fallback = fallback_english_hash[key]
              if value == nil || value == ""
                puts "  #{key} missing!"
                puts "     taking english default: '#{english_fallback}'"
                translations_hash[key] = english_fallback
              end
            end
          end
          save(translations_hash, File.join(export_dir, "translations_#{locale}.js"))
        end
      else
        save(flat_hash(translations), File.join(export_dir, 'translations.js'))
      end
    end
def export!
      puts "Exporting translations:\n"
      if config[:split]
        translations.keys.each do |locale|
          if translations[:en].nil?
            puts 'Missing english translation'
            exit
          end
          puts "\nLocale: 
          fallback_english_hash = flat_hash(translations[:en])
          translations_hash = flat_hash(translations[locale])
          if locale != :en
            translations_hash.each do |key, value|
              english_fallback = fallback_english_hash[key]
              if value == nil || value == ""
                puts "  
                puts "     taking english default: '
                translations_hash[key] = english_fallback
              end
            end
          end
          save(translations_hash, File.join(export_dir, "translations_
        end
      else
        save(flat_hash(translations), File.join(export_dir, 'translations.js'))
      end
    end
def export! puts "Exporting translations:\n" if config [ :split ] translations . keys . each do | locale | if translations [ :en ] . nil? puts 'Missing english translation' exit end puts "\nLocale: #{locale}" fallback_english_hash = flat_hash ( translations [ :en ] ) translations_hash = flat_hash ( translations [ locale ] ) if locale != :en translations_hash . each do | key , value | english_fallback = fallback_english_hash [ key ] if value == nil || value == "" puts "  #{key} missing!" puts "     taking english default: '#{english_fallback}'" translations_hash [ key ] = english_fallback end end end save ( translations_hash , File . join ( export_dir , "translations_#{locale}.js" ) ) end else save ( flat_hash ( translations ) , File . join ( export_dir , 'translations.js' ) ) end end
Export translations to JavaScript, considering settings
 from configuration file
Export translations to JavaScript considering settings from configuration file