Sha256: 99d9c8fa9978e102cc0fd978eb8d31244e21334d8cf54042fb421e7fa2889802

Contents?: true

Size: 647 Bytes

Versions: 2

Compression:

Stored size: 647 Bytes

Contents

#!/usr/bin/ruby

require 'yaml'
require 'test/unit'

class TestTranslate < Test::Unit::TestCase
  def test_00_check_translate
    missing = 0

    Dir.glob('i18n/*.yml').each do |yaml|
      lang      = File.basename(yaml, '.yml')
      translate = YAML.load_file(yaml)

      `grep -r -o "I18n.t('.*)" bin/ lib/ | cut -d"'" -f2`.each_line do |line|
        begin
          t = translate[lang]
          line.strip.split('.').each do |v|
            t = t[v]
          end

          assert(!t.to_s.empty?)
        rescue
          puts "#{lang}.#{line}"
          missing = 1
        end
      end
    end

    assert_equal(0, missing)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mpw-4.1.1 test/test_translate.rb
mpw-4.1.0 test/test_translate.rb