git ssb

2+

mixmix / ticktack



Commit b562e05b785dd3f68360267ec1b32b9c9e775278

move all strings into translations

Dominic Tarr committed on 8/16/2017, 4:19:22 AM
Parent: 7cf0304bc911d7894179eec462e0b37166f9535c

Files changed

app/html/app.jschanged
app/page/channel.jschanged
app/page/error.jschanged
app/page/groupFind.jschanged
app/page/groupIndex.jschanged
app/page/groupNew.jschanged
app/page/groupShow.jschanged
app/page/home.jschanged
app/page/settings.jschanged
app/page/threadNew.jschanged
app/page/threadShow.jschanged
app/page/userFind.jschanged
app/page/userShow.jschanged
translations/sync.jschanged
app/html/app.jsView
@@ -2,47 +2,62 @@
22 const values = require('lodash/values')
33 const insertCss = require('insert-css')
44 const openExternal = require('open-external')
55
6-exports.gives = nest('app.html.app')
6+const HyperNav = require('hypernav')
7+const computed = require('mutant/computed')
8+const h = require('mutant/h')
79
10+exports.gives = nest({
11+ 'app.html.app': true,
12+ 'history.obs.location': true,
13+ 'history.sync.push': true,
14+ 'history.sync.back': true,
15+})
16+
817 exports.needs = nest({
918 'app.async.catchLinkClick': 'first',
10- 'history.sync.push': 'first',
11- 'history.obs.location': 'first',
12- 'history.obs.store': 'first',
19+// 'history.sync.push': 'first',
20+// 'history.obs.location': 'first',
21+// 'history.obs.store': 'first',
1322 'router.sync.router': 'first',
1423 'styles.css': 'first'
1524 })
1625
1726 exports.create = (api) => {
18- return nest('app.html.app', app)
1927
20- function app () {
21- const css = values(api.styles.css()).join('\n')
22- insertCss(css)
28+ var nav = HyperNav(api.router.sync.router, function (nav) {
29+ return h('Header', [
30+ h('h1', [
31+ computed(nav.last, function (e) { return e.element.title })
32+ ]),
33+ h('Nav', [
34+ h('div.back', { 'ev-click': nav.back }, '←'),
35+ h('div', { 'ev-click': () => nav.push({page:'home'}) }, 'Home')
36+ ])
37+ ])
38+ })
2339
24- api.app.async.catchLinkClick(document.body, (link, { isExternal }) => {
25- if (isExternal) return openExternal(link)
40+ return nest({
41+ 'app.html.app': function app () {
42+ const css = values(api.styles.css()).join('\n')
43+ insertCss(css)
2644
27- api.history.sync.push(link)
28- })
45+ api.app.async.catchLinkClick(document.body, (link, { isExternal }) => {
46+ if (isExternal) return openExternal(link)
47+ nav.push(link)
48+ })
49+ nav.push({page: 'home'})
50+ document.body.appendChild(nav)
51+ },
52+ 'history.sync.push': (location) => nav.push(location),
53+ 'history.sync.back': () => nav.back(),
54+ 'history.obs.location': () => nav.history,
55+ })
2956
30- api.history.obs.location()(render)
31- api.history.obs.store()(his => console.log('history', his)) // REMOVE)
32- api.history.sync.push({ page: 'home' })
33- }
57+}
3458
35- function render (location) {
36- const newView = api.router.sync.router(location)
3759
38- if (!newView) {
39- api.history.obs.store().pop() // remove bogus location
40- return
41- }
4260
43- const oldView = document.body.firstChild
44- oldView
45- ? document.body.replaceChild(newView, oldView)
46- : document.body.appendChild(newView)
47- }
48-}
61+
62+
63+
app/page/channel.jsView
@@ -62,11 +62,9 @@
6262 return container
6363 }
6464 )
6565
66- return h('Page -home', [
67- h('h1', location.channel),
68- api.app.html.nav(),
66+ return h('Page -home', {title: location.channel}, [
6967 threadsHtmlObs,
7068 h('button', {
7169 'ev-click': threadsHtmlObs.more,
7270 disabled: disableShowMore
@@ -74,4 +72,5 @@
7472 ])
7573 })
7674 }
7775
76+
app/page/error.jsView
@@ -3,20 +3,23 @@
33
44 exports.gives = nest('app.page.error')
55
66 exports.needs = nest({
7+ 'translations.sync.strings': 'first',
78 'app.html.nav': 'first'
89 })
910
1011 exports.create = (api) => {
12+ var strings = api.translations.sync.strings()
13+
1114 return nest('app.page.error', error)
1215
1316 function error (location) {
14-
15- return h('Page -error', [
16- h('h1', 'Error'),
17- api.app.html.nav(),
18- "The route wasn't found of there was an error",
17+ return h('Page -error', {title: strings.error}, [
18+ strings.errorNotFound,
1919 location.error
2020 ])
2121 }
2222 }
23+
24+
25+
app/page/groupFind.jsView
@@ -3,19 +3,20 @@
33
44 exports.gives = nest('app.page.groupFind')
55
66 exports.needs = nest({
7+ 'translations.sync.strings': 'first',
78 'app.html.nav': 'first'
89 })
910
1011 exports.create = (api) => {
12+ var strings = api.translations.sync.strings()
1113 return nest('app.page.groupFind', groupFind)
1214
1315 function groupFind (location) {
14-
15- return h('Page -groupFind', [
16- h('h1', 'Group Find'),
17- api.app.html.nav(),
16+ return h('Page -groupFind', {title: strings.groupFind}, [
1817 h('p', `key: ${location.key}`)
1918 ])
2019 }
2120 }
21+
22+
app/page/groupIndex.jsView
@@ -3,17 +3,21 @@
33
44 exports.gives = nest('app.page.groupIndex')
55
66 exports.needs = nest({
7+ 'translations.sync.strings': 'first',
78 'app.html.nav': 'first'
89 })
910
1011 exports.create = (api) => {
12+ var strings = api.translations.sync.strings()
1113 return nest('app.page.groupIndex', groupIndex)
1214
1315 function groupIndex (location) {
14- return h('Page -groupIndex', [
15- h('h1', 'Group Index'),
16- api.app.html.nav()
16+ return h('Page -groupIndex', {title: strings.groupIndex}, [
17+ strings.stub
1718 ])
1819 }
1920 }
21+
22+
23+
app/page/groupNew.jsView
@@ -3,17 +3,19 @@
33
44 exports.gives = nest('app.page.groupNew')
55
66 exports.needs = nest({
7- 'app.html.nav': 'first'
7+ 'app.html.nav': 'first',
8+ 'translations.sync.strings': 'first'
89 })
910
1011 exports.create = (api) => {
1112 return nest('app.page.groupNew', groupNew)
12-
13+ var strings = api.translations.sync.strings()
1314 function groupNew (location) {
14- return h('Page -groupNew', [
15- h('h1', 'Group New'),
16- api.app.html.nav()
15+ return h('Page -groupNew', {title: strings.groupNew}, [
16+ strings.stub
1717 ])
1818 }
1919 }
20+
21+
app/page/groupShow.jsView
@@ -3,21 +3,25 @@
33
44 exports.gives = nest('app.page.groupShow')
55
66 exports.needs = nest({
7+ 'translations.sync.strings': 'first',
78 'app.html.nav': 'first'
89 })
910
1011 exports.create = (api) => {
12+ var strings = api.translations.sync.strings()
1113 return nest('app.page.groupShow', groupShow)
1214
1315 function groupShow (location) {
1416 // location here can be the root message of a group : { type: 'group', key }
1517 // TODO show specific group index described by key
1618
17- return h('Page -groupShow', [
18- h('h1', 'Group Show'),
19- api.app.html.nav(),
19+ return h('Page -groupShow', {title: strings.groupShow}, [
2020 h('p', `key: ${location.key}`)
2121 ])
2222 }
2323 }
24+
25+
26+
27+
app/page/home.jsView
@@ -27,9 +27,9 @@
2727 }
2828
2929 exports.create = (api) => {
3030 return nest('app.page.home', function (location) {
31- // location here can expected to be: { page: 'home' }
31+ // location here can expected to be: { page: 'home'}
3232 var strings = api.translations.sync.strings()
3333
3434 var container = h('div.container', [])
3535
@@ -124,14 +124,12 @@
124124
125125 return container
126126 }
127127 )
128-
129- return h('Page -home', [
130- h('h1', 'Home'),
131- api.app.html.nav(),
128+ return h('Page -home', {title: strings.home}, [
132129 threadsHtmlObs,
133130 h('button', {'ev-click': threadsHtmlObs.more}, [strings.showMore])
134131 ])
135132 })
136133 }
137134
135+
app/page/settings.jsView
@@ -3,18 +3,20 @@
33
44 exports.gives = nest('app.page.settings')
55
66 exports.needs = nest({
7+ 'translations.sync.strings': 'first',
78 'app.html.nav': 'first'
89 })
910
1011 exports.create = (api) => {
1112 return nest('app.page.settings', settings)
1213
1314 function settings (location) {
1415
15- return h('Page -settings', [
16- h('h1', 'Settings'),
17- api.app.html.nav(),
16+ return h('Page -settings', {title: strings.settings}, [
17+ strings.stub
1818 ])
1919 }
2020 }
21+
22+
app/page/threadNew.jsView
@@ -3,24 +3,29 @@
33
44 exports.gives = nest('app.page.threadNew')
55
66 exports.needs = nest({
7+ 'translations.sync.strings': 'first',
78 'about.html.image': 'first',
89 'about.obs.name': 'first',
910 'app.html.nav': 'first',
1011 'app.html.thread': 'first',
1112 })
1213
1314 exports.create = (api) => {
15+ var strings = api.translations.sync.strings()
16+
1417 return nest('app.page.threadNew', threadNew)
1518
1619 function threadNew (location) {
1720 const { feed } = location
1821
19- return h('Page -threadNew', [
22+ return h('Page -threadNew', {title: strings.threadNew}, [
2023 h('h1', ['New thread with ', api.about.obs.name(feed)]),
2124 api.about.html.image(feed),
22- api.app.html.nav(),
2325 h('div', 'compose box') // a special one which takes us to threadShow
2426 ])
2527 }
2628 }
29+
30+
31+
app/page/threadShow.jsView
@@ -5,14 +5,17 @@
55
66 exports.gives = nest('app.page.threadShow')
77
88 exports.needs = nest({
9+ 'translations.sync.strings': 'first',
910 'app.html.nav': 'first',
1011 'app.html.thread': 'first',
1112 'message.html.compose': 'first'
1213 })
1314
1415 exports.create = (api) => {
16+ var strings = api.translations.sync.strings()
17+
1518 return nest('app.page.threadShow', threadShow)
1619
1720 function threadShow (location) {
1821 // location = a thread (message decorated with replies)
@@ -22,20 +25,20 @@
2225
2326 const meta = {
2427 type: 'post',
2528 root,
26- branch: get(last(location.replies), 'key'), // >> lastId? CHECK THIS LOGIC
27- channel,
29+ branch: get(last(location.replies), 'key'),
30+ // >> lastId? CHECK THIS LOGIC
31+ channel: channel,
2832 recps: get(location, 'value.content.recps')
2933 }
3034 const composer = api.message.html.compose({ meta, shrink: false })
3135
32- return h('Page -threadShow', [
33- h('h1', 'Private message'),
34- api.app.html.nav(),
36+ return h('Page -threadShow', {title: strings.threadShow}, [
3537 h('div.container', [
3638 thread,
3739 composer
3840 ]),
3941 ])
4042 }
4143 }
44+
app/page/userFind.jsView
@@ -3,18 +3,22 @@
33
44 exports.gives = nest('app.page.userFind')
55
66 exports.needs = nest({
7+ 'translations.sync.strings': 'first',
78 'app.html.nav': 'first'
89 })
910
1011 exports.create = (api) => {
12+ var strings = api.translations.sync.strings()
1113 return nest('app.page.userFind', userFind)
1214
1315 function userFind (location) {
1416
15- return h('Page -userFind', [
16- h('h1', 'Find a User'),
17- api.app.html.nav()
17+ return h('Page -userFind', {title: strings.userFind}, [
18+ string.stub
1819 ])
1920 }
2021 }
22+
23+
24+
app/page/userShow.jsView
@@ -3,34 +3,39 @@
33
44 exports.gives = nest('app.page.userShow')
55
66 exports.needs = nest({
7+ 'translations.sync.strings': 'first',
78 'app.html.link': 'first',
89 'app.html.nav': 'first',
910 'about.html.image': 'first',
1011 'about.obs.name': 'first',
1112 'keys.sync.id': 'first',
1213 })
1314
1415 exports.create = (api) => {
16+ var strings = api.translations.sync.strings()
17+
1518 return nest('app.page.userShow', userShow)
1619
1720 function userShow (location) {
1821
1922 const { feed } = location
2023 const Link = api.app.html.link
2124 const myId = api.keys.sync.id()
25+ var name = api.about.html.name(feed)
2226
23- return h('Page -userShow', [
24- h('h1', api.about.obs.name(feed)),
25- api.app.html.nav(),
27+ return h('Page -userShow', {title: api.about.obs.name(feed)}, [
2628 api.about.html.image(feed),
27- h('div', 'follow button'),
28- h('div', 'friends in common'),
29+ h('div', strings.followButton),
30+ h('div', strings.friendsInCommon),
2931 feed !== myId
30- ? Link({ page: 'threadNew', feed }, 'New Thread')
32+ ? Link({ page: 'threadNew', feed }, strings.newThread)
3133 : '',
32- h('div', 'conversations you\'ve had with dominic'),
33- h('div', 'groups dominic is in'),
34+ h('div', strings.userConvesationsWith, name),
35+ h('div', name, strings.userIsInGroups),
3436 ])
3537 }
3638 }
39+
40+
41+
translations/sync.jsView
@@ -5,9 +5,27 @@
55 return {translations: {sync: {strings: function () {
66 return {
77 showMore: "Show More",
88 channels: "Channels",
9+ home: "Home",
910 directMessages: "Direct Messages",
10- replySymbol: "> "
11+ replySymbol: "> ",
12+ error: "Error",
13+ errorNotFound: "The page wasn't found",
14+ groupNew: "New Group",
15+ groupFind: 'Find Group',
16+ groupIndex: "Group Index",
17+ //stub: should not be shown on released software!
18+ stub: "this page is a stub",
19+ settings: "Settings",
20+ threadNew: 'New Thread',
21+ threadShow: "Direct Messages",
22+ userFind: "Find User",
23+ userIsInGroups: "is in groups:"
24+ userConversationsWith: 'conversations you\'ve had with',
25+ follow: "Follow",
26+ friendsInCommon: 'friends in common'
1127 }
1228 }}}}
1329 }
30+
31+

Built with git-ssb-web