git ssb

10+

Matt McKegg / patchwork



Commit e5ad753b8414d998113f9305e0826f4cf1035fe4

Add strings to i18n

Marcos Gutierrez committed on 9/29/2017, 1:03:10 PM
Parent: 105aa7594db658635444cb37cc121c3952b8216b

Files changed

main-window.jschanged
modules/app/html/progress-notifier.jschanged
modules/feed/html/rollup.jschanged
modules/gathering/sheet/edit.jschanged
modules/invite/sheet.jschanged
modules/message/async/publish.jschanged
modules/message/html/backlinks.jschanged
modules/page/html/render/all.jschanged
modules/page/html/render/channel.jschanged
modules/page/html/render/channels.jschanged
modules/page/html/render/gatherings.jschanged
modules/page/html/render/message.jschanged
modules/page/html/render/private.jschanged
modules/page/html/render/profile.jschanged
modules/page/html/render/public.jschanged
modules/page/html/render/search.jschanged
modules/page/html/render/settings.jschanged
modules/profile/sheet/edit.jschanged
plugs/message/html/layout/default.jschanged
plugs/message/html/render/about.jschanged
plugs/message/html/render/channel.jschanged
plugs/message/html/render/following.jschanged
main-window.jsView
@@ -94,14 +94,14 @@
9494 ]),
9595 h('span.nav', [
9696 tab(i18n.__("Public"), '/public'),
9797 tab(i18n.__("Private"), '/private'),
98- dropTab('More', [
98+ dropTab(i18n.__('More'), [
9999 getSubscribedChannelMenu,
100- ['Gatherings', '/gatherings'],
101- ['Extended Network', '/all'],
100+ [i18n.__('Gatherings'), '/gatherings'],
101+ [i18n.__('Extended Network'), '/all'],
102102 {separator: true},
103- ['Settings', '/settings']
103+ [i18n.__('Settings'), '/settings']
104104 ])
105105 ]),
106106 h('span.appTitle', [
107107 h('span.title', i18n.__("Patchwork")),
@@ -115,9 +115,9 @@
115115 ]),
116116 when(latestUpdate,
117117 h('div.info', [
118118 h('a.message -update', { href: 'https://github.com/ssbc/patchwork/releases' }, [
119- h('strong', ['Patchwork ', latestUpdate, ' has been released.']), ' Click here to download and view more info!',
119+ h('strong', ['Patchwork ', latestUpdate, i18n.__(' has been released.')]), i18n.__(' Click here to download and view more info!'),
120120 h('a.ignore', {'ev-click': latestUpdate.ignore}, 'X')
121121 ])
122122 ])
123123 ),
@@ -151,11 +151,11 @@
151151 var channels = Array.from(subscribedChannels()).sort(localeCompare)
152152
153153 if (channels.length) {
154154 return {
155- label: 'Channels',
155+ label: i18n.__('Channels'),
156156 submenu: [
157- { label: 'Browse All',
157+ { label: i18n.__('Browse All'),
158158 click () {
159159 setView('/channels')
160160 }
161161 },
@@ -170,9 +170,9 @@
170170 }))
171171 }
172172 } else {
173173 return {
174- label: 'Browse Channels',
174+ label: i18n.__('Browse Channels'),
175175 click () {
176176 setView('/channels')
177177 }
178178 }
modules/app/html/progress-notifier.jsView
@@ -1,8 +1,9 @@
11 var {computed, when, h, Value} = require('mutant')
22 var nest = require('depnest')
33 var sustained = require('../../../lib/sustained')
4-var pull = require('pull-stream')
4+var appRoot = require('app-root-path');
5+var i18n = require(appRoot + '/lib/i18n').i18n
56
67 exports.gives = nest('app.html.progressNotifier')
78
89 exports.needs = nest({
@@ -45,17 +46,15 @@
4546
4647 return h('div.info', { hidden }, [
4748 h('div.status', [
4849 when(displaying, h('Loading -small', [
49- when(waiting, 'Waiting for Scuttlebot...',
50- when(pendingMigration,
51- [h('span.info', 'Upgrading database'), h('progress', { style: {'margin-left': '10px'}, min: 0, max: 1, value: migrationProgress })],
52- when(computed(replicateProgress.incompleteFeeds, (v) => v > 5),
53- [h('span.info', 'Downloading new messages'), h('progress', { style: {'margin-left': '10px'}, min: 0, max: 1, value: downloadProgress })],
54- when(pending, [
55- [h('span.info', 'Indexing database'), h('progress', { style: {'margin-left': '10px'}, min: 0, max: 1, value: indexProgress })]
56- ], 'Scuttling...')
57- )
50+ when(pendingMigration,
51+ [h('span.info', i18n.__('Upgrading database')), h('progress', { style: {'margin-left': '10px'}, min: 0, max: 1, value: migrationProgress })],
52+ when(computed(replicateProgress.incompleteFeeds, (v) => v > 5),
53+ [h('span.info', i18n.__('Downloading new messages')), h('progress', { style: {'margin-left': '10px'}, min: 0, max: 1, value: downloadProgress })],
54+ when(pending, [
55+ [h('span.info', i18n.__('Indexing database')), h('progress', { style: {'margin-left': '10px'}, min: 0, max: 1, value: indexProgress })]
56+ ], i18n.__('Scuttling...'))
5857 )
5958 )
6059 ]))
6160 ])
modules/feed/html/rollup.jsView
@@ -6,23 +6,23 @@
66 var nextStepper = require('../../../lib/next-stepper')
77 var extend = require('xtend')
88 var paramap = require('pull-paramap')
99
10+var appRoot = require('app-root-path');
11+var i18n = require(appRoot + '/lib/i18n').i18n
12+
1013 var bumpMessages = {
11- 'vote': 'liked this message',
12- 'post': 'replied to this message',
13- 'about': 'added changes',
14- 'mention': 'mentioned you',
15- 'channel-mention': 'mentioned this channel'
14+ 'vote': i18n.__('liked this message'),
15+ 'post': i18n.__('replied to this message'),
16+ 'about': i18n.__('added changes'),
17+ 'mention': i18n.__('mentioned you'),
18+ 'channel-mention': i18n.__('mentioned this channel')
1619 }
1720
1821 // bump even for first message
1922 var rootBumpTypes = ['mention', 'channel-mention']
2023
21-var appRoot = require('app-root-path');
22-var i18n = require(appRoot + '/lib/i18n').i18n
2324
24-
2525 exports.needs = nest({
2626 'about.obs.name': 'first',
2727 'app.sync.externalHandler': 'first',
2828 'message.html.render': 'first',
@@ -209,9 +209,9 @@
209209 meta,
210210 renderedMessage,
211211 when(replyElements.length, [
212212 when(replies.length > replyElements.length || partial,
213- h('a.full', {href: item.key}, ['View full thread (', replies.length, ')'])
213+ h('a.full', {href: item.key}, [i18n.__('View full thread') +' (', replies.length, ')'])
214214 ),
215215 h('div.replies', replyElements)
216216 ])
217217 ])
modules/gathering/sheet/edit.jsView
@@ -1,8 +1,10 @@
11 var nest = require('depnest')
22 var extend = require('xtend')
33 var Pickr = require('flatpickr')
44 var spacetime = require('spacetime')
5+var appRoot = require('app-root-path');
6+var i18n = require(appRoot + '/lib/i18n').i18n
57
68 var {Value, h, computed, when} = require('mutant')
79
810 exports.gives = nest('gathering.sheet.edit')
@@ -52,44 +54,44 @@
5254 h('h2', {
5355 style: {
5456 'font-weight': 'normal'
5557 }
56- }, [id ? 'Edit' : 'Create', ' Gathering']),
58+ }, [id ? i18n.__('Edit') : i18n.__('Create'), i18n.__(' Gathering')]),
5759 h('GatheringEditor', [
5860 h('input.title', {
59- placeholder: 'Choose a title',
61+ placeholder: i18n.__('Choose a title'),
6062 hooks: [ValueHook(chosen.title), FocusHook()]
6163 }),
6264 h('input.date', {
63- placeholder: 'Choose date and time',
65+ placeholder: i18n.__('Choose date and time'),
6466 hooks: [
6567 PickrHook(chosen.startDateTime)
6668 ]
6769 }),
6870 h('ImageInput .banner', {
6971 style: { 'background-image': computed(imageUrl, x => `url(${x})`) }
7072 }, [
71- h('span', ['๐Ÿ–ผ Choose Banner Image...']),
73+ h('span', ['๐Ÿ–ผ ', i18n.__('Choose Banner Image...')]),
7274 api.blob.html.input(file => {
7375 chosen.image.set(file)
7476 }, {
7577 accept: 'image/*'
7678 })
7779 ]),
7880 h('textarea.description', {
79- placeholder: 'Describe the gathering (if you want)',
81+ placeholder: i18n.__('Describe the gathering (if you want)'),
8082 hooks: [ValueHook(chosen.description)]
8183 })
8284 ])
8385 ]),
8486 footer: [
8587 h('button -save', {
8688 'ev-click': save,
8789 'disabled': publishing
88- }, when(publishing, 'Publishing...', 'Publish')),
90+ }, when(publishing, i18n.__('Publishing...'), i18n.__('Publish'))),
8991 h('button -cancel', {
9092 'ev-click': close
91- }, 'Cancel')
93+ }, i18n.__('Cancel'))
9294 ]
9395 }
9496
9597 function ensureExists (cb) {
@@ -110,9 +112,9 @@
110112 var update = {}
111113
112114 if (!compareImage(chosen.image(), current.image())) update.image = chosen.image()
113115 if (!compareTime(chosen.startDateTime(), current.startDateTime())) update.startDateTime = chosen.startDateTime()
114- if (chosen.title() !== current.title()) update.title = chosen.title() || 'Untitled Gathering'
116+ if (chosen.title() !== current.title()) update.title = chosen.title() || i18n.__('Untitled Gathering')
115117 if (chosen.description() !== current.description()) update.description = chosen.description()
116118
117119 if (Object.keys(update).length) {
118120 publishing.set(true)
@@ -125,11 +127,11 @@
125127 if (err) {
126128 publishing.set(false)
127129 showDialog({
128130 type: 'error',
129- title: 'Error',
131+ title: i18n.__('Error'),
130132 buttons: ['OK'],
131- message: 'An error occurred while attempting to publish gathering.',
133+ message: i18n.__('An error occurred while attempting to publish gathering.'),
132134 detail: err.message
133135 })
134136 } else {
135137 close()
modules/invite/sheet.jsView
@@ -1,8 +1,11 @@
11 var {h, when, Value, Proxy} = require('mutant')
22 var nest = require('depnest')
33 var electron = require('electron')
44
5+var appRoot = require('app-root-path');
6+var i18n = require(appRoot + '/lib/i18n').i18n
7+
58 exports.needs = nest({
69 'sheet.display': 'first',
710 'invite.async.accept': 'first'
811 })
@@ -20,9 +23,9 @@
2023 'font-size': '200%',
2124 'margin-top': '20px',
2225 'width': '100%'
2326 },
24- placeholder: 'paste invite code here'
27+ placeholder: i18n.__('paste invite code here')
2528 })
2629 setTimeout(() => {
2730 input.focus()
2831 input.select()
@@ -36,11 +39,11 @@
3639 h('h2', {
3740 style: {
3841 'font-weight': 'normal'
3942 }
40- }, ['By default, Patchwork will only see other users that are on the same local area network as you.']),
43+ }, [i18n.__('By default, Patchwork will only see other users that are on the same local area network as you.')]),
4144 h('div', [
42- 'In order to share with users on the internet, you need to be invited to a pub server.'
45+ i18n.__('In order to share with users on the internet, you need to be invited to a pub server.')
4346 ]),
4447 input
4548 ]),
4649 footer: [
@@ -52,22 +55,22 @@
5255 if (err) {
5356 publishing.set(false)
5457 showDialog({
5558 type: 'error',
56- title: 'Error',
57- buttons: ['OK'],
58- message: 'An error occurred while attempting to redeem invite.',
59+ title: i18n.__('Error'),
60+ buttons: [i18n.__('OK')],
61+ message: i18n.__('An error occurred while attempting to redeem invite.'),
5962 detail: err.message
6063 })
6164 } else {
6265 close()
6366 }
6467 }))
6568 }
66- }, [ when(publishing, publishStatus, 'Redeem Invite') ]),
69+ }, [ when(publishing, publishStatus, i18n.__('Redeem Invite')) ]),
6770 h('button -cancel', {
6871 'ev-click': close
69- }, 'Cancel')
72+ }, i18n.__('Cancel'))
7073 ]
7174 }
7275 })
7376 })
modules/message/async/publish.jsView
@@ -1,7 +1,11 @@
11 var h = require('mutant/h')
22 var nest = require('depnest')
3+var i18n = require('i18n')
34
5+var appRoot = require('app-root-path')
6+var i18n = require(appRoot + '/lib/i18n').i18n
7+
48 exports.needs = nest({
59 'sheet.display': 'first',
610 'message.html.render': 'first',
711 'sbot.async.publish': 'first',
@@ -21,10 +25,10 @@
2125 author: api.keys.sync.id()
2226 }})
2327 ],
2428 footer: [
25- h('button -save', { 'ev-click': publish }, 'Confirm'),
26- h('button -cancel', { 'ev-click': cancel }, 'Cancel')
29+ h('button -save', { 'ev-click': publish }, i18n.__('Confirm')),
30+ h('button -cancel', { 'ev-click': cancel }, i18n.__('Cancel'))
2731 ]
2832 }
2933
3034 function publish () {
modules/message/html/backlinks.jsView
@@ -1,7 +1,9 @@
11 var nest = require('depnest')
22 var ref = require('ssb-ref')
33 var { h, map, computed } = require('mutant')
4+var appRoot = require('app-root-path')
5+var i18n = require(appRoot + '/lib/i18n').i18n
46
57 exports.needs = nest({
68 'message.obs': {
79 backlinks: 'first',
@@ -24,9 +26,9 @@
2426 return h('a.backlink', {
2527 href: link.id, title: link.id
2628 }, [
2729 h('strong', [
28- api.profile.html.person(link.author), ' forked this discussion:'
30+ api.profile.html.person(link.author), i18n.__(' forked this discussion:')
2931 ]), ' ',
3032 api.message.obs.name(link.id)
3133 ])
3234 }),
@@ -34,9 +36,9 @@
3436 return h('a.backlink', {
3537 href: link.id, title: link.id
3638 }, [
3739 h('strong', [
38- api.profile.html.person(link.author), ' referenced this message:'
40+ api.profile.html.person(link.author), i18n.__(' referenced this message:')
3941 ]), ' ',
4042 api.message.obs.name(link.id)
4143 ])
4244 })
modules/page/html/render/all.jsView
@@ -1,6 +1,8 @@
11 var nest = require('depnest')
22 var { h } = require('mutant')
3+var appRoot = require('app-root-path')
4+var i18n = require(appRoot + '/lib/i18n').i18n
35
46 exports.needs = nest({
57 'feed.pull.public': 'first',
68 'message.html.compose': 'first',
@@ -20,13 +22,13 @@
2022
2123 var prepend = [
2224 h('PageHeading', [
2325 h('h1', [
24- 'All Posts from Your ',
25- h('strong', 'Extended Network')
26+ i18n.__('All Posts from Your '),
27+ h('strong', i18n.__('Extended Network'))
2628 ])
2729 ]),
28- api.message.html.compose({ meta: { type: 'post' }, placeholder: 'Write a public message' })
30+ api.message.html.compose({ meta: { type: 'post' }, placeholder: i18n.__('Write a public message') })
2931 ]
3032
3133 var feedView = api.feed.html.rollup(api.feed.pull.public, {
3234 bumpFilter: (msg) => {
modules/page/html/render/channel.jsView
@@ -1,6 +1,8 @@
11 var { h, when, send } = require('mutant')
22 var nest = require('depnest')
3+var appRoot = require('app-root-path')
4+var i18n = require(appRoot + '/lib/i18n').i18n
35
46 exports.needs = nest({
57 'channel.obs.subscribed': 'first',
68 'message.html.compose': 'first',
@@ -26,21 +28,21 @@
2628 h('div.meta', [
2729 when(subscribedChannels.has(channel),
2830 h('a.ToggleButton.-unsubscribe', {
2931 'href': '#',
30- 'title': 'Click to unsubscribe',
32+ 'title': i18n.__('Click to unsubscribe'),
3133 'ev-click': send(unsubscribe, channel)
32- }, 'Subscribed'),
34+ }, i18n.__('Subscribed')),
3335 h('a.ToggleButton.-subscribe', {
3436 'href': '#',
3537 'ev-click': send(subscribe, channel)
36- }, 'Subscribe')
38+ }, i18n.__('Subscribe'))
3739 )
3840 ])
3941 ]),
4042 api.message.html.compose({
4143 meta: {type: 'post', channel},
42- placeholder: 'Write a message in this channel\n\n\n\nPeople who follow you or subscribe to this channel will also see this message in their main feed.\n\nTo create a new channel, type the channel name (preceded by a #) into the search box above. e.g #cat-pics'
44+ placeholder: i18n.__('Write a message in this channel')
4345 })
4446 ]
4547
4648 return api.feed.html.rollup(api.feed.pull.channel(channel), {
modules/page/html/render/channels.jsView
@@ -1,6 +1,8 @@
11 var nest = require('depnest')
22 var { h, send, when, computed, map } = require('mutant')
3+var appRoot = require('app-root-path')
4+var i18n = require(appRoot + '/lib/i18n').i18n
35
46 exports.needs = nest({
57 'message.async.publish': 'first',
68 'keys.sync.id': 'first',
@@ -38,12 +40,12 @@
3840 h('span.name', '#' + channel),
3941 when(subscribed,
4042 h('a.-unsubscribe', {
4143 'ev-click': send(unsubscribe, channel)
42- }, 'Unsubscribe'),
44+ }, i18n.__('Unsubscribe')),
4345 h('a.-subscribe', {
4446 'ev-click': send(subscribe, channel)
45- }, 'Subscribe')
47+ }, i18n.__('Subscribe'))
4648 )
4749 ])
4850 }, {maxTime: 5, idle: true})
4951 ])
modules/page/html/render/gatherings.jsView
@@ -1,6 +1,8 @@
11 var { h } = require('mutant')
22 var nest = require('depnest')
3+var appRoot = require('app-root-path')
4+var i18n = require(appRoot + '/lib/i18n').i18n
35
46 exports.needs = nest({
57 'feed.pull.type': 'first',
68 'feed.html.rollup': 'first',
@@ -21,13 +23,13 @@
2123 var following = api.contact.obs.following(id)
2224
2325 var prepend = [
2426 h('PageHeading', [
25- h('h1', [h('strong', 'Gatherings'), ' from your extended network']),
27+ h('h1', [h('strong', i18n.__('Gatherings')), i18n.__(' from your extended network')]),
2628 h('div.meta', [
2729 h('button -add', {
2830 'ev-click': createGathering
29- }, '+ Add Gathering')
31+ }, i18n.__('+ Add Gathering'))
3032 ])
3133 ])
3234 ]
3335
modules/page/html/render/message.jsView
@@ -1,9 +1,9 @@
11 var { h, when, map, Proxy, Struct, Value, computed } = require('mutant')
22 var nest = require('depnest')
33 var ref = require('ssb-ref')
44
5-var appRoot = require('app-root-path');
5+var appRoot = require('app-root-path')
66 var i18n = require(appRoot + '/lib/i18n').i18n
77
88 exports.needs = nest({
99 'keys.sync.id': 'first',
@@ -51,9 +51,9 @@
5151 }
5252
5353 if (!value) {
5454 return result.set(h('PageHeading', [
55- h('h1', 'Cannot display message.')
55+ h('h1', i18n.__('Cannot display message.'))
5656 ]))
5757 }
5858
5959 // what happens in private stays in private!
modules/page/html/render/private.jsView
@@ -1,6 +1,8 @@
11 var nest = require('depnest')
22 var ref = require('ssb-ref')
3+var appRoot = require('app-root-path')
4+var i18n = require(appRoot + '/lib/i18n').i18n
35
46 exports.needs = nest({
57 'feed.html.rollup': 'first',
68 'feed.pull.private': 'first',
@@ -23,9 +25,9 @@
2325 return ref.isFeed(typeof e === 'string' ? e : e.link)
2426 })
2527 return msg
2628 },
27- placeholder: `Write a private message \n\n\n\nThis can only be read by yourself and people you have @mentioned.`
29+ placeholder: i18n.__('Write a private message')
2830 })
2931 ]
3032
3133 return api.feed.html.rollup(api.feed.pull.private, { prepend })
modules/page/html/render/profile.jsView
@@ -1,8 +1,10 @@
11 var nest = require('depnest')
22 var ref = require('ssb-ref')
33 var {h, when, computed, map, send, dictToCollection, resolve} = require('mutant')
44 var extend = require('xtend')
5+var appRoot = require('app-root-path')
6+var i18n = require(appRoot + '/lib/i18n').i18n
57
68 exports.needs = nest({
79 'about.obs': {
810 name: 'first',
@@ -83,9 +85,9 @@
8385 classList: [
8486 when(isSelf, '-self'),
8587 when(isAssigned, '-assigned')
8688 ],
87- title: nameList(when(isSelf, 'Self Assigned', 'Assigned By'), item.value)
89+ title: nameList(when(isSelf, i18n.__('Self Assigned'), i18n.__('Assigned By')), item.value)
8890 }, [
8991 item.key
9092 ])
9193 }),
@@ -111,9 +113,9 @@
111113 classList: [
112114 when(isSelf, '-self'),
113115 when(isAssigned, '-assigned')
114116 ],
115- title: nameList(when(isSelf, 'Self Assigned', 'Assigned By'), item.value)
117+ title: nameList(when(isSelf, i18n.__('Self Assigned'), i18n.__('Assigned By')), item.value)
116118 }, [
117119 h('img', {
118120 className: 'Avatar',
119121 style: { 'background-color': api.about.obs.color(id) },
@@ -137,20 +139,20 @@
137139 h('div.title', [
138140 h('h1', [name]),
139141 h('div.meta', [
140142 when(id === yourId, [
141- h('button', {'ev-click': api.profile.sheet.edit}, 'Edit Your Profile')
143+ h('button', {'ev-click': api.profile.sheet.edit}, i18n.__('Edit Your Profile'))
142144 ], [
143145 when(youFollow,
144146 h('a.ToggleButton.-unsubscribe', {
145147 'href': '#',
146- 'title': 'Click to unfollow',
148+ 'title': i18n.__('Click to unfollow'),
147149 'ev-click': send(unfollow, id)
148- }, when(isFriends, 'Friends', 'Following')),
150+ }, when(isFriends, i18n.__('Friends'), i18n.__('Following'))),
149151 h('a.ToggleButton.-subscribe', {
150152 'href': '#',
151153 'ev-click': send(follow, id)
152- }, when(followsYou, 'Follow Back', 'Follow'))
154+ }, when(followsYou, i18n.__('Follow Back'), i18n.__('Follow')))
153155 )
154156 ])
155157 ])
156158 ]),
@@ -177,11 +179,11 @@
177179 ]),
178180 h('div.side.-right', [
179181 when(friendsLoaded,
180182 h('div', [
181- renderContactBlock('Friends', friends, yourFollows),
182- renderContactBlock('Followers', followers, yourFollows),
183- renderContactBlock('Following', following, yourFollows)
183+ renderContactBlock(i18n.__('Friends'), friends, yourFollows),
184+ renderContactBlock(i18n.__('Followers'), followers, yourFollows),
185+ renderContactBlock(i18n.__('Following'), following, yourFollows)
184186 ]),
185187 h('div', {className: 'Loading'})
186188 )
187189 ])
@@ -273,9 +275,9 @@
273275 h('h2', {
274276 style: {
275277 'font-weight': 'normal'
276278 }
277- }, ['What whould you like to call ', h('strong', [currentName]), '?']),
279+ }, [i18n.__('What whould you like to call '), h('strong', [currentName]), '?']),
278280 input
279281 ]),
280282 footer: [
281283 h('button -save', {
@@ -289,12 +291,12 @@
289291 })
290292 }
291293 close()
292294 }
293- }, 'Confirm'),
295+ }, i18n.__('Confirm')),
294296 h('button -cancel', {
295297 'ev-click': close
296- }, 'Cancel')
298+ }, i18n.__('Cancel'))
297299 ]
298300 }
299301 })
300302 }
modules/page/html/render/public.jsView
@@ -116,9 +116,9 @@
116116 return [
117117 h('button -pub -full', {
118118 'ev-click': api.invite.sheet
119119 }, i18n.__('+ Join Pub')),
120- when(loading, [ h(i18n.__("Loading")) ], [
120+ when(loading, [ h("Loading") ], [
121121 when(computed(channels, x => x.length), h('h2', i18n.__("Active Channels"))),
122122 h('div', {
123123 classList: 'ChannelList',
124124 hidden: loading
modules/page/html/render/search.jsView
@@ -6,8 +6,10 @@
66 var Scroller = require('../../../../lib/scroller')
77 var nextStepper = require('../../../../lib/next-stepper')
88 var nest = require('depnest')
99 var Proxy = require('mutant/proxy')
10+var appRoot = require('app-root-path')
11+var i18n = require(appRoot + '/lib/i18n').i18n
1012
1113 exports.needs = nest({
1214 'sbot.pull.stream': 'first',
1315 'keys.sync.id': 'first',
@@ -28,13 +30,13 @@
2830 var updates = Value(0)
2931 var aborter = null
3032
3133 const searchHeader = h('div', {className: 'PageHeading'}, [
32- h('h1', [h('strong', 'Search Results:'), ' ', query.join(' ')])
34+ h('h1', [h('strong', i18n.__('Search Results:')), ' ', query.join(' ')])
3335 ])
3436
3537 var updateLoader = h('a Notifier -loader', { href: '#', 'ev-click': refresh }, [
36- 'Show ', h('strong', [updates]), ' ', plural(updates, 'update', 'updates')
38+ 'Show ', h('strong', [updates]), ' ', plural(updates, i18n.__('update'), i18n.__('updates'))
3739 ])
3840
3941 var content = Proxy()
4042 var container = h('Scroller', {
@@ -48,9 +50,9 @@
4850 style: {
4951 'padding': '60px 0',
5052 'font-size': '150%'
5153 }
52- }, [h('strong', 'Search completed.'), ' ', count, ' ', plural(count, 'result', 'results'), ' found']))
54+ }, [h('strong', i18n.__('Search completed.')), ' ', count, ' ', plural(count, i18n.__('result found'), i18n.__('results found'))]))
5355 ])
5456 ])
5557 ])
5658
modules/page/html/render/settings.jsView
@@ -1,6 +1,8 @@
11 var { h, computed } = require('mutant')
22 var nest = require('depnest')
3+var appRoot = require('app-root-path')
4+var i18n = require(appRoot + '/lib/i18n').i18n
35
46 var themeNames = Object.keys(require('../../../../styles'))
57
68 exports.needs = nest({
@@ -19,41 +21,46 @@
1921
2022 var prepend = [
2123 h('PageHeading', [
2224 h('h1', [
23- h('strong', 'Settings')
24- ])
25+ h('strong', i18n.__('Settings'))
26+ ]),
2527 ])
2628 ]
2729
2830 return h('Scroller', { style: { overflow: 'auto' } }, [
2931 h('div.wrapper', [
3032 h('section.prepend', prepend),
3133 h('section.content', [
3234 h('section', [
33- h('h2', 'Theme'),
34- h('select', {
35- style: {
36- 'font-size': '120%'
37- },
38- value: currentTheme,
39- 'ev-change': (ev) => api.settings.sync.set({
40- patchwork: {theme: ev.target.value}
35+ h('h2', i18n.__('Theme')),
36+ computed(currentTheme, currentTheme => {
37+ return themeNames.map(name => {
38+ const style = currentTheme == name
39+ ? { 'margin-right': '1rem', 'border-color': 'teal' }
40+ : { 'margin-right': '1rem' }
41+
42+ return h('button', {
43+ 'ev-click': () => api.settings.sync.set({
44+ patchwork: {theme: name}
45+ }),
46+ style
47+ }, name)
4148 })
4249 }, [
4350 themeNames.map(name => h('option', {value: name}, [name]))
4451 ])
4552 ]),
4653 h('section', [
47- h('h2', 'Filters'),
54+ h('h2', i18n.__('Filters')),
4855 h('label', [
4956 h('input', {
5057 type: 'checkbox',
5158 checked: filterFollowing,
5259 'ev-change': (ev) => api.settings.sync.set({
5360 filters: {following: ev.target.checked}
5461 })
55- }), ' Hide following messages'
62+ }), i18n.__(' Hide following messages')
5663 ])
5764 ])
5865 ])
5966 ])
modules/profile/sheet/edit.jsView
@@ -1,7 +1,9 @@
11 var nest = require('depnest')
22 var extend = require('xtend')
33 var {Value, h, computed, when} = require('mutant')
4+var appRoot = require('app-root-path')
5+var i18n = require(appRoot + '/lib/i18n').i18n
46 var fallbackImageUrl = 'data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='
57
68 exports.gives = nest('profile.sheet.edit')
79
@@ -44,17 +46,17 @@
4446 h('h2', {
4547 style: {
4648 'font-weight': 'normal'
4749 }
48- }, ['Your Profile']),
50+ }, [i18n.__('Your Profile')]),
4951 h('ProfileEditor', [
5052 h('div.side', [
5153 h('ImageInput', [
5254 h('img', {
5355 style: { 'background-color': api.about.obs.color(id) },
5456 src: computed(chosenImage, (id) => id ? api.blob.sync.url(id) : fallbackImageUrl)
5557 }),
56- h('span', ['๐Ÿ–ผ Choose Profile Image...']),
58+ h('span', ['๐Ÿ–ผ ', i18n.__('Choose Profile Image...')]),
5759 api.blob.html.input(file => {
5860 chosenImage.set(file.link)
5961 }, {
6062 accept: 'image/*',
@@ -63,13 +65,13 @@
6365 ])
6466 ]),
6567 h('div.main', [
6668 h('input.name', {
67- placeholder: 'Choose a name',
69+ placeholder: i18n.__('Choose a name'),
6870 hooks: [ValueHook(chosenName), FocusHook()]
6971 }),
7072 h('textarea.description', {
71- placeholder: 'Describe yourself (if you want)',
73+ placeholder: i18n.__('Describe yourself (if you want)'),
7274 hooks: [ValueHook(chosenDescription)]
7375 })
7476 ])
7577 ])
@@ -77,12 +79,12 @@
7779 footer: [
7880 h('button -save', {
7981 'ev-click': save,
8082 'disabled': publishing
81- }, when(publishing, 'Publishing...', 'Publish')),
83+ }, when(publishing, i18n.__('Publishing...'), i18n.__('Publish'))),
8284 h('button -cancel', {
8385 'ev-click': close
84- }, 'Cancel')
86+ }, i18n.__('Cancel'))
8587 ]
8688 }
8789
8890 function save () {
@@ -103,11 +105,11 @@
103105 if (err) {
104106 publishing.set(false)
105107 showDialog({
106108 type: 'error',
107- title: 'Error',
108- buttons: ['OK'],
109- message: 'An error occurred while attempting to publish about message.',
109+ title: i18n.__('Error'),
110+ buttons: [i18n.__('OK')],
111+ message: i18n.__('An error occurred while attempting to publish about message.'),
110112 detail: err.message
111113 })
112114 } else {
113115 close()
plugs/message/html/layout/default.jsView
@@ -1,7 +1,9 @@
11 const { h, map, computed } = require('mutant')
22 var nest = require('depnest')
33 var ref = require('ssb-ref')
4+var appRoot = require('app-root-path')
5+var i18n = require(appRoot + '/lib/i18n').i18n
46
57 exports.needs = nest({
68 'profile.html.person': 'first',
79 'message.obs.backlinks': 'first',
@@ -32,13 +34,13 @@
3234 classList.push('-reply')
3335 var branch = msg.value.content.branch
3436 if (branch) {
3537 if (!previousId || (previousId && last(branch) && previousId !== last(branch))) {
36- replyInfo = h('span', ['in reply to ', api.message.html.link(last(branch))])
38+ replyInfo = h('span', [i18n.__('in reply to '), api.message.html.link(last(branch))])
3739 }
3840 }
3941 } else if (msg.value.content.project) {
40- replyInfo = h('span', ['on ', api.message.html.link(msg.value.content.project)])
42+ replyInfo = h('span', [i18n.__('on '), api.message.html.link(msg.value.content.project)])
4143 }
4244
4345 if (priority === 2) {
4446 classList.push('-new')
@@ -65,9 +67,9 @@
6567
6668 function messageHeader (msg, {replyInfo, priority}) {
6769 var additionalMeta = []
6870 if (priority >= 2) {
69- additionalMeta.push(h('span.flag -new', {title: 'New Message'}))
71+ additionalMeta.push(h('span.flag -new', {title: i18n.__('New Message')}))
7072 }
7173 return h('header', [
7274 h('div.main', [
7375 h('a.avatar', {href: `${msg.value.author}`}, [
plugs/message/html/render/about.jsView
@@ -2,8 +2,10 @@
22 var computed = require('mutant/computed')
33 var nest = require('depnest')
44 var extend = require('xtend')
55 var ref = require('ssb-ref')
6+var appRoot = require('app-root-path');
7+var i18n = require(appRoot + '/lib/i18n').i18n
68
79 exports.needs = nest({
810 'message.html': {
911 decorate: 'reduce',
@@ -32,20 +34,20 @@
3234 if (c.name) {
3335 var target = api.profile.html.person(c.about, c.name)
3436 miniContent.push(computed([self, api.about.obs.name(c.about), c.name], (self, a, b) => {
3537 if (self) {
36- return ['self identifies as "', target, '"']
38+ return [i18n.__('self identifies as "'), target, '"']
3739 } else if (a === b) {
38- return ['identified ', api.profile.html.person(c.about)]
40+ return [i18n.__('identified '), api.profile.html.person(c.about)]
3941 } else {
40- return ['identifies ', api.profile.html.person(c.about), ' as "', target, '"']
42+ return [i18n.__('identifies '), api.profile.html.person(c.about), i18n.__(' as "'), target, '"']
4143 }
4244 }))
4345 }
4446
4547 if (c.image) {
4648 if (!miniContent.length) {
47- var imageAction = self ? 'self assigned a display image' : ['assigned a display image to ', api.profile.html.person(c.about)]
49+ var imageAction = self ? i18n.__('self assigned a display image') : [i18n.__('assigned a display image to '), api.profile.html.person(c.about)]
4850 miniContent.push(imageAction)
4951 }
5052
5153 content.push(h('a AboutImage', {
@@ -69,9 +71,9 @@
6971
7072 if (c.description) {
7173 elements.push(api.message.html.decorate(api.message.html.layout(msg, extend({
7274 showActions: true,
73- miniContent: self ? 'self assigned a description' : ['assigned a description to ', api.profile.html.person(c.about)],
75+ miniContent: self ? i18n.__('self assigned a description') : [i18n.__('assigned a description to '), api.profile.html.person(c.about)],
7476 content: api.message.html.markdown(c.description),
7577 layout: 'mini'
7678 }, opts)), { msg }))
7779 }
plugs/message/html/render/channel.jsView
@@ -1,7 +1,9 @@
11 var h = require('mutant/h')
22 var nest = require('depnest')
33 var extend = require('xtend')
4+var appRoot = require('app-root-path');
5+var i18n = require(appRoot + '/lib/i18n').i18n
46
57 exports.needs = nest({
68 'message.html': {
79 decorate: 'reduce',
@@ -25,9 +27,9 @@
2527 function messageContent (msg) {
2628 var channel = `#${msg.value.content.channel}`
2729 var subscribed = msg.value.content.subscribed
2830 return [
29- subscribed ? 'subscribed to ' : 'unsubscribed from ',
31+ subscribed ? i18n.__('subscribed to ') : i18n.__('unsubscribed from '),
3032 h('a', {href: channel}, channel)
3133 ]
3234 }
3335 }
plugs/message/html/render/following.jsView
@@ -1,8 +1,10 @@
11 var h = require('mutant/h')
22 var nest = require('depnest')
33 var extend = require('xtend')
44 var ref = require('ssb-ref')
5+var appRoot = require('app-root-path');
6+var i18n = require(appRoot + '/lib/i18n').i18n
57
68 exports.needs = nest({
79 'message.html': {
810 decorate: 'reduce',
@@ -29,9 +31,9 @@
2931
3032 function messageContent (msg) {
3133 var following = msg.value.content.following
3234 return [
33- following ? 'followed ' : 'unfollowed ',
35+ following ? i18n.__('followed ') : i18n.__('unfollowed '),
3436 api.profile.html.person(msg.value.content.contact)
3537 ]
3638 }
3739 }

Built with git-ssb-web