]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/4452'
authorTom Hughes <tom@compton.nu>
Tue, 2 Jan 2024 18:54:18 +0000 (18:54 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 2 Jan 2024 18:54:18 +0000 (18:54 +0000)
app/models/language.rb
test/models/language_test.rb

index 8d3e4583fad137db074ed85614a27becdaeaf759..f1d40feeab109fc341c9aae48fa1ea184e63d494 100644 (file)
@@ -26,7 +26,7 @@ class Language < ApplicationRecord
 
   def name
     name = english_name
-    name += " (#{native_name})" unless native_name.nil?
+    name += " (#{native_name})" unless native_name.nil? || native_name == english_name
     name
   end
 end
index 5ba558907a0f68f22ce32123e33c13c70997bfef..f777d8e1965a53d7348e52bfda21cbb9f349b931 100644 (file)
@@ -6,6 +6,11 @@ class LanguageTest < ActiveSupport::TestCase
     assert_equal "Slovenian (slovenščina)", Language.find("sl").name
   end
 
+  def test_same_native_name
+    create(:language, :code => "af", :english_name => "Afrikaans", :native_name => "Afrikaans")
+    assert_equal "Afrikaans", Language.find("af").name
+  end
+
   def test_load
     assert_equal 0, Language.count
     assert_raise ActiveRecord::RecordNotFound do