Skip to content

Commit 240774e

Browse files
authored
feat: Add i18n support for charts demo (#80)
1 parent e234476 commit 240774e

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/locales/en-US.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,13 @@
1313
"noData": "No data",
1414
"pull": "Pull",
1515
"reset": "Reset"
16+
},
17+
"charts": {
18+
"January": "Jan",
19+
"February": "Feb",
20+
"March": "Mar",
21+
"April": "Apr",
22+
"May": "May",
23+
"June": "Jun"
1624
}
17-
}
25+
}

src/locales/zh-CN.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,13 @@
1313
"pull": "请求",
1414
"reset": "清空",
1515
"noData": "暂无数据"
16+
},
17+
"charts": {
18+
"January": "1月",
19+
"February": "2月",
20+
"March": "3月",
21+
"April": "4月",
22+
"May": "5月",
23+
"June": "6月"
1624
}
17-
}
25+
}

src/pages/charts/index.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ definePage({
88
},
99
})
1010
11+
const { t } = useI18n()
12+
1113
const barOption = {
1214
title: {},
1315
tooltip: {},
1416
xAxis: {
15-
data: ['1月', '2月', '3月', '4月', '5月', '6月'],
17+
data: [t('charts.January'), t('charts.February'), t('charts.March'), t('charts.April'), t('charts.May'), t('charts.June')],
1618
},
1719
yAxis: {},
1820
series: [

0 commit comments

Comments
 (0)