From 062f77e4b42643d033936305874a6e587fec7c9f Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Sat, 13 Mar 2021 15:59:33 +0100 Subject: [PATCH] Fix syntax error for pt-BR and ajust unit test --- CHANGELOG.md | 1 + Gemfile.lock | 72 ++++++++++++++++++++++++++++++++++++++++ config/locales/pt-BR.yml | 2 +- test/unit/i18n_test.rb | 19 ++++++----- 4 files changed, 84 insertions(+), 10 deletions(-) create mode 100644 Gemfile.lock diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d7c967..207c260 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Changelog ----- - Drop testing with travis - we use github actions +- Add translation pt-BR - thanks to @lucianocosta 1.0.7 ----- diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..671b291 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,72 @@ +GEM + remote: https://rubygems.org/ + specs: + actionpack (5.2.4.2) + actionview (= 5.2.4.2) + activesupport (= 5.2.4.2) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.4.2) + activesupport (= 5.2.4.2) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activesupport (5.2.4.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + builder (3.2.4) + concurrent-ruby (1.1.8) + crass (1.0.6) + erubi (1.10.0) + i18n (1.8.5) + concurrent-ruby (~> 1.0) + loofah (2.9.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + method_source (1.0.0) + minitest (5.14.4) + nokogiri (1.11.2-x86_64-darwin) + racc (~> 1.4) + racc (1.5.2) + rack (2.2.3) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (5.2.4.2) + actionpack (= 5.2.4.2) + activesupport (= 5.2.4.2) + method_source + rake (>= 0.8.7) + thor (>= 0.19.0, < 2.0) + rake (13.0.3) + slim (4.1.0) + temple (>= 0.7.6, < 0.9) + tilt (>= 2.0.6, < 2.1) + slim-rails (3.2.0) + actionpack (>= 3.1) + railties (>= 3.1) + slim (>= 3.0, < 5.0) + temple (0.8.2) + thor (1.1.0) + thread_safe (0.3.6) + tilt (2.0.10) + tzinfo (1.2.9) + thread_safe (~> 0.1) + +PLATFORMS + ruby + +DEPENDENCIES + slim-rails + +BUNDLED WITH + 2.1.4 diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index b7fce9b..f234c84 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -1,6 +1,6 @@ # Brazilian Portuguese strings pt-BR: - default_mentionsl_info: Pessoas a notificar, separadas por vírgula (ex: @all, @here) + default_mentionsl_info: "Pessoas a notificar, separadas por vírgula (ex: @all, @here)" label_messenger_contact_created: "%{project_url} - Contato %{url} criado por *%{user}*" label_messenger_contact_updated: "%{project_url} - Contato %{url} atualizado por *%{user}*" label_messenger_db_entry_created: "%{project_url} - Entrada de dado %{url} criada por *%{user}*" diff --git a/test/unit/i18n_test.rb b/test/unit/i18n_test.rb index 7b872c8..1f47a96 100644 --- a/test/unit/i18n_test.rb +++ b/test/unit/i18n_test.rb @@ -18,17 +18,18 @@ class I18nTest < ActiveSupport::TestCase def test_locales_validness lang_files_count = Dir[Rails.root.join('plugins/redmine_messenger/config/locales/*.yml')].size - assert_equal lang_files_count, 5 + + assert_equal 6, lang_files_count valid_languages.each do |lang| assert set_language_if_valid(lang) + case lang.to_s + when 'en' + assert_equal 'Messenger username', l(:label_settings_messenger_username) + when 'de', 'fr', 'ja', 'ko', 'pt-BR' + assert_not l(:label_settings_messenger_username) == 'Messenger username', lang + end end - # check if parse error exists - ::I18n.locale = 'de' - assert_equal 'Messenger Benutzer', l(:label_settings_messenger_username) - ::I18n.locale = 'en' - assert_equal 'Messenger username', l(:label_settings_messenger_username) - ::I18n.locale = 'ja' - assert_equal 'メッセンジャーのユーザー名', l(:label_settings_messenger_username) - set_language_if_valid('en') + + set_language_if_valid 'en' end end