From b2e3d8787cb9caea3aba4619fd04e7f53b02afe6 Mon Sep 17 00:00:00 2001 From: CamilleLegeron Date: Thu, 25 Jan 2024 16:27:23 +0100 Subject: [PATCH] Mark more strings as translatable (#795) * add modals translations * GridViewMenus: add translations for column type --- app/client/components/modals.ts | 23 ++++++++++++++--------- static/locales/en.client.json | 25 +++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/app/client/components/modals.ts b/app/client/components/modals.ts index 06ed405f..ad319755 100644 --- a/app/client/components/modals.ts +++ b/app/client/components/modals.ts @@ -9,8 +9,11 @@ import {icon} from 'app/client/ui2018/icons'; import {cssModalTooltip, modalTooltip} from 'app/client/ui2018/modals'; import {dom, DomContents, keyframes, observable, styled, svg} from 'grainjs'; import {IPopupOptions} from 'popweasel'; +import {makeT} from 'app/client/lib/localization'; import merge = require('lodash/merge'); +const t = makeT('modals'); + /** * This is a file for all custom and pre-configured popups, modals, toasts and tooltips, used * in more then one component. @@ -35,19 +38,21 @@ export function buildConfirmDelete( Escape: () => ctl.close(), Enter: () => { onSave(remember.get()); ctl.close(); }, }), - dom('div', `Are you sure you want to delete ${single ? 'this' : 'these'} record${single ? '' : 's'}?`, + dom('div', single ? + t(`Are you sure you want to delete this record?`) + : t(`Are you sure you want to delete these records?`), dom.style('margin-bottom', '10px'), ), dom('div', - labeledSquareCheckbox(remember, "Don't ask again.", testId('confirm-remember')), + labeledSquareCheckbox(remember, t("Don't ask again."), testId('confirm-remember')), dom.style('margin-bottom', '10px'), ), cssButtons( - primaryButton('Delete', testId('confirm-save'), dom.on('click', () => { + primaryButton(t('Delete'), testId('confirm-save'), dom.on('click', () => { onSave(remember.get()); ctl.close(); })), - basicButton('Cancel', testId('confirm-cancel'), dom.on('click', () => ctl.close())) + basicButton(t('Cancel'), testId('confirm-cancel'), dom.on('click', () => ctl.close())) ) ), {} ); @@ -81,9 +86,9 @@ export function showDeprecatedWarning( dom.style('justify-content', 'space-between'), dom.style('align-items', 'center'), dom('div', - labeledSquareCheckbox(remember, "Don't show again.", testId('confirm-remember')), + labeledSquareCheckbox(remember, t("Don't show again."), testId('confirm-remember')), ), - basicButton('Dismiss', testId('confirm-save'), + basicButton(t('Dismiss'), testId('confirm-save'), dom.on('click', () => { ctl.close(); onClose(remember.get()); }) ) ), @@ -105,7 +110,7 @@ export function showDeprecatedWarning( export function reportUndo( doc: GristDoc, messageLabel: string, - buttonLabel = 'Undo to restore' + buttonLabel = t('Undo to restore') ) { // First create a notification with a button to undo the delete. let notification = reportSuccess(messageLabel, { @@ -179,12 +184,12 @@ export function showBehavioralPrompt( dom.style('align-items', 'center'), dom('div', cssSkipTipsCheckbox(dontShowTips, - cssSkipTipsCheckboxLabel("Don't show tips"), + cssSkipTipsCheckboxLabel(t("Don't show tips")), testId('behavioral-prompt-dont-show-tips') ), dom.style('visibility', hideDontShowTips ? 'hidden' : ''), ), - cssDismissPromptButton('Got it', testId('behavioral-prompt-dismiss'), + cssDismissPromptButton(t('Got it'), testId('behavioral-prompt-dismiss'), dom.on('click', () => { onClose(dontShowTips.get()); ctl.close(); }) ), ), diff --git a/static/locales/en.client.json b/static/locales/en.client.json index 906d0fd3..679dbd10 100644 --- a/static/locales/en.client.json +++ b/static/locales/en.client.json @@ -433,7 +433,19 @@ "Created by": "Created by", "Detect duplicates in...": "Detect duplicates in...", "Last updated at": "Last updated at", - "Last updated by": "Last updated by" + "Last updated by": "Last updated by", + "Any": "Any", + "Numeric": "Numeric", + "Text": "Text", + "Integer": "Integer", + "Toggle": "Toggle", + "Date": "Date", + "DateTime": "DateTime", + "Choice": "Choice", + "Choice List": "Choice List", + "Reference": "Reference", + "Reference List": "Reference List", + "Attachment": "Attachment" }, "GristDoc": { "Added new linked section to view {{viewName}}": "Added new linked section to view {{viewName}}", @@ -880,7 +892,16 @@ "modals": { "Cancel": "Cancel", "Ok": "OK", - "Save": "Save" + "Save": "Save", + "Are you sure you want to delete these records?": "Are you sure you want to delete these records?", + "Are you sure you want to delete this record?": "Are you sure you want to delete this record?", + "Delete": "Delete", + "Dismiss": "Dismiss", + "Don't ask again.": "Don't ask again.", + "Don't show again.": "Don't show again.", + "Don't show tips": "Don't show tips", + "Undo to restore": "Undo to restore", + "Got it": "Got it" }, "pages": { "Duplicate Page": "Duplicate Page",