Skip to content

Commit 2d815a5

Browse files
committed
Fix usage of partial localization
1 parent 8e1545d commit 2d815a5

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-activity-calendar",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": " A React component to display activity data in calendar",
55
"author": "Jonathan Gruber <gruberjonathan@gmail.com>",
66
"license": "MIT",

src/component/ActivityCalendar.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import {
1717
groupByWeeks,
1818
MIN_DISTANCE_MONTH_LABELS,
1919
NAMESPACE,
20-
DEFAULT_MONTH_LABELS,
2120
DEFAULT_WEEKDAY_LABELS,
21+
DEFAULT_LABELS,
2222
} from '../util';
2323

2424
type CalendarData = Array<Day>;
@@ -119,15 +119,7 @@ const ActivityCalendar: FunctionComponent<Props> = ({
119119
hideColorLegend = false,
120120
hideMonthLabels = false,
121121
hideTotalCount = false,
122-
labels = {
123-
months: DEFAULT_MONTH_LABELS,
124-
weekdays: DEFAULT_WEEKDAY_LABELS,
125-
totalCount: '{{count}} contributions in {{year}}',
126-
legend: {
127-
less: 'Less',
128-
more: 'More',
129-
},
130-
},
122+
labels: labelsProp,
131123
loading = false,
132124
showWeekdayLabels = false,
133125
style = {},
@@ -147,6 +139,7 @@ const ActivityCalendar: FunctionComponent<Props> = ({
147139
const year = getYear(parseISO(data[0]?.date));
148140

149141
const theme = getTheme(themeProp, color);
142+
const labels = Object.assign({}, DEFAULT_LABELS, labelsProp);
150143
const textHeight = hideMonthLabels ? 0 : fontSize + 2 * blockMargin;
151144

152145
function getDimensions() {

src/util.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,13 @@ export const DEFAULT_MONTH_LABELS = [
153153
];
154154

155155
export const DEFAULT_WEEKDAY_LABELS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
156+
157+
export const DEFAULT_LABELS = {
158+
months: DEFAULT_MONTH_LABELS,
159+
weekdays: DEFAULT_WEEKDAY_LABELS,
160+
totalCount: '{{count}} contributions in {{year}}',
161+
legend: {
162+
less: 'Less',
163+
more: 'More',
164+
},
165+
};

0 commit comments

Comments
 (0)