translation_test.rb 722 B

123456789101112131415161718192021222324252627282930313233343536
  1. # encoding: utf-8
  2. require 'test_helper'
  3. class TranslationTest < ActiveSupport::TestCase
  4. Translation.load('de-de')
  5. test 'translation' do
  6. tests = [
  7. {
  8. locale: 'en',
  9. string: 'New',
  10. result: 'New',
  11. },
  12. {
  13. locale: 'en-us',
  14. string: 'New',
  15. result: 'New',
  16. },
  17. {
  18. locale: 'de-de',
  19. string: 'New',
  20. result: 'Neu',
  21. },
  22. {
  23. locale: 'de-de',
  24. string: 'not translated - lalala',
  25. result: 'not translated - lalala',
  26. },
  27. ]
  28. tests.each { |test|
  29. result = Translation.translate( test[:locale], test[:string] )
  30. assert_equal( result, test[:result], 'verify result' )
  31. }
  32. end
  33. end