Change translation keys for complex context keys

This commit is contained in:
Louis Delbosc 2022-12-06 17:23:29 +01:00
parent 37dc0cc9fb
commit e0ae321ff5
3 changed files with 21 additions and 16 deletions

View File

@ -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(

View File

@ -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<IconName>(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);

View File

@ -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");
}