From 37dc0cc9fb09bdf4d649e723b1bfdd1b1a555b27 Mon Sep 17 00:00:00 2001 From: Louis Delbosc Date: Tue, 6 Dec 2022 16:36:14 +0100 Subject: [PATCH] Change translation keys for simple context keys --- app/client/models/DocPageModel.ts | 3 ++- app/client/ui/ExampleInfo.ts | 24 ++++++++++++------------ app/client/ui/FieldConfig.ts | 8 ++++---- app/client/ui/FieldMenus.ts | 8 ++++---- app/client/ui/errorPages.ts | 4 ++-- 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/app/client/models/DocPageModel.ts b/app/client/models/DocPageModel.ts index a9f4f15c..6db13d20 100644 --- a/app/client/models/DocPageModel.ts +++ b/app/client/models/DocPageModel.ts @@ -240,7 +240,8 @@ export class DocPageModelImpl extends Disposable implements DocPageModel { t("Reload"), async () => window.location.reload(true), isDocOwner ? t("You can try reloading the document, or using recovery mode. Recovery mode opens the document to be fully accessible to owners, and inaccessible to others. It also disables formulas. [{{error}}]", {error: err.message}) : - t('AccessError', {context: isDenied ? 'denied' : 'recover', error: err.message}), + isDenied ? t('Sorry, access to this document has been denied. [{{error}}]', {error: err.message}) : + t("Document owners can attempt to recover the document. [{{error}}]", {error: err.message}), { hideCancel: true, extraButtons: (isDocOwner && !isDenied) ? bigBasicButton(t("Enter recovery mode"), dom.on('click', async () => { await this._api.getDocAPI(this.currentDocId.get()!).recover(true); diff --git a/app/client/ui/ExampleInfo.ts b/app/client/ui/ExampleInfo.ts index b8f1c1f2..23fb1199 100644 --- a/app/client/ui/ExampleInfo.ts +++ b/app/client/ui/ExampleInfo.ts @@ -20,34 +20,34 @@ interface WelcomeCard { export const buildExamples = (): IExampleInfo[] => [{ id: 1, // Identifies the example in UserPrefs.seenExamples urlId: 'lightweight-crm', - title: t('Title', {context: "CRM"}), + title: t('Lightweight CRM'), imgUrl: 'https://www.getgrist.com/themes/grist/assets/images/use-cases/lightweight-crm.png', tutorialUrl: 'https://support.getgrist.com/lightweight-crm/', welcomeCard: { - title: t('WelcomeTitle', {context: "CRM"}), - text: t('WelcomeText', {context: "CRM"}), - tutorialName: t('WelcomeTutorialName', {context: "CRM"}), + title: t('Welcome to the Lightweight CRM template'), + text: t('Check out our related tutorial for how to link data, and create high-productivity layouts.'), + tutorialName: t("Tutorial: Create a CRM"), }, }, { id: 2, // Identifies the example in UserPrefs.seenExamples urlId: 'investment-research', - title: t('Title', {context: "investmentResearch"}), + title: t('Investment Research'), imgUrl: 'https://www.getgrist.com/themes/grist/assets/images/use-cases/data-visualization.png', tutorialUrl: 'https://support.getgrist.com/investment-research/', welcomeCard: { - title: t('WelcomeTitle', {context: "investmentResearch"}), - text: t('WelcomeText', {context: "investmentResearch"}), - tutorialName: t('WelcomeTutorialName', {context: "investmentResearch"}), + title: t("Welcome to the Investment Research template"), + text: t("Check out our related tutorial to learn how to create summary tables and charts, and to link charts dynamically."), + tutorialName: t("Tutorial: Analyze & Visualize"), }, }, { id: 3, // Identifies the example in UserPrefs.seenExamples urlId: 'afterschool-program', - title: t('Title', {context: "afterschool"}), + title: t('Afterschool Program'), imgUrl: 'https://www.getgrist.com/themes/grist/assets/images/use-cases/business-management.png', tutorialUrl: 'https://support.getgrist.com/afterschool-program/', welcomeCard: { - title: t('WelcomeTitle', {context: "afterschool"}), - text: t('WelcomeText', {context: "afterschool"}), - tutorialName: t('WelcomeTutorialName', {context: "afterschool"}), + title: t("Welcome to the Afterschool Program template"), + text: t("Check out our related tutorial for how to model business data, use formulas, and manage complexity."), + tutorialName: t("Tutorial: Manage Business Data"), }, }]; diff --git a/app/client/ui/FieldConfig.ts b/app/client/ui/FieldConfig.ts index 8a34e01f..43f926df 100644 --- a/app/client/ui/FieldConfig.ts +++ b/app/client/ui/FieldConfig.ts @@ -231,19 +231,19 @@ export function buildFormulaConfig( // Converts data column to formula column. const convertDataColumnToFormulaOption = () => selectOption( () => (maybeFormula.set(true), formulaField?.focus()), - t('ConvertColumn', {context: 'formula'}), 'Script'); + t("Clear and make into formula"), 'Script'); // Converts to empty column and opens up the editor. (label is the same, but this is used when we have no formula) const convertTriggerToFormulaOption = () => selectOption( () => gristDoc.convertIsFormula([origColumn.id.peek()], {toFormula: true, noRecalc: true}), - t('ConvertColumn', {context: 'formula'}), 'Script'); + t("Clear and make into formula"), 'Script'); // Convert column to data. // This method is also available through a text button. const convertToData = () => gristDoc.convertIsFormula([origColumn.id.peek()], {toFormula: false, noRecalc: true}); const convertToDataOption = () => selectOption( convertToData, - t('ConvertColumn', {context: 'data'}), 'Database', + t("Convert column to data"), 'Database', dom.cls('disabled', isSummaryTable) ); @@ -357,7 +357,7 @@ export function buildFormulaConfig( formulaBuilder(onSaveConvertToFormula), cssEmptySeparator(), cssRow(textButton( - t('ConvertColumn', {context: 'triggerformula'}), + t("Convert to trigger formula"), dom.on("click", convertFormulaToTrigger), dom.hide(maybeFormula), dom.prop("disabled", use => use(isSummaryTable) || use(disableOtherActions)), diff --git a/app/client/ui/FieldMenus.ts b/app/client/ui/FieldMenus.ts index 948c7845..177a7076 100644 --- a/app/client/ui/FieldMenus.ts +++ b/app/client/ui/FieldMenus.ts @@ -13,10 +13,10 @@ const t = makeT('FieldMenus'); export function FieldSettingsMenu(useColOptions: boolean, disableSeparate: boolean, actions: IFieldOptions) { useColOptions = useColOptions || disableSeparate; return [ - menuSubHeader(t('UsingSettings', {context: useColOptions ? 'common' : 'separate'})), - useColOptions ? menuItem(actions.useSeparate, t('Settings', {context: 'useseparate'}), dom.cls('disabled', disableSeparate)) : [ - menuItem(actions.saveAsCommon, t('Settings', {context: 'savecommon'})), - menuItem(actions.revertToCommon, t('Settings', {context: 'revertcommon'})), + menuSubHeader(useColOptions ? t("Using common settings") : t("Using separate settings")), + useColOptions ? menuItem(actions.useSeparate, t("Use separate settings"), dom.cls('disabled', disableSeparate)) : [ + menuItem(actions.saveAsCommon, t("Save as common settings")), + menuItem(actions.revertToCommon, t("Revert to common settings")), ] ]; } diff --git a/app/client/ui/errorPages.ts b/app/client/ui/errorPages.ts index 24d7c044..eecf5ed4 100644 --- a/app/client/ui/errorPages.ts +++ b/app/client/ui/errorPages.ts @@ -87,8 +87,8 @@ export function createOtherErrorPage(appModel: AppModel, message?: string) { document.title = t("Error{{suffix}}", {suffix: getPageTitleSuffix(getGristConfig())}); return pagePanelsError(appModel, t("Something went wrong"), [ - cssErrorText(message ? t('ErrorHappened', {context: 'message', message: addPeriod(message)}) : - t('ErrorHappened', {context: 'unknown'})), + cssErrorText(message ? t('There was an error: {{message}}', {message: addPeriod(message)}) : + t('There was an unknown error.')), cssButtonWrap(bigPrimaryButtonLink(t("Go to main page"), testId('error-primary-btn'), urlState().setLinkUrl({}))), cssButtonWrap(bigBasicButtonLink(t("Contact support"), {href: 'https://getgrist.com/contact'})),