From e0ae321ff51f3d149edc38c8e73d4b94f970f9f0 Mon Sep 17 00:00:00 2001 From: Louis Delbosc Date: Tue, 6 Dec 2022 17:23:29 +0100 Subject: [PATCH] Change translation keys for complex context keys --- app/client/ui/DocMenu.ts | 3 ++- app/client/ui/FieldConfig.ts | 18 +++++++++--------- app/client/ui/GridViewMenus.ts | 16 ++++++++++------ 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/app/client/ui/DocMenu.ts b/app/client/ui/DocMenu.ts index 2c143d3c..465455cf 100644 --- a/app/client/ui/DocMenu.ts +++ b/app/client/ui/DocMenu.ts @@ -293,7 +293,8 @@ function buildOtherSites(home: HomeModel) { const siteName = home.app.currentOrgName; return [ dom('div', - t("You are on the {{siteName}} site. You also have access to the following sites:", { siteName, context: personal ? 'personal' : '' }), + personal ? t("You are on the {{siteName}} site. You also have access to the following sites:", {siteName}) : + t("You are on your personal site. You also have access to the following sites:"), testId('other-sites-message') ), css.otherSitesButtons( diff --git a/app/client/ui/FieldConfig.ts b/app/client/ui/FieldConfig.ts index 43f926df..73123984 100644 --- a/app/client/ui/FieldConfig.ts +++ b/app/client/ui/FieldConfig.ts @@ -210,19 +210,19 @@ export function buildFormulaConfig( const behaviorName = Computed.create(owner, behavior, (use, type) => { if (use(isMultiSelect)) { const commonType = use(multiType); - if (commonType === 'formula') { return t('ColumnType', {context: 'formula', count: 2}); } - if (commonType === 'data') { return t('ColumnType', {context: 'data', count: 2}); } - if (commonType === 'mixed') { return t('ColumnType', {context: 'mixed', count: 2}); } - return t('ColumnType', {context: 'empty', count: 2}); + if (commonType === 'formula') { return t('Formula Column', {count: 2}); } + if (commonType === 'data') { return t('Data Column', {count: 2}); } + if (commonType === 'mixed') { return t('Mixed Behavior'); } + return t('Empty Column', {count: 2}); } else { - if (type === 'formula') { return t('ColumnType', {context: 'formula', count: 1}); } - if (type === 'data') { return t('ColumnType', {context: 'data', count: 1}); } - return t('ColumnType', {context: 'empty', count: 1}); + if (type === 'formula') { return t('Formula Column', {count: 1}); } + if (type === 'data') { return t('Data Column', {count: 1}); } + return t('Empty Column', {count: 1}); } }); const behaviorIcon = Computed.create(owner, (use) => { - return use(behaviorName) === t('ColumnType', {context: 'data', count: 2}) || - use(behaviorName) === t('ColumnType', {context: 'data', count: 1}) ? "Database" : "Script"; + return use(behaviorName) === t('Data Column', {count: 2}) || + use(behaviorName) === t('Data Column', {count: 1}) ? "Database" : "Script"; }); const behaviorLabel = () => selectTitle(behaviorName, behaviorIcon); diff --git a/app/client/ui/GridViewMenus.ts b/app/client/ui/GridViewMenus.ts index 7d7f777c..7e795ba8 100644 --- a/app/client/ui/GridViewMenus.ts +++ b/app/client/ui/GridViewMenus.ts @@ -206,12 +206,14 @@ export function freezeAction(options: IMultiColumnContextMenu): { text: string; // if user clicked the first column or a column just after frozen set if (firstColumnIndex === 0 || firstColumnIndex === numFrozen) { - text = t('FreezeColumn', {count: 1}); + text = t('Freeze {{count}} columns', {count: 1}); } else { // else user clicked any other column that is farther, offer to freeze // proper number of column const properNumber = firstColumnIndex - numFrozen + 1; - text = t('FreezeColumn', {count: properNumber, context: numFrozen ? 'more' : '' }); + text = numFrozen ? + t('Freeze {{count}} more columns', {count: properNumber}) : + t('Freeze {{count}} columns', {count: properNumber}); } return { text, @@ -220,12 +222,14 @@ export function freezeAction(options: IMultiColumnContextMenu): { text: string; } else if (isFrozenColumn) { // when user clicked last column in frozen set - offer to unfreeze this column if (firstColumnIndex + 1 === numFrozen) { - text = t('UnfreezeColumn', {count: 1}); + text = t('Unfreeze {{count}} columns', {count: 1}); } else { // else user clicked column that is not the last in a frozen set // offer to unfreeze proper number of columns const properNumber = numFrozen - firstColumnIndex; - text = t('UnfreezeColumn', {count: properNumber, context: properNumber === numFrozen ? 'all' : '' }); + text = properNumber === numFrozen ? + t('Unfreeze all columns') : + t('UnFreeze {{count}} columns', {count: properNumber}); } return { text, @@ -249,7 +253,7 @@ export function freezeAction(options: IMultiColumnContextMenu): { text: string; }; } else if (isSpanSet) { const toFreeze = lastColumnIndex + 1 - numFrozen; - text = t('FreezeColumn', {count: toFreeze, context: 'more'}); + text = t('Freeze {{count}} more columns', {count: toFreeze}); return { text, numFrozen : numFrozen + toFreeze @@ -278,7 +282,7 @@ function getAddToSortLabel(sortSpec: Sort.SortSpec, colId: number): string|undef if (sortSpec.length !== 0 && !isEqual(columnsInSpec, [colId])) { const index = columnsInSpec.indexOf(colId); if (index > -1) { - return t("Add to sort", {count: index + 1, context: 'added'}); + return t("Sorted (#{{count}})", {count: index + 1}); } else { return t("Add to sort"); }