Skip to content

Commit a83761c

Browse files
committed
Revert tooltip localization attempt
1 parent 90fc40f commit a83761c

File tree

4 files changed

+2
-15
lines changed

4 files changed

+2
-15
lines changed

options/locale/locale_en-US.ini

-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ number_of_contributions_in_the_last_12_months = %s contributions in the last 12
125125
no_contributions = No contributions
126126
less = Less
127127
more = More
128-
number_of_contributions_on_date_n = <b>%[2]s contributions</b> on %[1]s
129-
number_of_contributions_on_date_1 = <b>1 contribution</b> on %[1]s
130128

131129
[editor]
132130
buttons.heading.tooltip = Add heading

templates/user/heatmap.tmpl

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
data-locale-no-contributions="{{.locale.Tr "heatmap.no_contributions"}}"
66
data-locale-more="{{.locale.Tr "heatmap.more"}}"
77
data-locale-less="{{.locale.Tr "heatmap.less"}}"
8-
data-locale-contributions-on-n="{{.locale.Tr "heatmap.number_of_contributions_on_date_n"}}"
9-
data-locale-contributions-on-1="{{.locale.Tr "heatmap.number_of_contributions_on_date_1"}}"
108
>
119
<div slot="loading">
1210
<div class="ui active centered inline indeterminate text loader" id="loading-heatmap">{{.locale.Tr "user.heatmap.loading"}}</div>

web_src/js/components/ActivityHeatmap.vue

+1-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<calendar-heatmap
66
:locale="locale"
77
:no-data-text="locale.no_contributions"
8-
:tooltip-formatter="(v) => tooltipFormatter(v, locale)"
8+
:tooltip-unit="locale.contributions"
99
:end-date="endDate"
1010
:values="values"
1111
:range-color="colorRange"
@@ -64,14 +64,6 @@ export default {
6464
6565
const newSearch = params.toString();
6666
window.location.search = newSearch.length ? `?${newSearch}` : '';
67-
},
68-
tooltipFormatter(v, locale) {
69-
const number = v.count.toLocaleString();
70-
const datetime = v.date.toISOString();
71-
const fallback = v.date.toLocaleDateString();
72-
const date = `<relative-time format="datetime" year="numeric" month="short" day="numeric" weekday="" datetime="${datetime}">${fallback}</relative-time>`;
73-
const stringToFormat = v.count === 1 ? locale.contributions_on_1 : locale.contributions_on_n;
74-
return stringToFormat.replace('%[2]s', number).replace('%[1]s', date);
7567
}
7668
},
7769
};

web_src/js/features/heatmap.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ export function initHeatmap() {
2121
const locale = {
2222
months: new Array(12).fill().map((_, idx) => translateMonth(idx)),
2323
days: new Array(7).fill().map((_, idx) => translateDay(idx)),
24+
contributions: 'contributions',
2425
contributions_in_the_last_12_months_html: el.getAttribute('data-locale-total-contributions-html'),
2526
no_contributions: el.getAttribute('data-locale-no-contributions'),
2627
more: el.getAttribute('data-locale-more'),
2728
less: el.getAttribute('data-locale-less'),
28-
contributions_on_n: el.getAttribute('data-locale-contributions-on-n'),
29-
contributions_on_1: el.getAttribute('data-locale-contributions-on-1'),
3029
};
3130

3231
const View = createApp(ActivityHeatmap, {values, locale});

0 commit comments

Comments
 (0)