diff --git a/www/common/translations/messages.ja.json b/www/common/translations/messages.ja.json index 656239dec..25323cfa3 100644 --- a/www/common/translations/messages.ja.json +++ b/www/common/translations/messages.ja.json @@ -525,7 +525,7 @@ "crowdfunding_popup_no": "あとで", "sharedFolders_create_name": "フォルダ名", "creation_newTemplate": "新しいテンプレート", - "creation_noTemplate": "テンプレートがありません", + "creation_noTemplate": "空のドキュメント", "creation_expire": "期限切れのパッド", "mdToolbar_list": "箇条書き", "uploadFolder_modal_filesPassword": "ファイルのパスワード", @@ -746,7 +746,7 @@ "saveTemplatePrompt": "テンプレートのタイトルを入力してください", "newButtonTitle": "新しいパッドを作成", "newButton": "新規", - "userAccountButton": "アカウント", + "userAccountButton": "メニュー", "userListButton": "ユーザーリスト", "movedToTrash": "パッドをゴミ箱に移動しました。
ドライブにアクセス", "forgetPrompt": "OKをクリックするとパッドをゴミ箱へと移動します。よろしいですか?", @@ -905,7 +905,7 @@ "form_showSummary": "概要を表示", "form_showIndividual": "個々の回答を表示", "form_results_empty": "回答がありません", - "form_results": "回答", + "form_results": "回答({0})", "form_answered": "このフォームは回答済みです", "form_cantFindAnswers": "このフォームの既存の回答を取得できません。", "form_duplicates": "重複する項目が削除されました", @@ -1384,5 +1384,14 @@ "ui_expand": "広げる", "ui_collapse": "折りたたむ", "support_premiumPriority": "プレミアムユーザーになると、CryptPadの使い勝手を改良する手助けができるほか、サポートチケットに対する優先サポートを受けることができます。", - "support_premiumLink": "定額利用のオプションを表示" + "support_premiumLink": "定額利用のオプションを表示", + "toolbar_collapse": "ツールバーをたたむ", + "toolbar_expand": "ツールバーを広げる", + "form_preview": "フォームをプレビュー", + "form_geturl": "リンクをコピー", + "form_viewAnswer": "回答を表示", + "form_editAnswer": "回答を編集", + "form_preview_button": "プレビュー", + "upload_addOptionalAlt": "説明文を追加(任意)", + "upload_modal_alt": "代替テキスト" } diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 1cb85b4f1..67894897f 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -92,7 +92,7 @@ "shareSuccess": "Copied link to clipboard", "userListButton": "User list", "chatButton": "Chat", - "userAccountButton": "Your account", + "userAccountButton": "User menu", "newButton": "New", "newButtonTitle": "Create a new pad", "uploadButton": "Upload files", @@ -579,7 +579,7 @@ "creation_expireDays": "Day(s)", "creation_expireMonths": "Month(s)", "creation_password": "Password\n", - "creation_noTemplate": "No template", + "creation_noTemplate": "Blank document", "creation_newTemplate": "New template", "creation_create": "Create", "creation_owners": "Owners", @@ -606,8 +606,8 @@ "share_linkView": "View", "share_linkEmbed": "Embed mode (hide toolbar and user list)", "share_linkPresent": "Present", - "share_linkOpen": "Preview", - "share_linkCopy": "Copy", + "share_linkOpen": "Open link", + "share_linkCopy": "Copy link", "share_contactCategory": "Contacts", "share_embedCategory": "Embed", "share_mediatagCopy": "Copy mediatag to clipboard", @@ -1284,7 +1284,7 @@ "form_updateWarning": "Update anyway", "form_cantFindAnswers": "Unable to retrieve your existing answers for this form.", "form_answered": "You have already answered this form", - "form_results": "Responses", + "form_results": "Responses ({0})", "form_results_empty": "There are no responses", "form_editor": "Editor", "form_form": "Form", @@ -1301,7 +1301,7 @@ "form_invalidWarning": "There are errors in some answers:", "form_invalidQuestion": "Question {0}", "form_makePublic": "Publish responses", - "form_makePublicWarning": "Are you sure you want to make responses to this form public? This cannot be undone.", + "form_makePublicWarning": "Are you sure you want to make responses to this form public? Past and future responses will be visible by participants. This cannot be undone.", "form_isPublic": "Responses are public", "form_isPrivate": "Responses are private", "form_open": "Open", @@ -1310,7 +1310,7 @@ "form_isOpen": "This form is open", "form_isClosed": "This form was closed on {0}", "form_willClose": "This form will close on {0}", - "form_anonymous": "Anonymous answers", + "form_anonymous": "Guest access (not logged in)", "form_anonymous_on": "Allowed", "form_anonymous_off": "Blocked", "form_defaultOption": "Option {0}", @@ -1384,5 +1384,44 @@ "ui_expand": "Expand", "form_totalResponses": "Total responses: {0}", "support_premiumPriority": "Premium users help support improvements to CryptPad's usability and benefit from prioritized responses to their support tickets.", - "support_premiumLink": "View subscription options" + "support_premiumLink": "View subscription options", + "toolbar_collapse": "Collapse toolbar", + "toolbar_expand": "Expand toolbar", + "profile_defaultAlt": "Default profile picture", + "upload_modal_alt": "Alt text", + "upload_addOptionalAlt": "Add descriptive text (optional)", + "form_template_poll": "Quick Poll", + "form_preview_button": "Preview", + "form_alreadyAnswered": "You responded to this form on {0}", + "form_editAnswer": "Edit my responses", + "form_viewAnswer": "View my responses", + "form_viewAllAnswers": "View all responses ({0})", + "form_anonAnswer": "Responses to this form are anonymized", + "form_authAnswer": "This form cannot be submitted anonymously", + "form_requiredWarning": "The following questions require an answer:", + "form_required_answer": "Answer: ", + "form_required_on": "Required", + "form_required_off": "Optional", + "form_preview": "Preview form", + "form_changeTypeConfirm": "Select the new question type.", + "form_corruptAnswers": "This form already has responses. Changing this question type may invalidate previous response data.", + "form_geturl": "Copy link", + "toolbar_preview": "Preview", + "form_updateMsg": "Update submit message", + "form_addMsg": "Add submit message", + "form_responseMsg": "This message will be displayed after participants submit the form.", + "form_makeAnon": "Anonymize responses", + "form_editable": "Editing after submission", + "form_type_section": "Conditional section", + "form_condition_q": "Choose a question", + "form_condition_v": "Choose a value", + "form_condition_is": "is", + "form_condition_isnot": "is not", + "form_condition_has": "has", + "form_condition_hasnot": "has not", + "form_conditional": "Only show this section when:", + "form_conditional_add": "Add OR condition", + "form_conditional_addAnd": "Add AND condition\n", + "userlist_visitProfile": "Visit profile", + "form_colors": "Color theme" } diff --git a/www/form/inner.js b/www/form/inner.js index cb85ae29c..18e316258 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -82,6 +82,14 @@ define([ var MAX_OPTIONS = 15; var MAX_ITEMS = 10; + var extractValues = function (values) { + if (!Array.isArray(values)) { return []; } + return values.map(function (obj) { + if (!Util.isObject(obj)) { return obj; } + return obj.v; + }); + }; + var saveAndCancelOptions = function (getRes, cb) { // Cancel changes var cancelBlock = h('button.btn.btn-secondary', Messages.cancel); @@ -313,7 +321,8 @@ define([ }); return el; }; - var inputs = v.values.map(function (val) { return getOption(val, false); }); + // TODO uid + var inputs = extractValues(v.values).map(function (val) { return getOption(val, false); }); inputs.push(add); var container = h('div.cp-form-edit-block', inputs); @@ -346,7 +355,7 @@ define([ if (v.type) { var calendarInput = h('input'); calendarView = h('div', calendarInput); - var calendarDefault = v.type === "day" ? v.values.map(function (time) { + var calendarDefault = v.type === "day" ? extractValues(v.values).map(function (time) { if (!time) { return; } var d = new Date(time); if (!isNaN(d)) { return d; } @@ -597,13 +606,13 @@ define([ var makePollTable = function (answers, opts, resultsPageObj) { // Sort date values if (opts.type !== "text") { - opts.values.sort(function (a, b) { + extractValues(opts.values).sort(function (a, b) { // TODO uid return +new Date(a) - +new Date(b); }); } // Create first line with options var allDays = getWeekDays(true); - var els = opts.values.map(function (data) { + var els = extractValues(opts.values).map(function (data) { // TODO uid var _date; if (opts.type === "day") { _date = new Date(data); @@ -634,7 +643,7 @@ define([ if (opts.type === "time") { var days = [h('div.cp-poll-cell')]; var _days = {}; - opts.values.forEach(function (d) { + extractValues(opts.values).forEach(function (d) { var date = new Date(d); var day = date.toLocaleDateString(); _days[day] = { @@ -665,7 +674,7 @@ define([ var avatar = h('span.cp-avatar'); APP.common.displayAvatar($(avatar), Util.find(answerObj, ['user', 'avatar']), name); var values = answer.values || {}; - var els = opts.values.map(function (data) { + var els = extractValues(opts.values).map(function (data) { var res = values[data] || 0; var v = (Number(res) === 1) ? h('i.fa.fa-check.cp-yes') : undefined; var cell = h('div.cp-poll-cell.cp-form-poll-answer', { @@ -703,7 +712,7 @@ define([ var myTotals = {}; var updateMyTotals = function () { if (!myLine) { return; } - opts.values.forEach(function (data) { + extractValues(opts.values).forEach(function (data) { myLine.some(function (el) { if ($(el).data('option') !== data) { return; } var res = Number($(el).attr('data-value')) || 0; @@ -726,7 +735,7 @@ define([ }); }; - var totalEls = opts.values.map(function (data) { + var totalEls = extractValues(opts.values).map(function (data) { var y = 0; // Yes var m = 0; // Maybe answers.forEach(function (answerObj) { @@ -1138,7 +1147,7 @@ define([ if (!opts) { opts = TYPES.radio.defaultOpts; } if (!Array.isArray(opts.values)) { return; } var name = Util.uid(); - var els = opts.values.map(function (data, i) { + var els = extractValues(opts.values).map(function (data, i) { var radio = UI.createRadio(name, 'cp-form-'+name+'-'+i, data, false, { mark: { tabindex:1 } }); $(radio).find('input').data('val', data); @@ -1217,7 +1226,7 @@ define([ var lines = opts.items.map(function (itemData) { var name = itemData.uid; var item = itemData.v; - var els = opts.values.map(function (data, i) { + var els = extractValues(opts.values).map(function (data, i) { var radio = UI.createRadio(name, 'cp-form-'+name+'-'+i, '', false, { mark: { tabindex:1 } }); $(radio).find('input').data('uid', name); @@ -1227,7 +1236,7 @@ define([ els.unshift(h('div.cp-form-multiradio-item', item)); return h('div.radio-group', {'data-uid':name}, els); }); - var header = opts.values.map(function (v) { return h('span', v); }); + var header = extractValues(opts.values).map(function (v) { return h('span', v); }); header.unshift(h('span')); lines.unshift(h('div.cp-form-multiradio-header', header)); @@ -1340,7 +1349,7 @@ define([ if (!opts) { opts = TYPES.checkbox.defaultOpts; } if (!Array.isArray(opts.values)) { return; } var name = Util.uid(); - var els = opts.values.map(function (data, i) { + var els = extractValues(opts.values).map(function (data, i) { var cbox = UI.createCheckbox('cp-form-'+name+'-'+i, data, false, { mark: { tabindex:1 } }); $(cbox).find('input').data('val', data); @@ -1431,7 +1440,7 @@ define([ var lines = opts.items.map(function (itemData) { var name = itemData.uid; var item = itemData.v; - var els = opts.values.map(function (data, i) { + var els = extractValues(opts.values).map(function (data, i) { var cbox = UI.createCheckbox('cp-form-'+name+'-'+i, '', false, { mark: { tabindex:1 } }); $(cbox).find('input').data('uid', name); @@ -1454,7 +1463,7 @@ define([ }); }); - var header = opts.values.map(function (v) { return h('span', v); }); + var header = extractValues(opts.values).map(function (v) { return h('span', v); }); header.unshift(h('span')); lines.unshift(h('div.cp-form-multiradio-header', header)); @@ -1586,7 +1595,7 @@ define([ */ Util.shuffleArray(opts.values); } - var els = opts.values.map(function (data) { + var els = extractValues(opts.values).map(function (data) { var uid = Util.uid(); map[uid] = data; invMap[data] = uid; @@ -1640,7 +1649,7 @@ define([ }, reset: function () { Util.shuffleArray(opts.values); - var toSort = (opts.values).map(function (val) { + var toSort = extractValues(opts.values).map(function (val) { return invMap[val]; }); sortable.sort(toSort); @@ -1697,7 +1706,7 @@ define([ var lines = makePollTable(answers, opts, false); // Add form - var addLine = opts.values.map(function (data) { + var addLine = extractValues(opts.values).map(function (data) { var cell = h('div.cp-poll-cell.cp-form-poll-choice', [ h('i.fa.fa-times.cp-no'), h('i.fa.fa-check.cp-yes'), @@ -1798,7 +1807,7 @@ define([ var opts = form.opts || TYPES.poll.defaultOpts; var q = form.q || Messages.form_default; if (answer === false) { - var cols = opts.values.map(function (key) { + var cols = extractValues(opts.values).map(function (key) { return q + ' | ' + key; }); cols.unshift(q); @@ -1814,7 +1823,7 @@ define([ if (i !== 0) { str += ';'; } str += k.replace(';', '').replace(':', '') + ':' + answer.values[k]; }); - var res = opts.values.map(function (key) { + var res = extractValues(opts.values).map(function (key) { return answer.values[key] || ''; }); res.unshift(str);