Commit e5ad753b8414d998113f9305e0826f4cf1035fe4
Add strings to i18n
Marcos Gutierrez committed on 9/29/2017, 1:03:10 PMParent: 105aa7594db658635444cb37cc121c3952b8216b
Files changed
main-window.js | ||
---|---|---|
@@ -94,14 +94,14 @@ | ||
94 | 94 | ]), |
95 | 95 | h('span.nav', [ |
96 | 96 | tab(i18n.__("Public"), '/public'), |
97 | 97 | tab(i18n.__("Private"), '/private'), |
98 | - dropTab('More', [ | |
98 | + dropTab(i18n.__('More'), [ | |
99 | 99 | getSubscribedChannelMenu, |
100 | - ['Gatherings', '/gatherings'], | |
101 | - ['Extended Network', '/all'], | |
100 | + [i18n.__('Gatherings'), '/gatherings'], | |
101 | + [i18n.__('Extended Network'), '/all'], | |
102 | 102 | {separator: true}, |
103 | - ['Settings', '/settings'] | |
103 | + [i18n.__('Settings'), '/settings'] | |
104 | 104 | ]) |
105 | 105 | ]), |
106 | 106 | h('span.appTitle', [ |
107 | 107 | h('span.title', i18n.__("Patchwork")), |
@@ -115,9 +115,9 @@ | ||
115 | 115 | ]), |
116 | 116 | when(latestUpdate, |
117 | 117 | h('div.info', [ |
118 | 118 | 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!'), | |
120 | 120 | h('a.ignore', {'ev-click': latestUpdate.ignore}, 'X') |
121 | 121 | ]) |
122 | 122 | ]) |
123 | 123 | ), |
@@ -151,11 +151,11 @@ | ||
151 | 151 | var channels = Array.from(subscribedChannels()).sort(localeCompare) |
152 | 152 | |
153 | 153 | if (channels.length) { |
154 | 154 | return { |
155 | - label: 'Channels', | |
155 | + label: i18n.__('Channels'), | |
156 | 156 | submenu: [ |
157 | - { label: 'Browse All', | |
157 | + { label: i18n.__('Browse All'), | |
158 | 158 | click () { |
159 | 159 | setView('/channels') |
160 | 160 | } |
161 | 161 | }, |
@@ -170,9 +170,9 @@ | ||
170 | 170 | })) |
171 | 171 | } |
172 | 172 | } else { |
173 | 173 | return { |
174 | - label: 'Browse Channels', | |
174 | + label: i18n.__('Browse Channels'), | |
175 | 175 | click () { |
176 | 176 | setView('/channels') |
177 | 177 | } |
178 | 178 | } |
modules/app/html/progress-notifier.js | ||
---|---|---|
@@ -1,8 +1,9 @@ | ||
1 | 1 | var {computed, when, h, Value} = require('mutant') |
2 | 2 | var nest = require('depnest') |
3 | 3 | 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 | |
5 | 6 | |
6 | 7 | exports.gives = nest('app.html.progressNotifier') |
7 | 8 | |
8 | 9 | exports.needs = nest({ |
@@ -45,17 +46,15 @@ | ||
45 | 46 | |
46 | 47 | return h('div.info', { hidden }, [ |
47 | 48 | h('div.status', [ |
48 | 49 | 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...')) | |
58 | 57 | ) |
59 | 58 | ) |
60 | 59 | ])) |
61 | 60 | ]) |
modules/feed/html/rollup.js | ||
---|---|---|
@@ -6,23 +6,23 @@ | ||
6 | 6 | var nextStepper = require('../../../lib/next-stepper') |
7 | 7 | var extend = require('xtend') |
8 | 8 | var paramap = require('pull-paramap') |
9 | 9 | |
10 | +var appRoot = require('app-root-path'); | |
11 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
12 | + | |
10 | 13 | 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') | |
16 | 19 | } |
17 | 20 | |
18 | 21 | // bump even for first message |
19 | 22 | var rootBumpTypes = ['mention', 'channel-mention'] |
20 | 23 | |
21 | -var appRoot = require('app-root-path'); | |
22 | -var i18n = require(appRoot + '/lib/i18n').i18n | |
23 | 24 | |
24 | - | |
25 | 25 | exports.needs = nest({ |
26 | 26 | 'about.obs.name': 'first', |
27 | 27 | 'app.sync.externalHandler': 'first', |
28 | 28 | 'message.html.render': 'first', |
@@ -209,9 +209,9 @@ | ||
209 | 209 | meta, |
210 | 210 | renderedMessage, |
211 | 211 | when(replyElements.length, [ |
212 | 212 | 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, ')']) | |
214 | 214 | ), |
215 | 215 | h('div.replies', replyElements) |
216 | 216 | ]) |
217 | 217 | ]) |
modules/gathering/sheet/edit.js | ||
---|---|---|
@@ -1,8 +1,10 @@ | ||
1 | 1 | var nest = require('depnest') |
2 | 2 | var extend = require('xtend') |
3 | 3 | var Pickr = require('flatpickr') |
4 | 4 | var spacetime = require('spacetime') |
5 | +var appRoot = require('app-root-path'); | |
6 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
5 | 7 | |
6 | 8 | var {Value, h, computed, when} = require('mutant') |
7 | 9 | |
8 | 10 | exports.gives = nest('gathering.sheet.edit') |
@@ -52,44 +54,44 @@ | ||
52 | 54 | h('h2', { |
53 | 55 | style: { |
54 | 56 | 'font-weight': 'normal' |
55 | 57 | } |
56 | - }, [id ? 'Edit' : 'Create', ' Gathering']), | |
58 | + }, [id ? i18n.__('Edit') : i18n.__('Create'), i18n.__(' Gathering')]), | |
57 | 59 | h('GatheringEditor', [ |
58 | 60 | h('input.title', { |
59 | - placeholder: 'Choose a title', | |
61 | + placeholder: i18n.__('Choose a title'), | |
60 | 62 | hooks: [ValueHook(chosen.title), FocusHook()] |
61 | 63 | }), |
62 | 64 | h('input.date', { |
63 | - placeholder: 'Choose date and time', | |
65 | + placeholder: i18n.__('Choose date and time'), | |
64 | 66 | hooks: [ |
65 | 67 | PickrHook(chosen.startDateTime) |
66 | 68 | ] |
67 | 69 | }), |
68 | 70 | h('ImageInput .banner', { |
69 | 71 | style: { 'background-image': computed(imageUrl, x => `url(${x})`) } |
70 | 72 | }, [ |
71 | - h('span', ['๐ผ Choose Banner Image...']), | |
73 | + h('span', ['๐ผ ', i18n.__('Choose Banner Image...')]), | |
72 | 74 | api.blob.html.input(file => { |
73 | 75 | chosen.image.set(file) |
74 | 76 | }, { |
75 | 77 | accept: 'image/*' |
76 | 78 | }) |
77 | 79 | ]), |
78 | 80 | h('textarea.description', { |
79 | - placeholder: 'Describe the gathering (if you want)', | |
81 | + placeholder: i18n.__('Describe the gathering (if you want)'), | |
80 | 82 | hooks: [ValueHook(chosen.description)] |
81 | 83 | }) |
82 | 84 | ]) |
83 | 85 | ]), |
84 | 86 | footer: [ |
85 | 87 | h('button -save', { |
86 | 88 | 'ev-click': save, |
87 | 89 | 'disabled': publishing |
88 | - }, when(publishing, 'Publishing...', 'Publish')), | |
90 | + }, when(publishing, i18n.__('Publishing...'), i18n.__('Publish'))), | |
89 | 91 | h('button -cancel', { |
90 | 92 | 'ev-click': close |
91 | - }, 'Cancel') | |
93 | + }, i18n.__('Cancel')) | |
92 | 94 | ] |
93 | 95 | } |
94 | 96 | |
95 | 97 | function ensureExists (cb) { |
@@ -110,9 +112,9 @@ | ||
110 | 112 | var update = {} |
111 | 113 | |
112 | 114 | if (!compareImage(chosen.image(), current.image())) update.image = chosen.image() |
113 | 115 | 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') | |
115 | 117 | if (chosen.description() !== current.description()) update.description = chosen.description() |
116 | 118 | |
117 | 119 | if (Object.keys(update).length) { |
118 | 120 | publishing.set(true) |
@@ -125,11 +127,11 @@ | ||
125 | 127 | if (err) { |
126 | 128 | publishing.set(false) |
127 | 129 | showDialog({ |
128 | 130 | type: 'error', |
129 | - title: 'Error', | |
131 | + title: i18n.__('Error'), | |
130 | 132 | buttons: ['OK'], |
131 | - message: 'An error occurred while attempting to publish gathering.', | |
133 | + message: i18n.__('An error occurred while attempting to publish gathering.'), | |
132 | 134 | detail: err.message |
133 | 135 | }) |
134 | 136 | } else { |
135 | 137 | close() |
modules/invite/sheet.js | ||
---|---|---|
@@ -1,8 +1,11 @@ | ||
1 | 1 | var {h, when, Value, Proxy} = require('mutant') |
2 | 2 | var nest = require('depnest') |
3 | 3 | var electron = require('electron') |
4 | 4 | |
5 | +var appRoot = require('app-root-path'); | |
6 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
7 | + | |
5 | 8 | exports.needs = nest({ |
6 | 9 | 'sheet.display': 'first', |
7 | 10 | 'invite.async.accept': 'first' |
8 | 11 | }) |
@@ -20,9 +23,9 @@ | ||
20 | 23 | 'font-size': '200%', |
21 | 24 | 'margin-top': '20px', |
22 | 25 | 'width': '100%' |
23 | 26 | }, |
24 | - placeholder: 'paste invite code here' | |
27 | + placeholder: i18n.__('paste invite code here') | |
25 | 28 | }) |
26 | 29 | setTimeout(() => { |
27 | 30 | input.focus() |
28 | 31 | input.select() |
@@ -36,11 +39,11 @@ | ||
36 | 39 | h('h2', { |
37 | 40 | style: { |
38 | 41 | 'font-weight': 'normal' |
39 | 42 | } |
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.')]), | |
41 | 44 | 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.') | |
43 | 46 | ]), |
44 | 47 | input |
45 | 48 | ]), |
46 | 49 | footer: [ |
@@ -52,22 +55,22 @@ | ||
52 | 55 | if (err) { |
53 | 56 | publishing.set(false) |
54 | 57 | showDialog({ |
55 | 58 | 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.'), | |
59 | 62 | detail: err.message |
60 | 63 | }) |
61 | 64 | } else { |
62 | 65 | close() |
63 | 66 | } |
64 | 67 | })) |
65 | 68 | } |
66 | - }, [ when(publishing, publishStatus, 'Redeem Invite') ]), | |
69 | + }, [ when(publishing, publishStatus, i18n.__('Redeem Invite')) ]), | |
67 | 70 | h('button -cancel', { |
68 | 71 | 'ev-click': close |
69 | - }, 'Cancel') | |
72 | + }, i18n.__('Cancel')) | |
70 | 73 | ] |
71 | 74 | } |
72 | 75 | }) |
73 | 76 | }) |
modules/message/async/publish.js | ||
---|---|---|
@@ -1,7 +1,11 @@ | ||
1 | 1 | var h = require('mutant/h') |
2 | 2 | var nest = require('depnest') |
3 | +var i18n = require('i18n') | |
3 | 4 | |
5 | +var appRoot = require('app-root-path') | |
6 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
7 | + | |
4 | 8 | exports.needs = nest({ |
5 | 9 | 'sheet.display': 'first', |
6 | 10 | 'message.html.render': 'first', |
7 | 11 | 'sbot.async.publish': 'first', |
@@ -21,10 +25,10 @@ | ||
21 | 25 | author: api.keys.sync.id() |
22 | 26 | }}) |
23 | 27 | ], |
24 | 28 | 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')) | |
27 | 31 | ] |
28 | 32 | } |
29 | 33 | |
30 | 34 | function publish () { |
modules/message/html/backlinks.js | ||
---|---|---|
@@ -1,7 +1,9 @@ | ||
1 | 1 | var nest = require('depnest') |
2 | 2 | var ref = require('ssb-ref') |
3 | 3 | var { h, map, computed } = require('mutant') |
4 | +var appRoot = require('app-root-path') | |
5 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
4 | 6 | |
5 | 7 | exports.needs = nest({ |
6 | 8 | 'message.obs': { |
7 | 9 | backlinks: 'first', |
@@ -24,9 +26,9 @@ | ||
24 | 26 | return h('a.backlink', { |
25 | 27 | href: link.id, title: link.id |
26 | 28 | }, [ |
27 | 29 | h('strong', [ |
28 | - api.profile.html.person(link.author), ' forked this discussion:' | |
30 | + api.profile.html.person(link.author), i18n.__(' forked this discussion:') | |
29 | 31 | ]), ' ', |
30 | 32 | api.message.obs.name(link.id) |
31 | 33 | ]) |
32 | 34 | }), |
@@ -34,9 +36,9 @@ | ||
34 | 36 | return h('a.backlink', { |
35 | 37 | href: link.id, title: link.id |
36 | 38 | }, [ |
37 | 39 | h('strong', [ |
38 | - api.profile.html.person(link.author), ' referenced this message:' | |
40 | + api.profile.html.person(link.author), i18n.__(' referenced this message:') | |
39 | 41 | ]), ' ', |
40 | 42 | api.message.obs.name(link.id) |
41 | 43 | ]) |
42 | 44 | }) |
modules/page/html/render/all.js | ||
---|---|---|
@@ -1,6 +1,8 @@ | ||
1 | 1 | var nest = require('depnest') |
2 | 2 | var { h } = require('mutant') |
3 | +var appRoot = require('app-root-path') | |
4 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
3 | 5 | |
4 | 6 | exports.needs = nest({ |
5 | 7 | 'feed.pull.public': 'first', |
6 | 8 | 'message.html.compose': 'first', |
@@ -20,13 +22,13 @@ | ||
20 | 22 | |
21 | 23 | var prepend = [ |
22 | 24 | h('PageHeading', [ |
23 | 25 | h('h1', [ |
24 | - 'All Posts from Your ', | |
25 | - h('strong', 'Extended Network') | |
26 | + i18n.__('All Posts from Your '), | |
27 | + h('strong', i18n.__('Extended Network')) | |
26 | 28 | ]) |
27 | 29 | ]), |
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') }) | |
29 | 31 | ] |
30 | 32 | |
31 | 33 | var feedView = api.feed.html.rollup(api.feed.pull.public, { |
32 | 34 | bumpFilter: (msg) => { |
modules/page/html/render/channel.js | ||
---|---|---|
@@ -1,6 +1,8 @@ | ||
1 | 1 | var { h, when, send } = require('mutant') |
2 | 2 | var nest = require('depnest') |
3 | +var appRoot = require('app-root-path') | |
4 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
3 | 5 | |
4 | 6 | exports.needs = nest({ |
5 | 7 | 'channel.obs.subscribed': 'first', |
6 | 8 | 'message.html.compose': 'first', |
@@ -26,21 +28,21 @@ | ||
26 | 28 | h('div.meta', [ |
27 | 29 | when(subscribedChannels.has(channel), |
28 | 30 | h('a.ToggleButton.-unsubscribe', { |
29 | 31 | 'href': '#', |
30 | - 'title': 'Click to unsubscribe', | |
32 | + 'title': i18n.__('Click to unsubscribe'), | |
31 | 33 | 'ev-click': send(unsubscribe, channel) |
32 | - }, 'Subscribed'), | |
34 | + }, i18n.__('Subscribed')), | |
33 | 35 | h('a.ToggleButton.-subscribe', { |
34 | 36 | 'href': '#', |
35 | 37 | 'ev-click': send(subscribe, channel) |
36 | - }, 'Subscribe') | |
38 | + }, i18n.__('Subscribe')) | |
37 | 39 | ) |
38 | 40 | ]) |
39 | 41 | ]), |
40 | 42 | api.message.html.compose({ |
41 | 43 | 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') | |
43 | 45 | }) |
44 | 46 | ] |
45 | 47 | |
46 | 48 | return api.feed.html.rollup(api.feed.pull.channel(channel), { |
modules/page/html/render/channels.js | ||
---|---|---|
@@ -1,6 +1,8 @@ | ||
1 | 1 | var nest = require('depnest') |
2 | 2 | var { h, send, when, computed, map } = require('mutant') |
3 | +var appRoot = require('app-root-path') | |
4 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
3 | 5 | |
4 | 6 | exports.needs = nest({ |
5 | 7 | 'message.async.publish': 'first', |
6 | 8 | 'keys.sync.id': 'first', |
@@ -38,12 +40,12 @@ | ||
38 | 40 | h('span.name', '#' + channel), |
39 | 41 | when(subscribed, |
40 | 42 | h('a.-unsubscribe', { |
41 | 43 | 'ev-click': send(unsubscribe, channel) |
42 | - }, 'Unsubscribe'), | |
44 | + }, i18n.__('Unsubscribe')), | |
43 | 45 | h('a.-subscribe', { |
44 | 46 | 'ev-click': send(subscribe, channel) |
45 | - }, 'Subscribe') | |
47 | + }, i18n.__('Subscribe')) | |
46 | 48 | ) |
47 | 49 | ]) |
48 | 50 | }, {maxTime: 5, idle: true}) |
49 | 51 | ]) |
modules/page/html/render/gatherings.js | ||
---|---|---|
@@ -1,6 +1,8 @@ | ||
1 | 1 | var { h } = require('mutant') |
2 | 2 | var nest = require('depnest') |
3 | +var appRoot = require('app-root-path') | |
4 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
3 | 5 | |
4 | 6 | exports.needs = nest({ |
5 | 7 | 'feed.pull.type': 'first', |
6 | 8 | 'feed.html.rollup': 'first', |
@@ -21,13 +23,13 @@ | ||
21 | 23 | var following = api.contact.obs.following(id) |
22 | 24 | |
23 | 25 | var prepend = [ |
24 | 26 | h('PageHeading', [ |
25 | - h('h1', [h('strong', 'Gatherings'), ' from your extended network']), | |
27 | + h('h1', [h('strong', i18n.__('Gatherings')), i18n.__(' from your extended network')]), | |
26 | 28 | h('div.meta', [ |
27 | 29 | h('button -add', { |
28 | 30 | 'ev-click': createGathering |
29 | - }, '+ Add Gathering') | |
31 | + }, i18n.__('+ Add Gathering')) | |
30 | 32 | ]) |
31 | 33 | ]) |
32 | 34 | ] |
33 | 35 |
modules/page/html/render/message.js | ||
---|---|---|
@@ -1,9 +1,9 @@ | ||
1 | 1 | var { h, when, map, Proxy, Struct, Value, computed } = require('mutant') |
2 | 2 | var nest = require('depnest') |
3 | 3 | var ref = require('ssb-ref') |
4 | 4 | |
5 | -var appRoot = require('app-root-path'); | |
5 | +var appRoot = require('app-root-path') | |
6 | 6 | var i18n = require(appRoot + '/lib/i18n').i18n |
7 | 7 | |
8 | 8 | exports.needs = nest({ |
9 | 9 | 'keys.sync.id': 'first', |
@@ -51,9 +51,9 @@ | ||
51 | 51 | } |
52 | 52 | |
53 | 53 | if (!value) { |
54 | 54 | return result.set(h('PageHeading', [ |
55 | - h('h1', 'Cannot display message.') | |
55 | + h('h1', i18n.__('Cannot display message.')) | |
56 | 56 | ])) |
57 | 57 | } |
58 | 58 | |
59 | 59 | // what happens in private stays in private! |
modules/page/html/render/private.js | ||
---|---|---|
@@ -1,6 +1,8 @@ | ||
1 | 1 | var nest = require('depnest') |
2 | 2 | var ref = require('ssb-ref') |
3 | +var appRoot = require('app-root-path') | |
4 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
3 | 5 | |
4 | 6 | exports.needs = nest({ |
5 | 7 | 'feed.html.rollup': 'first', |
6 | 8 | 'feed.pull.private': 'first', |
@@ -23,9 +25,9 @@ | ||
23 | 25 | return ref.isFeed(typeof e === 'string' ? e : e.link) |
24 | 26 | }) |
25 | 27 | return msg |
26 | 28 | }, |
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') | |
28 | 30 | }) |
29 | 31 | ] |
30 | 32 | |
31 | 33 | return api.feed.html.rollup(api.feed.pull.private, { prepend }) |
modules/page/html/render/profile.js | ||
---|---|---|
@@ -1,8 +1,10 @@ | ||
1 | 1 | var nest = require('depnest') |
2 | 2 | var ref = require('ssb-ref') |
3 | 3 | var {h, when, computed, map, send, dictToCollection, resolve} = require('mutant') |
4 | 4 | var extend = require('xtend') |
5 | +var appRoot = require('app-root-path') | |
6 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
5 | 7 | |
6 | 8 | exports.needs = nest({ |
7 | 9 | 'about.obs': { |
8 | 10 | name: 'first', |
@@ -83,9 +85,9 @@ | ||
83 | 85 | classList: [ |
84 | 86 | when(isSelf, '-self'), |
85 | 87 | when(isAssigned, '-assigned') |
86 | 88 | ], |
87 | - title: nameList(when(isSelf, 'Self Assigned', 'Assigned By'), item.value) | |
89 | + title: nameList(when(isSelf, i18n.__('Self Assigned'), i18n.__('Assigned By')), item.value) | |
88 | 90 | }, [ |
89 | 91 | item.key |
90 | 92 | ]) |
91 | 93 | }), |
@@ -111,9 +113,9 @@ | ||
111 | 113 | classList: [ |
112 | 114 | when(isSelf, '-self'), |
113 | 115 | when(isAssigned, '-assigned') |
114 | 116 | ], |
115 | - title: nameList(when(isSelf, 'Self Assigned', 'Assigned By'), item.value) | |
117 | + title: nameList(when(isSelf, i18n.__('Self Assigned'), i18n.__('Assigned By')), item.value) | |
116 | 118 | }, [ |
117 | 119 | h('img', { |
118 | 120 | className: 'Avatar', |
119 | 121 | style: { 'background-color': api.about.obs.color(id) }, |
@@ -137,20 +139,20 @@ | ||
137 | 139 | h('div.title', [ |
138 | 140 | h('h1', [name]), |
139 | 141 | h('div.meta', [ |
140 | 142 | 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')) | |
142 | 144 | ], [ |
143 | 145 | when(youFollow, |
144 | 146 | h('a.ToggleButton.-unsubscribe', { |
145 | 147 | 'href': '#', |
146 | - 'title': 'Click to unfollow', | |
148 | + 'title': i18n.__('Click to unfollow'), | |
147 | 149 | 'ev-click': send(unfollow, id) |
148 | - }, when(isFriends, 'Friends', 'Following')), | |
150 | + }, when(isFriends, i18n.__('Friends'), i18n.__('Following'))), | |
149 | 151 | h('a.ToggleButton.-subscribe', { |
150 | 152 | 'href': '#', |
151 | 153 | 'ev-click': send(follow, id) |
152 | - }, when(followsYou, 'Follow Back', 'Follow')) | |
154 | + }, when(followsYou, i18n.__('Follow Back'), i18n.__('Follow'))) | |
153 | 155 | ) |
154 | 156 | ]) |
155 | 157 | ]) |
156 | 158 | ]), |
@@ -177,11 +179,11 @@ | ||
177 | 179 | ]), |
178 | 180 | h('div.side.-right', [ |
179 | 181 | when(friendsLoaded, |
180 | 182 | 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) | |
184 | 186 | ]), |
185 | 187 | h('div', {className: 'Loading'}) |
186 | 188 | ) |
187 | 189 | ]) |
@@ -273,9 +275,9 @@ | ||
273 | 275 | h('h2', { |
274 | 276 | style: { |
275 | 277 | 'font-weight': 'normal' |
276 | 278 | } |
277 | - }, ['What whould you like to call ', h('strong', [currentName]), '?']), | |
279 | + }, [i18n.__('What whould you like to call '), h('strong', [currentName]), '?']), | |
278 | 280 | input |
279 | 281 | ]), |
280 | 282 | footer: [ |
281 | 283 | h('button -save', { |
@@ -289,12 +291,12 @@ | ||
289 | 291 | }) |
290 | 292 | } |
291 | 293 | close() |
292 | 294 | } |
293 | - }, 'Confirm'), | |
295 | + }, i18n.__('Confirm')), | |
294 | 296 | h('button -cancel', { |
295 | 297 | 'ev-click': close |
296 | - }, 'Cancel') | |
298 | + }, i18n.__('Cancel')) | |
297 | 299 | ] |
298 | 300 | } |
299 | 301 | }) |
300 | 302 | } |
modules/page/html/render/public.js | ||
---|---|---|
@@ -116,9 +116,9 @@ | ||
116 | 116 | return [ |
117 | 117 | h('button -pub -full', { |
118 | 118 | 'ev-click': api.invite.sheet |
119 | 119 | }, i18n.__('+ Join Pub')), |
120 | - when(loading, [ h(i18n.__("Loading")) ], [ | |
120 | + when(loading, [ h("Loading") ], [ | |
121 | 121 | when(computed(channels, x => x.length), h('h2', i18n.__("Active Channels"))), |
122 | 122 | h('div', { |
123 | 123 | classList: 'ChannelList', |
124 | 124 | hidden: loading |
modules/page/html/render/search.js | ||
---|---|---|
@@ -6,8 +6,10 @@ | ||
6 | 6 | var Scroller = require('../../../../lib/scroller') |
7 | 7 | var nextStepper = require('../../../../lib/next-stepper') |
8 | 8 | var nest = require('depnest') |
9 | 9 | var Proxy = require('mutant/proxy') |
10 | +var appRoot = require('app-root-path') | |
11 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
10 | 12 | |
11 | 13 | exports.needs = nest({ |
12 | 14 | 'sbot.pull.stream': 'first', |
13 | 15 | 'keys.sync.id': 'first', |
@@ -28,13 +30,13 @@ | ||
28 | 30 | var updates = Value(0) |
29 | 31 | var aborter = null |
30 | 32 | |
31 | 33 | 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(' ')]) | |
33 | 35 | ]) |
34 | 36 | |
35 | 37 | 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')) | |
37 | 39 | ]) |
38 | 40 | |
39 | 41 | var content = Proxy() |
40 | 42 | var container = h('Scroller', { |
@@ -48,9 +50,9 @@ | ||
48 | 50 | style: { |
49 | 51 | 'padding': '60px 0', |
50 | 52 | 'font-size': '150%' |
51 | 53 | } |
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'))])) | |
53 | 55 | ]) |
54 | 56 | ]) |
55 | 57 | ]) |
56 | 58 |
modules/page/html/render/settings.js | ||
---|---|---|
@@ -1,6 +1,8 @@ | ||
1 | 1 | var { h, computed } = require('mutant') |
2 | 2 | var nest = require('depnest') |
3 | +var appRoot = require('app-root-path') | |
4 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
3 | 5 | |
4 | 6 | var themeNames = Object.keys(require('../../../../styles')) |
5 | 7 | |
6 | 8 | exports.needs = nest({ |
@@ -19,41 +21,46 @@ | ||
19 | 21 | |
20 | 22 | var prepend = [ |
21 | 23 | h('PageHeading', [ |
22 | 24 | h('h1', [ |
23 | - h('strong', 'Settings') | |
24 | - ]) | |
25 | + h('strong', i18n.__('Settings')) | |
26 | + ]), | |
25 | 27 | ]) |
26 | 28 | ] |
27 | 29 | |
28 | 30 | return h('Scroller', { style: { overflow: 'auto' } }, [ |
29 | 31 | h('div.wrapper', [ |
30 | 32 | h('section.prepend', prepend), |
31 | 33 | h('section.content', [ |
32 | 34 | 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) | |
41 | 48 | }) |
42 | 49 | }, [ |
43 | 50 | themeNames.map(name => h('option', {value: name}, [name])) |
44 | 51 | ]) |
45 | 52 | ]), |
46 | 53 | h('section', [ |
47 | - h('h2', 'Filters'), | |
54 | + h('h2', i18n.__('Filters')), | |
48 | 55 | h('label', [ |
49 | 56 | h('input', { |
50 | 57 | type: 'checkbox', |
51 | 58 | checked: filterFollowing, |
52 | 59 | 'ev-change': (ev) => api.settings.sync.set({ |
53 | 60 | filters: {following: ev.target.checked} |
54 | 61 | }) |
55 | - }), ' Hide following messages' | |
62 | + }), i18n.__(' Hide following messages') | |
56 | 63 | ]) |
57 | 64 | ]) |
58 | 65 | ]) |
59 | 66 | ]) |
modules/profile/sheet/edit.js | ||
---|---|---|
@@ -1,7 +1,9 @@ | ||
1 | 1 | var nest = require('depnest') |
2 | 2 | var extend = require('xtend') |
3 | 3 | var {Value, h, computed, when} = require('mutant') |
4 | +var appRoot = require('app-root-path') | |
5 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
4 | 6 | var fallbackImageUrl = 'data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==' |
5 | 7 | |
6 | 8 | exports.gives = nest('profile.sheet.edit') |
7 | 9 | |
@@ -44,17 +46,17 @@ | ||
44 | 46 | h('h2', { |
45 | 47 | style: { |
46 | 48 | 'font-weight': 'normal' |
47 | 49 | } |
48 | - }, ['Your Profile']), | |
50 | + }, [i18n.__('Your Profile')]), | |
49 | 51 | h('ProfileEditor', [ |
50 | 52 | h('div.side', [ |
51 | 53 | h('ImageInput', [ |
52 | 54 | h('img', { |
53 | 55 | style: { 'background-color': api.about.obs.color(id) }, |
54 | 56 | src: computed(chosenImage, (id) => id ? api.blob.sync.url(id) : fallbackImageUrl) |
55 | 57 | }), |
56 | - h('span', ['๐ผ Choose Profile Image...']), | |
58 | + h('span', ['๐ผ ', i18n.__('Choose Profile Image...')]), | |
57 | 59 | api.blob.html.input(file => { |
58 | 60 | chosenImage.set(file.link) |
59 | 61 | }, { |
60 | 62 | accept: 'image/*', |
@@ -63,13 +65,13 @@ | ||
63 | 65 | ]) |
64 | 66 | ]), |
65 | 67 | h('div.main', [ |
66 | 68 | h('input.name', { |
67 | - placeholder: 'Choose a name', | |
69 | + placeholder: i18n.__('Choose a name'), | |
68 | 70 | hooks: [ValueHook(chosenName), FocusHook()] |
69 | 71 | }), |
70 | 72 | h('textarea.description', { |
71 | - placeholder: 'Describe yourself (if you want)', | |
73 | + placeholder: i18n.__('Describe yourself (if you want)'), | |
72 | 74 | hooks: [ValueHook(chosenDescription)] |
73 | 75 | }) |
74 | 76 | ]) |
75 | 77 | ]) |
@@ -77,12 +79,12 @@ | ||
77 | 79 | footer: [ |
78 | 80 | h('button -save', { |
79 | 81 | 'ev-click': save, |
80 | 82 | 'disabled': publishing |
81 | - }, when(publishing, 'Publishing...', 'Publish')), | |
83 | + }, when(publishing, i18n.__('Publishing...'), i18n.__('Publish'))), | |
82 | 84 | h('button -cancel', { |
83 | 85 | 'ev-click': close |
84 | - }, 'Cancel') | |
86 | + }, i18n.__('Cancel')) | |
85 | 87 | ] |
86 | 88 | } |
87 | 89 | |
88 | 90 | function save () { |
@@ -103,11 +105,11 @@ | ||
103 | 105 | if (err) { |
104 | 106 | publishing.set(false) |
105 | 107 | showDialog({ |
106 | 108 | 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.'), | |
110 | 112 | detail: err.message |
111 | 113 | }) |
112 | 114 | } else { |
113 | 115 | close() |
plugs/message/html/layout/default.js | ||
---|---|---|
@@ -1,7 +1,9 @@ | ||
1 | 1 | const { h, map, computed } = require('mutant') |
2 | 2 | var nest = require('depnest') |
3 | 3 | var ref = require('ssb-ref') |
4 | +var appRoot = require('app-root-path') | |
5 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
4 | 6 | |
5 | 7 | exports.needs = nest({ |
6 | 8 | 'profile.html.person': 'first', |
7 | 9 | 'message.obs.backlinks': 'first', |
@@ -32,13 +34,13 @@ | ||
32 | 34 | classList.push('-reply') |
33 | 35 | var branch = msg.value.content.branch |
34 | 36 | if (branch) { |
35 | 37 | 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))]) | |
37 | 39 | } |
38 | 40 | } |
39 | 41 | } 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)]) | |
41 | 43 | } |
42 | 44 | |
43 | 45 | if (priority === 2) { |
44 | 46 | classList.push('-new') |
@@ -65,9 +67,9 @@ | ||
65 | 67 | |
66 | 68 | function messageHeader (msg, {replyInfo, priority}) { |
67 | 69 | var additionalMeta = [] |
68 | 70 | if (priority >= 2) { |
69 | - additionalMeta.push(h('span.flag -new', {title: 'New Message'})) | |
71 | + additionalMeta.push(h('span.flag -new', {title: i18n.__('New Message')})) | |
70 | 72 | } |
71 | 73 | return h('header', [ |
72 | 74 | h('div.main', [ |
73 | 75 | h('a.avatar', {href: `${msg.value.author}`}, [ |
plugs/message/html/render/about.js | ||
---|---|---|
@@ -2,8 +2,10 @@ | ||
2 | 2 | var computed = require('mutant/computed') |
3 | 3 | var nest = require('depnest') |
4 | 4 | var extend = require('xtend') |
5 | 5 | var ref = require('ssb-ref') |
6 | +var appRoot = require('app-root-path'); | |
7 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
6 | 8 | |
7 | 9 | exports.needs = nest({ |
8 | 10 | 'message.html': { |
9 | 11 | decorate: 'reduce', |
@@ -32,20 +34,20 @@ | ||
32 | 34 | if (c.name) { |
33 | 35 | var target = api.profile.html.person(c.about, c.name) |
34 | 36 | miniContent.push(computed([self, api.about.obs.name(c.about), c.name], (self, a, b) => { |
35 | 37 | if (self) { |
36 | - return ['self identifies as "', target, '"'] | |
38 | + return [i18n.__('self identifies as "'), target, '"'] | |
37 | 39 | } else if (a === b) { |
38 | - return ['identified ', api.profile.html.person(c.about)] | |
40 | + return [i18n.__('identified '), api.profile.html.person(c.about)] | |
39 | 41 | } 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, '"'] | |
41 | 43 | } |
42 | 44 | })) |
43 | 45 | } |
44 | 46 | |
45 | 47 | if (c.image) { |
46 | 48 | 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)] | |
48 | 50 | miniContent.push(imageAction) |
49 | 51 | } |
50 | 52 | |
51 | 53 | content.push(h('a AboutImage', { |
@@ -69,9 +71,9 @@ | ||
69 | 71 | |
70 | 72 | if (c.description) { |
71 | 73 | elements.push(api.message.html.decorate(api.message.html.layout(msg, extend({ |
72 | 74 | 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)], | |
74 | 76 | content: api.message.html.markdown(c.description), |
75 | 77 | layout: 'mini' |
76 | 78 | }, opts)), { msg })) |
77 | 79 | } |
plugs/message/html/render/channel.js | ||
---|---|---|
@@ -1,7 +1,9 @@ | ||
1 | 1 | var h = require('mutant/h') |
2 | 2 | var nest = require('depnest') |
3 | 3 | var extend = require('xtend') |
4 | +var appRoot = require('app-root-path'); | |
5 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
4 | 6 | |
5 | 7 | exports.needs = nest({ |
6 | 8 | 'message.html': { |
7 | 9 | decorate: 'reduce', |
@@ -25,9 +27,9 @@ | ||
25 | 27 | function messageContent (msg) { |
26 | 28 | var channel = `#${msg.value.content.channel}` |
27 | 29 | var subscribed = msg.value.content.subscribed |
28 | 30 | return [ |
29 | - subscribed ? 'subscribed to ' : 'unsubscribed from ', | |
31 | + subscribed ? i18n.__('subscribed to ') : i18n.__('unsubscribed from '), | |
30 | 32 | h('a', {href: channel}, channel) |
31 | 33 | ] |
32 | 34 | } |
33 | 35 | } |
plugs/message/html/render/following.js | ||
---|---|---|
@@ -1,8 +1,10 @@ | ||
1 | 1 | var h = require('mutant/h') |
2 | 2 | var nest = require('depnest') |
3 | 3 | var extend = require('xtend') |
4 | 4 | var ref = require('ssb-ref') |
5 | +var appRoot = require('app-root-path'); | |
6 | +var i18n = require(appRoot + '/lib/i18n').i18n | |
5 | 7 | |
6 | 8 | exports.needs = nest({ |
7 | 9 | 'message.html': { |
8 | 10 | decorate: 'reduce', |
@@ -29,9 +31,9 @@ | ||
29 | 31 | |
30 | 32 | function messageContent (msg) { |
31 | 33 | var following = msg.value.content.following |
32 | 34 | return [ |
33 | - following ? 'followed ' : 'unfollowed ', | |
35 | + following ? i18n.__('followed ') : i18n.__('unfollowed '), | |
34 | 36 | api.profile.html.person(msg.value.content.contact) |
35 | 37 | ] |
36 | 38 | } |
37 | 39 | } |
Built with git-ssb-web