git ssb

2+

mixmix / ticktack



Commit 290057bfce673063c5629dd99de5b67dab52483a

add translations

mix irving committed on 4/26/2018, 11:31:43 PM
Parent: 66dcda756a8e52b5f22cac3256eb987e6b3226b7

Files changed

app/page/statsShow.jschanged
app/page/statsShow.mcsschanged
translations/en.jschanged
app/page/statsShow.jsView
@@ -11,9 +11,10 @@
1111
1212 exports.needs = nest({
1313 'sbot.obs.connection': 'first',
1414 'history.sync.push': 'first',
15- 'message.html.markdown': 'first'
15+ 'message.html.markdown': 'first',
16+ 'translations.sync.strings': 'first'
1617 })
1718
1819 const COMMENTS = 'comments'
1920 const LIKES = 'likes'
@@ -28,8 +29,11 @@
2829 exports.create = (api) => {
2930 return nest('app.page.statsShow', statsShow)
3031
3132 function statsShow (location) {
33+ const strings = api.translations.sync.strings()
34+ const t = strings.statsShow
35+
3236 var store = Struct({
3337 blogs: MutantArray([]),
3438 comments: Dict(),
3539 likes: Dict(),
@@ -89,40 +93,42 @@
8993
9094 const page = h('Page -statsShow', [
9195 h('Scroller.content', [
9296 h('div.content', [
93- h('h1', 'Stats'),
97+ h('h1', t.title),
9498 h('section.totals', [COMMENTS, LIKES, SHARES].map(focus => {
9599 return h('div',
96100 {
97101 classList: computed(context.focus, f => f === focus ? [focus, '-selected'] : [focus]),
98102 'ev-click': () => context.focus.set(focus)
99103 }, [
100104 h('div.count', totalOnscreenData(focus)),
101- h('strong', focus),
102- '(30 days)'
105+ h('strong', strings[focus]),
106+ '(',
107+ t.thirtyDays,
108+ ')'
103109 ])
104110 })),
105111 h('section.graph', [
106112 canvas,
107113 h('div.changeRange', [
108114 '< ',
109- h('a', { 'ev-click': () => howFarBack.set(howFarBack() + 1) }, 'Prev 30 days'),
115+ h('a', { 'ev-click': () => howFarBack.set(howFarBack() + 1) }, t.prevMonth),
110116 ' | ',
111117 when(howFarBack,
112- h('a', { 'ev-click': () => howFarBack.set(howFarBack() - 1) }, 'Next 30 days'),
113- h('span', 'Next 30 days')
118+ h('a', { 'ev-click': () => howFarBack.set(howFarBack() - 1) }, t.nextMonth),
119+ h('span', t.nextMonth)
114120 ),
115121 ' >'
116122 ])
117123 ]),
118124 h('table.blogs', [
119125 h('thead', [
120126 h('tr', [
121127 h('th.details'),
122- h('th.comments', 'Comments'),
123- h('th.likes', 'Likes'),
124- h('th.shares', 'Shares')
128+ h('th.comments', strings.comments),
129+ h('th.likes', strings.likes),
130+ h('th.shares', strings.shares)
125131 ])
126132 ]),
127133 h('tbody', map(store.blogs, BlogRow))
128134 ])
app/page/statsShow.mcssView
@@ -22,11 +22,10 @@
2222 flex-basis: 33%
2323 flex-grow: 1
2424
2525 cursor: pointer
26- padding: 0 0 .5rem .5rem
2726 $colorFontSubtle
28- padding: 0 0 .5rem .5rem
27+ padding: 0 0 .5rem .8rem
2928 border-bottom: 1px solid gainsboro
3029 border-right: 1px solid gainsboro
3130
3231 transition: all ease-out .5s
@@ -97,12 +96,15 @@
9796 }
9897 tbody {
9998 tr.blog {
10099 margin-bottom: 1rem
100+ td {
101+ border-bottom: 1px solid rgba(0, 0, 0, .05)
102+ }
103+
101104 td.details {
102105 width: 70%
103106 padding: .8rem 2rem .8rem 0
104- border-bottom: 1px solid rgba(0, 0, 0, .05)
105107
106108 div.title {
107109 font-size: 1.3rem
108110 font-weight: 600
translations/en.jsView
@@ -1,5 +1,8 @@
11 module.exports = {
2+ comments: 'Comments',
3+ likes: 'Likes',
4+ shares: 'Shares',
25 splash: {
36 about: [
47 'A social network that values openness, equality, and freedom.',
58 'A new social network for people seeking an equitable world that values the value people create and successfully balances freedom, solidarity, privacy, and openness.',
@@ -157,8 +160,14 @@
157160 state: {
158161 noSubscriptions: 'You have no subscriptions yet'
159162 }
160163 },
164+ statsShow: {
165+ title: 'Stats',
166+ prevMonth: 'Prev 30 days',
167+ nextMonth: 'Next 30 days',
168+ thirtyDays: '30 days',
169+ },
161170 languages: {
162171 en: 'English',
163172 zh: '中文'
164173 }

Built with git-ssb-web