X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/5f2a5cadcb693b34b81a9232b8879c3b4f12843d..001fed4fd7d321a079568f5de9479adfbff21778:/test/lib/osm_community_index_test.rb?ds=sidebyside diff --git a/test/lib/osm_community_index_test.rb b/test/lib/osm_community_index_test.rb index a922d7fd9..9b10d81d9 100644 --- a/test/lib/osm_community_index_test.rb +++ b/test/lib/osm_community_index_test.rb @@ -40,4 +40,14 @@ class CountryTest < ActiveSupport::TestCase name = OsmCommunityIndex.resolve_name(community, community_locale_yaml, community_en_yaml) assert_equal("Translated Community Chapter", name) end + + def test_i18n_invalid_replacement_token + # Ignore invalid replacement tokens in OCI data provided. This might happen if translators were mistakenly translating the predefined token ids. + community = Community.new({ "id" => "foo-chapter", "type" => "osm-lc", "strings" => { "community" => "Community Name", "communityID" => "communityname" } }) + community_locale_yaml = { "_communities" => { "communityname" => "Translated Community" }, "_defaults" => { "osm-lc" => { "name" => "{comminauté} Chapter" } } } + community_en_yaml = {} + + name = OsmCommunityIndex.resolve_name(community, community_locale_yaml, community_en_yaml) + assert_equal("Community Name", name) + end end