Skip to content

Commit 824b23a

Browse files
tomhughesArpan200502
authored andcommitted
Merge remote-tracking branch 'upstream/pull/6847'
2 parents b533aa3 + 46a4209 commit 824b23a

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

app/assets/javascripts/heatmap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ $(document).on("turbo:frame-load", function () {
6666
}
6767

6868
function getTooltipText(date, value) {
69-
const localizedDate = OSM.i18n.l("date.formats.heatmap", date);
69+
const localizedDate = OSM.i18n.l("date.formats.contribution_calendar", date);
7070

7171
if (value > 0) {
72-
return OSM.i18n.t("javascripts.heatmap.tooltip.contributions", { count: value, date: localizedDate });
72+
return OSM.i18n.t("javascripts.contribution_calendar.tooltip.contributions", { count: value, date: localizedDate });
7373
}
7474

75-
return OSM.i18n.t("javascripts.heatmap.tooltip.no_contributions", { date: localizedDate });
75+
return OSM.i18n.t("javascripts.contribution_calendar.tooltip.no_contributions", { date: localizedDate });
7676
}
7777

7878
function getWeekInfo() {

app/views/profiles/heatmaps/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<% end %>
77

88
<%= bootstrap_form_for current_user, :url => { :action => :update } do |f| %>
9-
<%= f.check_box :public_heatmap, :label => t(".show_heatmap_in_public"), :checked => current_user.public_heatmap? %>
9+
<%= f.check_box :public_heatmap, :label => t(".show_contribution_calendar_in_public"), :checked => current_user.public_heatmap? %>
1010

1111
<%= f.primary t(".save") %>
1212
<%= link_to t(".cancel"), current_user, :class => "btn btn-link" %>

app/views/profiles/profile_sections/_navigation.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
<%= link_to t(".location"), profile_location_path, :class => { "nav-link" => true, "active" => controller_name == "locations" } %>
1616
</li>
1717
<li class="nav-item">
18-
<%= link_to t(".heatmap"), profile_heatmap_path, :class => { "nav-link" => true, "active" => controller_name == "heatmaps" } %>
18+
<%= link_to t(".contribution_calendar"), profile_heatmap_path, :class => { "nav-link" => true, "active" => controller_name == "heatmaps" } %>
1919
</li>
2020
</ul>

app/views/users/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@
300300
<% end %>
301301
<% if owned %>
302302
<div class="mt-2">
303-
<%= link_to t(".edit_heatmap"), profile_heatmap_path, :class => "btn btn-sm w-100 btn-outline-primary edit_heatmap_button" %>
303+
<%= link_to t(".edit_contribution_calendar"), profile_heatmap_path, :class => "btn btn-sm w-100 btn-outline-primary edit_heatmap_button" %>
304304
</div>
305305
<% end %>
306306

lib/osm_community_index.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def self.add_to_i18n
2121
id = community.id
2222

2323
strings = community_locale_yaml[id] || {}
24-
strings["name"] = resolve_name(community, community_locale_yaml, community_en_yaml)
24+
strings["name"] = resolve_name(community, community_locale_yaml, community_en_yaml, locale)
2525

2626
obj.deep_merge!("osm_community_index" => { "communities" => { id => strings } })
2727
end
@@ -30,7 +30,7 @@ def self.add_to_i18n
3030
end
3131
end
3232

33-
def self.resolve_name(community, community_locale_yaml, community_en_yaml)
33+
def self.resolve_name(community, community_locale_yaml, community_en_yaml, locale_name)
3434
# If theres an explicitly translated name then use that
3535
translated_name = community_locale_yaml.dig(community.id, "name")
3636
return translated_name if translated_name
@@ -42,8 +42,8 @@ def self.resolve_name(community, community_locale_yaml, community_en_yaml)
4242
# Change the `{community}` placeholder to `%{community}` and use Ruby's Kernel.format to fill it in.
4343
begin
4444
translated_name = format(template.gsub("{", "%{"), { :community => community_name }) if template && community_name
45-
rescue KeyError => e
46-
Rails.logger.warn e.full_message
45+
rescue KeyError
46+
Rails.logger.warn "Could not find a translated name for community #{community.id.inspect} in locale #{locale_name.inspect}"
4747
end
4848
return translated_name if translated_name
4949

test/controllers/profiles/heatmaps_controller_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_update
4949
follow_redirect!
5050
assert_response :success
5151
assert_template :show
52-
assert_dom ".alert-success", :text => "Heatmap updated."
52+
assert_dom ".alert-success", :text => "Contribution Calendar updated."
5353

5454
assert_not_predicate user.reload, :public_heatmap?
5555
refute_select heatmap_selector
@@ -60,7 +60,7 @@ def test_update
6060
follow_redirect!
6161
assert_response :success
6262
assert_template :show
63-
assert_dom ".alert-success", :text => "Heatmap updated."
63+
assert_dom ".alert-success", :text => "Contribution Calendar updated."
6464

6565
assert_predicate user.reload, :public_heatmap?
6666
assert_select heatmap_selector

test/lib/osm_community_index_test.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def test_community_name_fallback
99
community_locale_yaml = {}
1010
community_en_yaml = {}
1111

12-
name = OsmCommunityIndex.resolve_name(community, community_locale_yaml, community_en_yaml)
12+
name = OsmCommunityIndex.resolve_name(community, community_locale_yaml, community_en_yaml, "en")
1313
assert_equal("Community Name", name)
1414
end
1515

@@ -19,7 +19,7 @@ def test_resource_name_fallback
1919
community_locale_yaml = {}
2020
community_en_yaml = {}
2121

22-
name = OsmCommunityIndex.resolve_name(community, community_locale_yaml, community_en_yaml)
22+
name = OsmCommunityIndex.resolve_name(community, community_locale_yaml, community_en_yaml, "en")
2323
assert_equal("Chapter Name", name)
2424
end
2525

@@ -29,7 +29,7 @@ def test_i18n_explicit_name
2929
community_locale_yaml = { "foo-chapter" => { "name" => "Translated Chapter Name" } }
3030
community_en_yaml = {}
3131

32-
name = OsmCommunityIndex.resolve_name(community, community_locale_yaml, community_en_yaml)
32+
name = OsmCommunityIndex.resolve_name(community, community_locale_yaml, community_en_yaml, "en")
3333
assert_equal("Translated Chapter Name", name)
3434
end
3535

@@ -39,7 +39,7 @@ def test_i18n_fallback_name
3939
community_locale_yaml = { "_communities" => { "communityname" => "Translated Community" }, "_defaults" => { "osm-lc" => { "name" => "{community} Chapter" } } }
4040
community_en_yaml = {}
4141

42-
name = OsmCommunityIndex.resolve_name(community, community_locale_yaml, community_en_yaml)
42+
name = OsmCommunityIndex.resolve_name(community, community_locale_yaml, community_en_yaml, "en")
4343
assert_equal("Translated Community Chapter", name)
4444
end
4545

@@ -49,7 +49,7 @@ def test_i18n_invalid_replacement_token
4949
community_locale_yaml = { "_communities" => { "communityname" => "Translated Community" }, "_defaults" => { "osm-lc" => { "name" => "{comminauté} Chapter" } } }
5050
community_en_yaml = {}
5151

52-
name = OsmCommunityIndex.resolve_name(community, community_locale_yaml, community_en_yaml)
52+
name = OsmCommunityIndex.resolve_name(community, community_locale_yaml, community_en_yaml, "en")
5353
assert_equal("Community Name", name)
5454
end
5555
end

0 commit comments

Comments
 (0)