study share i18n

pull/5029/head
Niklas Fiekas 2019-06-27 10:20:43 +02:00
parent 9cec163eee
commit ffd0fd64fd
5 changed files with 39 additions and 17 deletions

View File

@ -1031,6 +1031,17 @@ val `first` = new Translated("first", Study)
val `previous` = new Translated("previous", Study)
val `next` = new Translated("next", Study)
val `last` = new Translated("last", Study)
val `shareAndExport` = new Translated("shareAndExport", Study)
val `cloneStudy` = new Translated("cloneStudy", Study)
val `studyPgn` = new Translated("studyPgn", Study)
val `chapterPgn` = new Translated("chapterPgn", Study)
val `studyUrl` = new Translated("studyUrl", Study)
val `currentChapterUrl` = new Translated("currentChapterUrl", Study)
val `youCanPasteThisInTheForumToEmbedTheChapter` = new Translated("youCanPasteThisInTheForumToEmbedTheChapter", Study)
val `startAtX` = new Translated("startAtX", Study)
val `embedThisChapter` = new Translated("embedThisChapter", Study)
val `readMoreAboutEmbeddingAStudyChapter` = new Translated("readMoreAboutEmbeddingAStudyChapter", Study)
val `fen` = new Translated("fen", Study)
val `open` = new Translated("open", Study)
val `xBroughtToYouByY` = new Translated("xBroughtToYouByY", Study)
val `studyNotFound` = new Translated("studyNotFound", Study)

View File

@ -41,6 +41,17 @@
<string name="previous">Previous</string>
<string name="next">Next</string>
<string name="last">Last</string>
<string name="shareAndExport">Share &amp; export</string>
<string name="cloneStudy">Clone</string>
<string name="studyPgn">Study PGN</string>
<string name="chapterPgn">Chapter PGN</string>
<string name="studyUrl">Study URL</string>
<string name="currentChapterUrl">Current chapter URL</string>
<string name="youCanPasteThisInTheForumToEmbedTheChapter">You can paste this in the forum to embed the chapter</string>
<string name="startAtX">Start at %s</string>
<string name="embedThisChapter">Embed this chapter in your website or blog</string>
<string name="readMoreAboutEmbeddingAStudyChapter">Read more about embedding a study chapter</string>
<string name="fen">FEN</string>
<string name="open">Open</string>
<string name="xBroughtToYouByY">%1$s brought to you by %2$s</string>
<string name="studyNotFound">Study not found</string>

View File

@ -229,7 +229,7 @@ export default function(data: StudyData, ctrl: AnalyseCtrl, tagTypes: TagTypes,
return ctrl.node;
};
const share = shareCtrl(data, currentChapter, currentNode, redraw);
const share = shareCtrl(data, currentChapter, currentNode, redraw, ctrl.trans);
const practice: StudyPracticeCtrl | undefined = practiceData && practiceCtrl(ctrl, data, practiceData);

View File

@ -14,15 +14,14 @@ function fromPly(ctrl): VNode {
ctrl.withPly((e.target as HTMLInputElement).checked);
}, ctrl.redraw)
}),
'Start at ',
h('strong', renderIndexAndMove({
...ctrl.trans.vdom('startAtX', h('strong', renderIndexAndMove({
withDots: true,
showEval: false
}, node))
}, node)))
]));
}
export function ctrl(data: StudyData, currentChapter: () => StudyChapterMeta, currentNode: () => Tree.Node, redraw: () => void) {
export function ctrl(data: StudyData, currentChapter: () => StudyChapterMeta, currentNode: () => Tree.Node, redraw: () => void, trans: Trans) {
const withPly = prop(false);
return {
studyId: data.id,
@ -33,7 +32,8 @@ export function ctrl(data: StudyData, currentChapter: () => StudyChapterMeta, cu
currentNode,
withPly,
cloneable: data.features.cloneable,
redraw
redraw,
trans
}
}
@ -54,23 +54,23 @@ export function view(ctrl): VNode {
'data-icon': '4',
href: '/study/' + studyId + '/clone'
}
}, 'Clone') : null,
}, ctrl.trans.noarg('cloneStudy')) : null,
h('a.button.text', {
attrs: {
'data-icon': 'x',
href: '/study/' + studyId + '.pgn'
}
}, 'Study PGN'),
}, ctrl.trans.noarg('studyPgn')),
h('a.button.text', {
attrs: {
'data-icon': 'x',
href: '/study/' + studyId + '/' + chapter.id + '.pgn'
}
}, 'Chapter PGN')
}, ctrl.trans.noarg('chapterPgn'))
]),
h('form.form3', [
h('div.form-group', [
h('label.form-label', 'Study URL'),
h('label.form-label', ctrl.trans.noarg('studyUrl')),
h('input.form-control.autoselect', {
attrs: {
readonly: true,
@ -79,7 +79,7 @@ export function view(ctrl): VNode {
})
]),
h('div.form-group', [
h('label.form-label', 'Current chapter URL'),
h('label.form-label', ctrl.trans.noarg('currentChapterUrl')),
h('input.form-control.autoselect', {
attrs: {
readonly: true,
@ -89,15 +89,15 @@ export function view(ctrl): VNode {
fromPly(ctrl),
!isPrivate ? h('p.form-help.text', {
attrs: { 'data-icon': '' }
}, 'You can paste this in the forum to embed the chapter.') : null,
}, ctrl.trans.noarg('youCanPasteThisInTheForumToEmbedTheChapter')) : null,
]),
h('div.form-group', [
h('label.form-label', 'Embed this chapter in your website or blog'),
h('label.form-label', ctrl.trans.noarg('embedThisChapter')),
h('input.form-control.autoselect', {
attrs: {
readonly: true,
disabled: isPrivate,
value: !isPrivate ? '<iframe width=600 height=371 src="' + embedUrl + '" frameborder=0></iframe>' : 'Only public studies can be embedded!'
value: !isPrivate ? '<iframe width=600 height=371 src="' + embedUrl + '" frameborder=0></iframe>' : ctrl.trans.noarg('onlyPublicStudiesCanBeEmbedded')
}
})
].concat(
@ -109,11 +109,11 @@ export function view(ctrl): VNode {
target: '_blank',
'data-icon': ''
}
}, 'Read more about embedding a study chapter.')
}, ctrl.trans.noarg('readMoreAboutEmbeddingAStudyChapter'))
] : [])
),
h('div.form-group', [
h('label.form-label', 'FEN'),
h('label.form-label', ctrl.trans.noarg('fen')),
h('input.form-control.autoselect', {
attrs: {
readonly: true,

View File

@ -104,7 +104,7 @@ function buttons(root: AnalyseCtrl): VNode {
toolButton({
ctrl,
tab: 'share',
hint: 'Share & export',
hint: ctrl.trans.noarg('shareAndExport'),
icon: iconTag('$')
}),
h('span.help', {