feat: add localization support for multiple languages and update locale keys (#7155)

This commit is contained in:
白熱
2026-06-25 21:51:39 +08:00
committed by GitHub
parent 2b2b766402
commit 80582bb4e3
124 changed files with 576 additions and 135 deletions
+30 -9
View File
@@ -17,7 +17,18 @@
import type { DocumentDataModel, ISize, PaperType } from '@univerjs/core';
import type { IConfirmChildrenProps } from '@univerjs/ui';
import type { ReactNode } from 'react';
import { DocumentFlavor, IUniverInstanceService, LocaleService, MODERN_DOCUMENT_WIDTH, ModernDocumentWidthMode, PAGE_SIZE, PageOrientType, PAPER_TYPES, UniverInstanceType } from '@univerjs/core';
import type { LocaleKey } from '../locale/types';
import {
DocumentFlavor,
IUniverInstanceService,
LocaleService,
MODERN_DOCUMENT_WIDTH,
ModernDocumentWidthMode,
PAGE_SIZE,
PageOrientType,
PAPER_TYPES,
UniverInstanceType,
} from '@univerjs/core';
import { clsx, InputNumber, Select } from '@univerjs/design';
import { useDependency } from '@univerjs/ui';
import { useEffect, useState } from 'react';
@@ -172,7 +183,7 @@ export function PageSettings(props: IConfirmChildrenProps) {
})}
onClick={() => handleModeChange(mode)}
>
{localeService.t(mode === DocumentFlavor.MODERN ? 'docs-ui.page-settings.modern-mode' : 'docs-ui.page-settings.classic-mode')}
{localeService.t<LocaleKey>(mode === DocumentFlavor.MODERN ? 'docs-ui.page-settings.modern-mode' : 'docs-ui.page-settings.classic-mode')}
</button>
))}
</div>
@@ -180,7 +191,7 @@ export function PageSettings(props: IConfirmChildrenProps) {
{settings.mode === DocumentFlavor.MODERN
? (
<div className="univer-flex univer-flex-col univer-gap-2.5">
<SettingsLabel>{localeService.t('docs-ui.page-settings.modern-width')}</SettingsLabel>
<SettingsLabel>{localeService.t<LocaleKey>('docs-ui.page-settings.modern-width')}</SettingsLabel>
<div className="univer-grid univer-grid-cols-3 univer-gap-2">
{MODERN_WIDTH_OPTIONS.map((option) => (
<button
@@ -211,7 +222,9 @@ export function PageSettings(props: IConfirmChildrenProps) {
: (
<>
<div className="univer-flex univer-flex-col univer-gap-2">
<SettingsLabel>{localeService.t('docs-ui.page-settings.paper-size')}</SettingsLabel>
<SettingsLabel>
{localeService.t<LocaleKey>('docs-ui.page-settings.paper-size')}
</SettingsLabel>
<Select
value={settings.paperSize}
onChange={handlePaperSizeChange}
@@ -223,11 +236,13 @@ export function PageSettings(props: IConfirmChildrenProps) {
</div>
<div className="univer-flex univer-flex-col univer-gap-2">
<SettingsLabel>{localeService.t('docs-ui.page-settings.custom-paper-size')}</SettingsLabel>
<SettingsLabel>{localeService.t<LocaleKey>('docs-ui.page-settings.custom-paper-size')}</SettingsLabel>
<div className="univer-flex univer-flex-col univer-gap-2.5">
<div className="univer-flex univer-gap-2.5">
<div className="univer-flex univer-flex-1 univer-flex-col univer-gap-2">
<SettingsLabel muted>{localeService.t('docs-ui.page-settings.top')}</SettingsLabel>
<SettingsLabel muted>
{localeService.t<LocaleKey>('docs-ui.page-settings.top')}
</SettingsLabel>
<InputNumber
precision={2}
min={0}
@@ -237,7 +252,9 @@ export function PageSettings(props: IConfirmChildrenProps) {
/>
</div>
<div className="univer-flex univer-flex-1 univer-flex-col univer-gap-2">
<SettingsLabel muted>{localeService.t('docs-ui.page-settings.bottom')}</SettingsLabel>
<SettingsLabel muted>
{localeService.t<LocaleKey>('docs-ui.page-settings.bottom')}
</SettingsLabel>
<InputNumber
precision={2}
min={0}
@@ -249,7 +266,9 @@ export function PageSettings(props: IConfirmChildrenProps) {
</div>
<div className="univer-flex univer-gap-2.5">
<div className="univer-flex univer-flex-1 univer-flex-col univer-gap-2">
<SettingsLabel muted>{localeService.t('docs-ui.page-settings.left')}</SettingsLabel>
<SettingsLabel muted>
{localeService.t<LocaleKey>('docs-ui.page-settings.left')}
</SettingsLabel>
<InputNumber
precision={2}
min={0}
@@ -259,7 +278,9 @@ export function PageSettings(props: IConfirmChildrenProps) {
/>
</div>
<div className="univer-flex univer-flex-1 univer-flex-col univer-gap-2">
<SettingsLabel muted>{localeService.t('docs-ui.page-settings.right')}</SettingsLabel>
<SettingsLabel muted>
{localeService.t<LocaleKey>('docs-ui.page-settings.right')}
</SettingsLabel>
<InputNumber
precision={2}
min={0}
@@ -16,6 +16,7 @@
import type { DocumentDataModel } from '@univerjs/core';
import type { ReactNode } from 'react';
import type { LocaleKey } from '../../locale/types';
import {
BooleanNumber,
ICommandService,
@@ -30,7 +31,7 @@ import { useDependency } from '@univerjs/ui';
import { useState } from 'react';
export interface IImagePopupMenuItem {
label: string;
label: LocaleKey;
index: number;
commandId: string;
commandParams?: object;
@@ -108,7 +109,7 @@ export function ImagePopupMenu(props: IImagePopupMenuProps) {
align="start"
items={menuItems.map((item) => ({
type: 'item',
children: localeService.t(item.label),
children: localeService.t<LocaleKey>(item.label),
disabled: item.disable,
onSelect: () => handleClick(item),
}))}
@@ -300,27 +301,27 @@ function DocImageFloatingToolbar(props: IDocImageFloatingToolbarProps) {
const deleteItem = getMenuItem('drawing-ui.image-popup.delete');
const wrappingStyleOptions = [
{
label: localeService.t('drawing-ui.image-text-wrap.inline'),
label: localeService.t<LocaleKey>('drawing-ui.image-text-wrap.inline'),
value: TextWrappingStyle.INLINE,
icon: <TextWrapShapeIcon />,
},
{
label: localeService.t('drawing-ui.image-text-wrap.square'),
label: localeService.t<LocaleKey>('drawing-ui.image-text-wrap.square'),
value: TextWrappingStyle.WRAP_SQUARE,
icon: <TextWrapShapeIcon />,
},
{
label: localeService.t('drawing-ui.image-text-wrap.topAndBottom'),
label: localeService.t<LocaleKey>('drawing-ui.image-text-wrap.topAndBottom'),
value: TextWrappingStyle.WRAP_TOP_AND_BOTTOM,
icon: <TextWrapShapeIcon />,
},
{
label: localeService.t('drawing-ui.image-text-wrap.behindText'),
label: localeService.t<LocaleKey>('drawing-ui.image-text-wrap.behindText'),
value: TextWrappingStyle.BEHIND_TEXT,
icon: <TextWrapShapeIcon />,
},
{
label: localeService.t('drawing-ui.image-text-wrap.inFrontText'),
label: localeService.t<LocaleKey>('drawing-ui.image-text-wrap.inFrontText'),
value: TextWrappingStyle.IN_FRONT_OF_TEXT,
icon: <TextWrapShapeIcon />,
},
@@ -362,7 +363,7 @@ function DocImageFloatingToolbar(props: IDocImageFloatingToolbarProps) {
>
<ToolbarGroup>
<ToolbarDropdownButton
title={wrappingStyleOptions.find((option) => option.value === wrappingStyle)?.label ?? localeService.t('drawing-ui.image-text-wrap.inline')}
title={wrappingStyleOptions.find((option) => option.value === wrappingStyle)?.label ?? localeService.t<LocaleKey>('drawing-ui.image-text-wrap.inline')}
value={wrappingStyle}
options={wrappingStyleOptions}
onChange={updateWrappingStyle}
@@ -371,7 +372,7 @@ function DocImageFloatingToolbar(props: IDocImageFloatingToolbarProps) {
<Separator orientation="vertical" />
<ToolbarGroup>
<ToolbarButton
title={editItem ? localeService.t(editItem.label) : localeService.t('drawing-ui.image-popup.edit')}
title={editItem ? localeService.t<LocaleKey>(editItem.label) : localeService.t<LocaleKey>('drawing-ui.image-popup.edit')}
disabled={!editItem || editItem.disable}
onClick={() => {
setHidden(true);
@@ -381,7 +382,7 @@ function DocImageFloatingToolbar(props: IDocImageFloatingToolbarProps) {
<DocSettingIcon />
</ToolbarButton>
<ToolbarButton
title={cropItem ? localeService.t(cropItem.label) : localeService.t('drawing-ui.image-popup.crop')}
title={cropItem ? localeService.t<LocaleKey>(cropItem.label) : localeService.t<LocaleKey>('drawing-ui.image-popup.crop')}
disabled={!cropItem || cropItem.disable}
onClick={() => executeMenuItem(cropItem)}
>
@@ -391,7 +392,7 @@ function DocImageFloatingToolbar(props: IDocImageFloatingToolbarProps) {
<Separator orientation="vertical" />
<ToolbarGroup>
<ToolbarButton
title={deleteItem ? localeService.t(deleteItem.label) : localeService.t('drawing-ui.image-popup.delete')}
title={deleteItem ? localeService.t<LocaleKey>(deleteItem.label) : localeService.t<LocaleKey>('drawing-ui.image-popup.delete')}
disabled={!deleteItem || deleteItem.disable}
onClick={() => executeMenuItem(deleteItem)}
>
@@ -15,6 +15,7 @@
*/
import type { ICommand } from '@univerjs/core';
import type { LocaleKey } from '../../locale/types';
import { CommandType, IConfirmService, LocaleService } from '@univerjs/core';
import { MessageType } from '@univerjs/design';
import { IMessageService } from '@univerjs/ui';
@@ -41,9 +42,9 @@ export const ReplaceAllMatchesCommand: ICommand = {
if (!await confirmService.confirm({
id: CONFIRM_REPLACE_ALL_ID,
title: { title: localeService.t('find-replace.replace.confirm.title') },
cancelText: localeService.t('find-replace.button.cancel'),
confirmText: localeService.t('find-replace.button.confirm'),
title: { title: localeService.t<LocaleKey>('find-replace.replace.confirm.title') },
cancelText: localeService.t<LocaleKey>('find-replace.button.cancel'),
confirmText: localeService.t<LocaleKey>('find-replace.button.confirm'),
})) {
return false;
}
@@ -56,12 +57,12 @@ export const ReplaceAllMatchesCommand: ICommand = {
if (success === 0) {
messageService.show({
type: MessageType.Error,
content: localeService.t('find-replace.replace.all-failure'),
content: localeService.t<LocaleKey>('find-replace.replace.all-failure'),
});
} else {
messageService.show({
type: MessageType.Warning,
content: localeService.t('find-replace.replace.partial-success', `${success}`, `${failure}`),
content: localeService.t<LocaleKey>('find-replace.replace.partial-success', `${success}`, `${failure}`),
});
}
@@ -70,7 +71,7 @@ export const ReplaceAllMatchesCommand: ICommand = {
messageService.show({
type: MessageType.Success,
content: localeService.t('find-replace.replace.all-success', `${success}`),
content: localeService.t<LocaleKey>('find-replace.replace.all-success', `${success}`),
});
return true;
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': 'تم استبدال {0} تطابقات',
'partial-success': 'تم استبدال {0} تطابقات، وتعذر استبدال {1}',
'all-failure': 'فشل الاستبدال',
confirm: {
title: 'هل أنت متأكد من استبدال جميع التطابقات؟',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': 'S\'han reemplaçat totes les {0} coincidències',
'partial-success': 'S\'han reemplaçat {0} coincidències, no s\'han pogut reemplaçar {1}',
'all-failure': 'Error en el reemplaçament',
confirm: {
title: 'Esteu segur que voleu reemplaçar totes les coincidències?',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': 'Alle {0} Treffer ersetzt',
'partial-success': '{0} Treffer ersetzt, {1} konnten nicht ersetzt werden',
'all-failure': 'Ersetzen fehlgeschlagen',
confirm: {
title: 'Sollen alle Treffer ersetzt werden?',
@@ -56,6 +56,7 @@ const locale = {
},
replace: {
'all-success': 'Replaced all {0} matches',
'partial-success': 'Replaced {0} matches, failed to replace {1}',
'all-failure': 'Replace failed',
confirm: {
title: 'Are you sure to replace all matches?',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': 'Se reemplazaron todas las {0} coincidencias',
'partial-success': 'Se reemplazaron {0} coincidencias; no se pudieron reemplazar {1}',
'all-failure': 'Error al reemplazar',
confirm: {
title: '¿Está seguro de que desea reemplazar todas las coincidencias?',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': 'همه {0} مورد تطابق جایگزین شدند',
'partial-success': '{0} مورد تطابق جایگزین شد، جایگزینی {1} مورد ناموفق بود',
'all-failure': 'جایگزینی ناموفق بود',
confirm: {
title: 'آیا مطمئن هستید که می‌خواهید همه موارد تطابق را جایگزین کنید؟',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': 'Toutes les {0} correspondances ont été remplacées',
'partial-success': '{0} correspondances ont été remplacées, {1} ont échoué',
'all-failure': 'Échec du remplacement',
confirm: {
title: 'Êtes-vous sûr de vouloir remplacer toutes les correspondances ?',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': 'Berhasil mengganti {0} kecocokan',
'partial-success': 'Berhasil mengganti {0} kecocokan, gagal mengganti {1}',
'all-failure': 'Penggantian gagal',
confirm: {
title: 'Apakah Anda yakin ingin mengganti semua kecocokan?',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': 'Sostituite tutte le {0} corrispondenze',
'partial-success': 'Sostituite {0} corrispondenze, {1} non sostituite',
'all-failure': 'Sostituzione non riuscita',
confirm: {
title: 'Sei sicuro di voler sostituire tutte le corrispondenze?',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': '一致項目 {0} 件すべてを置換しました',
'partial-success': '{0} 件の一致項目を置換しました。{1} 件の置換に失敗しました',
'all-failure': '置換に失敗しました',
confirm: {
title: 'すべての一致項目を置換してもよろしいですか?',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': '일치 항목 {0}개를 모두 바꿨습니다.',
'partial-success': '일치 항목 {0}개를 바꾸고 {1}개는 바꾸지 못했습니다.',
'all-failure': '바꾸기 실패',
confirm: {
title: '모든 일치 항목을 바꾸시겠습니까?',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': 'Zastąpiono wszystkie dopasowania: {0}',
'partial-success': 'Zastąpiono dopasowania: {0}, nie udało się zastąpić: {1}',
'all-failure': 'Zastępowanie nie powiodło się',
confirm: {
title: 'Czy na pewno chcesz zastąpić wszystkie dopasowania?',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': 'Substituídas todas as {0} correspondências',
'partial-success': '{0} correspondências substituídas, falha ao substituir {1}',
'all-failure': 'Falha na substituição',
confirm: {
title: 'Tem certeza de que deseja substituir todas as correspondências?',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': 'Заменены все совпадения: {0}',
'partial-success': 'Заменено совпадений: {0}, не удалось заменить: {1}',
'all-failure': 'Ошибка замены',
confirm: {
title: 'Вы уверены, что хотите заменить все совпадения?',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': 'Všetkých {0} zhôd bolo nahradených',
'partial-success': 'Nahradených {0} zhôd, {1} sa nepodarilo nahradiť',
'all-failure': 'Nahradenie zlyhalo',
confirm: {
title: 'Ste si istí, že chcete nahradiť všetky zhody?',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': 'Đã thay thế tất cả {0} kết quả phù hợp',
'partial-success': 'Đã thay thế {0} kết quả phù hợp, không thể thay thế {1}',
'all-failure': 'Thay thế thất bại',
confirm: {
title: 'Bạn có chắc chắn muốn thay thế tất cả các kết quả phù hợp không?',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': '已全部替换 {0} 个匹配项',
'partial-success': '已替换 {0} 个匹配项,{1} 个替换失败',
'all-failure': '替换失败',
confirm: {
title: '确定要替换所有的匹配项吗?',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': '已取代全部 {0} 個相符項目',
'partial-success': '已取代 {0} 個相符項目,{1} 個取代失敗',
'all-failure': '取代失敗',
confirm: {
title: '確定要取代所有相符項目嗎?',
@@ -58,6 +58,7 @@ const locale: typeof enUS = {
},
replace: {
'all-success': '已取代全部 {0} 個相符項目',
'partial-success': '已取代 {0} 個相符項目,{1} 個取代失敗',
'all-failure': '取代失敗',
confirm: {
title: '確定要取代所有相符項目嗎?',
@@ -17,6 +17,7 @@
import type { Workbook } from '@univerjs/core';
import type { IColorScale, IConditionalFormattingRuleConfig } from '@univerjs/sheets-conditional-formatting';
import type { IFormulaEditorRef } from '@univerjs/sheets-formula-ui';
import type { LocaleKey } from '../../../locale/types';
import type { IStyleEditorProps } from './type';
import { IUniverInstanceService, LocaleService, UniverInstanceType } from '@univerjs/core';
import { borderClassName, clsx, InputNumber, Select } from '@univerjs/design';
@@ -28,10 +29,13 @@ import { ColorPicker } from '../../ColorPicker';
import { Preview } from '../../Preview';
import { previewClassName } from './styles';
const createOptionItem = (text: string, localeService: LocaleService) => ({ label: localeService.t(`sheets-conditional-formatting-ui.valueType.${text}`), value: text });
const createOptionItem = (text: string, localeService: LocaleService) => ({
label: localeService.t(`sheets-conditional-formatting-ui.valueType.${text}`),
value: text,
});
const TextInput = (props: { id: string; type: CFValueType | 'none'; value: number | string; onChange: (v: number | string) => void; className: string }) => {
const { type, className, onChange, id, value } = props;
const { type, className, onChange, value } = props;
const univerInstanceService = useDependency(IUniverInstanceService);
const unitId = univerInstanceService.getCurrentUnitOfType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();
const subUnitId = univerInstanceService.getCurrentUnitOfType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet()?.getSheetId();
@@ -230,7 +234,7 @@ export const ColorScaleStyleEditor = (props: IStyleEditorProps) => {
dark:!univer-text-gray-200
`}
>
{localeService.t('sheets-conditional-formatting-ui.panel.styleRule')}
{localeService.t<LocaleKey>('sheets-conditional-formatting-ui.panel.styleRule')}
</div>
<div className={previewClassName}>
<Preview rule={getResult({ minType, medianType, maxType, minValue, medianValue, maxValue, minColor, medianColor, maxColor }) as IConditionalFormattingRuleConfig} />
@@ -241,7 +245,7 @@ export const ColorScaleStyleEditor = (props: IStyleEditorProps) => {
dark:!univer-text-gray-200
`}
>
{localeService.t('sheets-conditional-formatting-ui.valueType.min')}
{localeService.t<LocaleKey>('sheets-conditional-formatting-ui.valueType.min')}
</div>
<div className="univer-mt-3 univer-flex univer-h-8 univer-items-center">
<Select
@@ -310,7 +314,7 @@ export const ColorScaleStyleEditor = (props: IStyleEditorProps) => {
dark:!univer-text-gray-200
`}
>
{localeService.t('sheets-conditional-formatting-ui.panel.medianValue')}
{localeService.t<LocaleKey>('sheets-conditional-formatting-ui.panel.medianValue')}
</div>
<div className="univer-mt-3 univer-flex univer-h-8 univer-items-center">
<Select
@@ -383,7 +387,7 @@ export const ColorScaleStyleEditor = (props: IStyleEditorProps) => {
dark:!univer-text-gray-200
`}
>
{localeService.t('sheets-conditional-formatting-ui.valueType.max')}
{localeService.t<LocaleKey>('sheets-conditional-formatting-ui.valueType.max')}
</div>
<div className="univer-mt-3 univer-flex univer-h-8 univer-items-center">
<Select
@@ -21,6 +21,7 @@ import type {
ITextHighlightCell,
ITimePeriodHighlightCell,
} from '@univerjs/sheets-conditional-formatting';
import type { LocaleKey } from '../../../locale/types';
import type { IStyleEditorProps } from './type';
import { LocaleService } from '@univerjs/core';
import { Input, InputNumber, Select } from '@univerjs/design';
@@ -39,7 +40,10 @@ import { Preview } from '../../Preview';
import { WrapperError } from '../../wrapper-error/WrapperError';
import { previewClassName } from './styles';
const createOptionItem = (text: string, localeService: LocaleService) => ({ label: localeService.t(`sheets-conditional-formatting-ui.operator.${text}`), value: text });
const createOptionItem = (text: string, localeService: LocaleService) => ({
label: localeService.t(`sheets-conditional-formatting-ui.operator.${text}`),
value: text,
});
type IValue = number | string | [number, number];
type IResult = (Pick<ITextHighlightCell | INumberHighlightCell | ITimePeriodHighlightCell, 'operator' | 'subType'>) & { value?: IValue };
@@ -92,7 +96,7 @@ function HighlightCellInput(props: {
case CFSubRuleType.text: {
if ([CFTextOperator.beginsWith, CFTextOperator.containsText, CFTextOperator.endsWith, CFTextOperator.notEqual, CFTextOperator.notContainsText, CFTextOperator.equal].includes(operator as any)) {
if (!inputTextValue) {
setTextError(localeService.t('sheets-conditional-formatting-ui.errorMessage.notBlank'));
setTextError(localeService.t<LocaleKey>('sheets-conditional-formatting-ui.errorMessage.notBlank'));
return false;
}
return next(v);
@@ -245,19 +249,19 @@ export const HighlightCellStyleEditor = (props: IStyleEditorProps<any, ITextHigh
const typeOptions = [{
value: CFSubRuleType.text,
label: localeService.t('sheets-conditional-formatting-ui.subRuleType.text'),
label: localeService.t<LocaleKey>('sheets-conditional-formatting-ui.subRuleType.text'),
}, {
value: CFSubRuleType.number,
label: localeService.t('sheets-conditional-formatting-ui.subRuleType.number'),
label: localeService.t<LocaleKey>('sheets-conditional-formatting-ui.subRuleType.number'),
}, {
value: CFSubRuleType.timePeriod,
label: localeService.t('sheets-conditional-formatting-ui.subRuleType.timePeriod'),
label: localeService.t<LocaleKey>('sheets-conditional-formatting-ui.subRuleType.timePeriod'),
}, {
value: CFSubRuleType.duplicateValues,
label: localeService.t('sheets-conditional-formatting-ui.subRuleType.duplicateValues'),
label: localeService.t<LocaleKey>('sheets-conditional-formatting-ui.subRuleType.duplicateValues'),
}, {
value: CFSubRuleType.uniqueValues,
label: localeService.t('sheets-conditional-formatting-ui.subRuleType.uniqueValues'),
label: localeService.t<LocaleKey>('sheets-conditional-formatting-ui.subRuleType.uniqueValues'),
}];
const operatorOptions = useMemo(() => getOperatorOptions(subType, localeService), [subType]);
@@ -373,7 +377,7 @@ export const HighlightCellStyleEditor = (props: IStyleEditorProps<any, ITextHigh
dark:!univer-text-gray-200
`}
>
{localeService.t('sheets-conditional-formatting-ui.panel.styleRule')}
{localeService.t<LocaleKey>('sheets-conditional-formatting-ui.panel.styleRule')}
</div>
<div className="univer-flex univer-justify-between univer-gap-4">
<Select
@@ -17,6 +17,7 @@
import type { Workbook } from '@univerjs/core';
import type { IIconSet } from '@univerjs/sheets-conditional-formatting';
import type { IFormulaEditorRef } from '@univerjs/sheets-formula-ui';
import type { LocaleKey } from '../../../locale/types';
import type { IStyleEditorProps } from './type';
import { get, IUniverInstanceService, LocaleService, set, Tools, UniverInstanceType } from '@univerjs/core';
import { borderClassName, Checkbox, clsx, Dropdown, InputNumber, Select } from '@univerjs/design';
@@ -125,7 +126,9 @@ const IconGroupList = forwardRef<HTMLDivElement, IIconGroupListProps>((props, re
{iconGroup.map((group, index) => {
return (
<div key={index} className="univer-mb-3">
<div className="univer-mb-1 univer-text-sm">{localeService.t(group.title)}</div>
<div className="univer-mb-1 univer-text-sm">
{localeService.t(group.title)}
</div>
<div className="univer-flex univer-flex-wrap">
{group.group.map((groupItem) => {
return (
@@ -226,12 +229,30 @@ const IconSetRuleEdit = (props: {
const { onChange, configList, errorMap = {} } = props;
const localeService = useDependency(LocaleService);
const options = [{ label: localeService.t(`sheets-conditional-formatting-ui.symbol.${CFNumberOperator.greaterThan}`), value: CFNumberOperator.greaterThan }, { label: localeService.t(`sheets-conditional-formatting-ui.symbol.${CFNumberOperator.greaterThanOrEqual}`), value: CFNumberOperator.greaterThanOrEqual }];
const options = [{
label: localeService.t<LocaleKey>(`sheets-conditional-formatting-ui.symbol.${CFNumberOperator.greaterThan}`),
value: CFNumberOperator.greaterThan,
}, {
label: localeService.t<LocaleKey>(`sheets-conditional-formatting-ui.symbol.${CFNumberOperator.greaterThanOrEqual}`),
value: CFNumberOperator.greaterThanOrEqual,
}];
const valueTypeOptions = [
{ label: localeService.t(`sheets-conditional-formatting-ui.valueType.${CFValueType.num}`), value: CFValueType.num },
{ label: localeService.t(`sheets-conditional-formatting-ui.valueType.${CFValueType.percent}`), value: CFValueType.percent },
{ label: localeService.t(`sheets-conditional-formatting-ui.valueType.${CFValueType.percentile}`), value: CFValueType.percentile },
{ label: localeService.t(`sheets-conditional-formatting-ui.valueType.${CFValueType.formula}`), value: CFValueType.formula },
{
label: localeService.t<LocaleKey>(`sheets-conditional-formatting-ui.valueType.${CFValueType.num}`),
value: CFValueType.num,
},
{
label: localeService.t<LocaleKey>(`sheets-conditional-formatting-ui.valueType.${CFValueType.percent}`),
value: CFValueType.percent,
},
{
label: localeService.t<LocaleKey>(`sheets-conditional-formatting-ui.valueType.${CFValueType.percentile}`),
value: CFValueType.percentile,
},
{
label: localeService.t<LocaleKey>(`sheets-conditional-formatting-ui.valueType.${CFValueType.formula}`),
value: CFValueType.formula,
},
];
const handleValueValueChange = (v: number | string, index: number) => {
onChange([String(index), 'value', 'value'], v);
@@ -256,7 +277,7 @@ const IconSetRuleEdit = (props: {
const isEnd = index === configList.length - 1;
const isFirst = index === 0;
const preItem = configList[index - 1];
const lessThanText = preItem?.value.type === CFValueType.formula ? localeService.t('sheets-conditional-formatting-ui.valueType.formula') : preItem?.value.value;
const lessThanText = preItem?.value.type === CFValueType.formula ? localeService.t<LocaleKey>('sheets-conditional-formatting-ui.valueType.formula') : preItem?.value.value;
const handleIconClick = (iconType: IIconSetType, iconId: string) => {
const value = { ...item, iconId, iconType } as typeof item;
@@ -277,13 +298,13 @@ const IconSetRuleEdit = (props: {
<div
className="univer-w-[45%]"
>
{localeService.t('sheets-conditional-formatting-ui.iconSet.icon')}
{localeService.t<LocaleKey>('sheets-conditional-formatting-ui.iconSet.icon')}
{index + 1}
</div>
<div className="univer-w-[45%]">
<>
{!isFirst && !isEnd && localeService.t('sheets-conditional-formatting-ui.iconSet.rule')}
{!isFirst && !isEnd && localeService.t<LocaleKey>('sheets-conditional-formatting-ui.iconSet.rule')}
{!isFirst && !isEnd && (
<span
className={`
@@ -291,10 +312,10 @@ const IconSetRuleEdit = (props: {
dark:!univer-text-gray-200
`}
>
{localeService.t('sheets-conditional-formatting-ui.iconSet.when')}
{localeService.t<LocaleKey>('sheets-conditional-formatting-ui.iconSet.when')}
{localeService.t(`sheets-conditional-formatting-ui.symbol.${getOppositeOperator(preItem.operator)}`)}
{lessThanText}
{isEnd ? '' : ` ${localeService.t('sheets-conditional-formatting-ui.iconSet.and')} `}
{isEnd ? '' : ` ${localeService.t<LocaleKey>('sheets-conditional-formatting-ui.iconSet.and')} `}
</span>
)}
@@ -341,12 +362,12 @@ const IconSetRuleEdit = (props: {
dark:!univer-text-gray-200
`}
>
{localeService.t('sheets-conditional-formatting-ui.iconSet.rule')}
{localeService.t<LocaleKey>('sheets-conditional-formatting-ui.iconSet.rule')}
<span className="univer-font-medium">
{localeService.t('sheets-conditional-formatting-ui.iconSet.when')}
{localeService.t<LocaleKey>('sheets-conditional-formatting-ui.iconSet.when')}
{localeService.t(`sheets-conditional-formatting-ui.symbol.${getOppositeOperator(preItem.operator)}`)}
{lessThanText}
{isEnd ? '' : ` ${localeService.t('sheets-conditional-formatting-ui.iconSet.and')} `}
{isEnd ? '' : ` ${localeService.t<LocaleKey>('sheets-conditional-formatting-ui.iconSet.and')} `}
</span>
</div>
)}
@@ -361,8 +382,8 @@ const IconSetRuleEdit = (props: {
dark:!univer-text-gray-200
`}
>
<div>{localeService.t('sheets-conditional-formatting-ui.iconSet.type')}</div>
<div>{localeService.t('sheets-conditional-formatting-ui.iconSet.value')}</div>
<div>{localeService.t<LocaleKey>('sheets-conditional-formatting-ui.iconSet.type')}</div>
<div>{localeService.t<LocaleKey>('sheets-conditional-formatting-ui.iconSet.value')}</div>
</div>
<div
className="univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4"
@@ -556,7 +577,7 @@ export const IconSet = (props: IStyleEditorProps<unknown, IIconSet>) => {
return (
<div>
<div className="univer-mt-4 univer-text-sm univer-text-gray-600">
{localeService.t('sheets-conditional-formatting-ui.panel.styleRule')}
{localeService.t<LocaleKey>('sheets-conditional-formatting-ui.panel.styleRule')}
</div>
<div className="univer-mt-3">
<Dropdown
@@ -588,11 +609,11 @@ export const IconSet = (props: IStyleEditorProps<unknown, IIconSet>) => {
<div className="univer-mt-3 univer-flex univer-items-center univer-text-xs">
<div className="univer-flex univer-items-center univer-text-xs">
<Checkbox onChange={reverseIcon} />
{localeService.t('sheets-conditional-formatting-ui.iconSet.reverseIconOrder')}
{localeService.t<LocaleKey>('sheets-conditional-formatting-ui.iconSet.reverseIconOrder')}
</div>
<div className="univer-ml-6 univer-flex univer-items-center univer-text-xs">
<Checkbox checked={!isShowValue} onChange={(v) => { setIsShowValue(!v); }} />
{localeService.t('sheets-conditional-formatting-ui.iconSet.onlyShowIcon')}
{localeService.t<LocaleKey>('sheets-conditional-formatting-ui.iconSet.onlyShowIcon')}
</div>
</div>
<IconSetRuleEdit errorMap={errorMap} onChange={handleChange} configList={configList} />
@@ -14,6 +14,7 @@
* limitations under the License.
*/
import type { LocaleKey } from '../locale/types';
import { ICON_MAP } from '../assets/icon-map';
export enum IIconSetType {
@@ -41,7 +42,7 @@ export enum IIconSetType {
empty = 'EMPTY_ICON_TYPE',
}
export const iconGroup: { title: string; group: { name: IIconSetType; list: string[] }[] }[] = [
export const iconGroup: { title: LocaleKey; group: { name: IIconSetType; list: string[] }[] }[] = [
{
title: 'sheets-conditional-formatting.iconSet.direction',
group: [
@@ -26,6 +26,7 @@ import type {
} from '@univerjs/core';
import type { IUpdateSheetDataValidationRangeCommandParams } from '@univerjs/sheets-data-validation';
import type { IRangeSelectorInstance } from '@univerjs/sheets-formula-ui';
import type { LocaleKey } from '../../locale/types';
import {
debounce,
ICommandService,
@@ -311,8 +312,8 @@ function DataValidationDetailInner(props: { activeRuleInfo: { unitId: string; su
return (
<div data-u-comp="data-validation-detail" className="univer-py-2">
<FormLayout
label={localeService.t('sheets-data-validation-ui.panel.range')}
error={(!localRule.ranges.length || isRangeError) ? localeService.t('sheets-data-validation-ui.panel.rangeError') : ''}
label={localeService.t<LocaleKey>('sheets-data-validation-ui.panel.range')}
error={(!localRule.ranges.length || isRangeError) ? localeService.t<LocaleKey>('sheets-data-validation-ui.panel.rangeError') : ''}
>
<RangeSelector
selectorRef={rangeSelectorInstance}
@@ -333,7 +334,7 @@ function DataValidationDetailInner(props: { activeRuleInfo: { unitId: string; su
onVerify={(isValid) => setIsRangeError(!isValid)}
/>
</FormLayout>
<FormLayout label={localeService.t('sheets-data-validation-ui.panel.type')}>
<FormLayout label={localeService.t<LocaleKey>('sheets-data-validation-ui.panel.type')}>
<Select
className="univer-w-full"
value={localRule.type}
@@ -346,14 +347,14 @@ function DataValidationDetailInner(props: { activeRuleInfo: { unitId: string; su
</FormLayout>
{operators?.length
? (
<FormLayout label={localeService.t('sheets-data-validation-ui.panel.operator')}>
<FormLayout label={localeService.t<LocaleKey>('sheets-data-validation-ui.panel.operator')}>
<Select
className="univer-w-full"
value={`${localRule.operator}`}
options={[
{
value: '',
label: localeService.t('sheets-data-validation-ui.operators.legal'),
label: localeService.t<LocaleKey>('sheets-data-validation-ui.operators.legal'),
},
...operators.map((op, i) => ({
value: `${op}`,
@@ -401,16 +402,16 @@ function DataValidationDetailInner(props: { activeRuleInfo: { unitId: string; su
allowBlank: !(localRule.allowBlank ?? true),
})}
>
{localeService.t('sheets-data-validation-ui.panel.allowBlank')}
{localeService.t<LocaleKey>('sheets-data-validation-ui.panel.allowBlank')}
</Checkbox>
</FormLayout>
<DataValidationOptions value={options} onChange={handleUpdateRuleOptions} extraComponent={validator.optionsInput} />
<div className="univer-mt-5 univer-flex univer-flex-row univer-justify-end">
<Button className="univer-ml-3" onClick={handleDelete}>
{localeService.t('sheets-data-validation-ui.panel.removeRule')}
{localeService.t<LocaleKey>('sheets-data-validation-ui.panel.removeRule')}
</Button>
<Button className="univer-ml-3" variant="primary" onClick={handleOk}>
{localeService.t('sheets-data-validation-ui.panel.done')}
{localeService.t<LocaleKey>('sheets-data-validation-ui.panel.done')}
</Button>
</div>
</div>
@@ -17,6 +17,7 @@
import type { CellValue, IDataValidationRule, IDataValidationRuleBase, ISheetDataValidationRule, Nullable } from '@univerjs/core';
import type { IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
import type { ISheetLocationBase } from '@univerjs/sheets';
import type { LocaleKey } from '../locale/types';
import { DataValidationOperator, DataValidationType, dateKit, isFormulaString, numfmt, Tools } from '@univerjs/core';
import { LexerTreeBuilder } from '@univerjs/engine-formula';
import { DateOperatorErrorTitleMap, DateOperatorNameMap, DateOperatorTitleMap } from '../common/date-text-map';
@@ -106,7 +107,7 @@ export class DateValidator extends BaseSheetValidator {
}
const formula1Success = this._validatorSingleFormula(rule.formula1);
const errorMsg = this.localeService.t('sheets-data-validation.validFail.date');
const errorMsg = this.localeService.t<LocaleKey>('sheets-data-validation.validFail.date');
const isTwoFormula = TWO_FORMULA_OPERATOR_COUNT.includes(operator);
if (isTwoFormula) {
const formula2Success = this._validatorSingleFormula(rule.formula2);
@@ -17,6 +17,7 @@
import type { CellValue, IDataValidationRule, IDataValidationRuleBase, ISheetDataValidationRule, Nullable } from '@univerjs/core';
import type { IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
import type { ISheetLocationBase } from '@univerjs/sheets';
import type { LocaleKey } from '../locale/types';
import { DataValidationOperator, DataValidationType, isFormulaString, Tools } from '@univerjs/core';
import { LexerTreeBuilder } from '@univerjs/engine-formula';
import { DataValidationCustomFormulaService } from '../services/dv-custom-formula.service';
@@ -103,7 +104,7 @@ export class DecimalValidator extends BaseSheetValidator {
const formula1Success = Tools.isDefine(rule.formula1) && this._isFormulaOrNumber(rule.formula1);
const formula2Success = Tools.isDefine(rule.formula2) && this._isFormulaOrNumber(rule.formula2);
const isTwoFormula = TWO_FORMULA_OPERATOR_COUNT.includes(operator);
const errorMsg = this.localeService.t('sheets-data-validation.validFail.number');
const errorMsg = this.localeService.t<LocaleKey>('sheets-data-validation.validFail.number');
if (isTwoFormula) {
return {
success: formula1Success && formula2Success,
@@ -17,6 +17,7 @@
import type { CellValue, IDataValidationRule, IDataValidationRuleBase, ISheetDataValidationRule, Nullable } from '@univerjs/core';
import type { IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
import type { ISheetLocationBase } from '@univerjs/sheets';
import type { LocaleKey } from '../locale/types';
import { DataValidationOperator, DataValidationType, isFormulaString, Tools } from '@univerjs/core';
import { LexerTreeBuilder } from '@univerjs/engine-formula';
import { DataValidationCustomFormulaService } from '../services/dv-custom-formula.service';
@@ -62,7 +63,7 @@ export class TextLengthValidator extends BaseSheetValidator {
const formula1Success = Tools.isDefine(rule.formula1) && this._isFormulaOrInt(rule.formula1);
const formula2Success = Tools.isDefine(rule.formula2) && this._isFormulaOrInt(rule.formula2);
const isTwoFormula = TWO_FORMULA_OPERATOR_COUNT.includes(operator);
const errorMsg = this.localeService.t('sheets-data-validation.validFail.number');
const errorMsg = this.localeService.t<LocaleKey>('sheets-data-validation.validFail.number');
if (isTwoFormula) {
return {
success: formula1Success && formula2Success,
@@ -17,6 +17,7 @@
import type { CellValue, IDataValidationRule, IDataValidationRuleBase, ISheetDataValidationRule, Nullable } from '@univerjs/core';
import type { IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
import type { ISheetLocationBase } from '@univerjs/sheets';
import type { LocaleKey } from '../locale/types';
import { DataValidationOperator, DataValidationType, isFormulaString, Tools } from '@univerjs/core';
import { LexerTreeBuilder } from '@univerjs/engine-formula';
import { DataValidationCustomFormulaService } from '../services/dv-custom-formula.service';
@@ -33,7 +34,7 @@ export class WholeValidator extends BaseSheetValidator {
private readonly _lexerTreeBuilder = this.injector.get(LexerTreeBuilder);
id: string = DataValidationType.WHOLE;
title: string = 'sheets-data-validation.whole.title';
title: LocaleKey = 'sheets-data-validation.whole.title';
order = 10;
operators: DataValidationOperator[] = [
@@ -103,7 +104,7 @@ export class WholeValidator extends BaseSheetValidator {
const formula1Success = Tools.isDefine(rule.formula1) && this._isFormulaOrInt(rule.formula1);
const formula2Success = Tools.isDefine(rule.formula2) && this._isFormulaOrInt(rule.formula2);
const isTwoFormula = TWO_FORMULA_OPERATOR_COUNT.includes(operator);
const errorMsg = this.localeService.t('sheets-data-validation.validFail.number');
const errorMsg = this.localeService.t<LocaleKey>('sheets-data-validation.validFail.number');
if (isTwoFormula) {
return {
success: formula1Success && formula2Success,
@@ -17,6 +17,7 @@
import type { ICommandInfo } from '@univerjs/core';
import type { MenuConfig } from '@univerjs/ui';
import type { IOpenFilterPanelOperationParams } from '../commands/operations/sheets-filter.operation';
import type { LocaleKey } from '../locale/types';
import { Disposable, ICommandService, Inject, Injector, IUniverInstanceService, LocaleService, Tools } from '@univerjs/core';
import { expandToContinuousRange, getSheetCommandTarget, RangeProtectionPermissionViewPoint, SheetPermissionCheckController, SheetsSelectionsService, WorksheetFilterPermission, WorksheetViewPermission } from '@univerjs/sheets';
import { SheetsFilterService, SmartToggleSheetsFilterCommand } from '@univerjs/sheets-filter';
@@ -80,7 +81,7 @@ export class SheetsFilterPermissionController extends Disposable {
}
if (!permission) {
this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t('sheets-filter-ui.permission.filterErr'));
this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t<LocaleKey>('sheets-filter-ui.permission.filterErr'));
}
}
if (command.id === OpenFilterPanelOperation.id) {
@@ -96,7 +97,7 @@ export class SheetsFilterPermissionController extends Disposable {
worksheetTypes: [WorksheetFilterPermission, WorksheetViewPermission],
}, [colRange], unitId, subUnitId);
if (!permission) {
this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t('sheets-filter-ui.permission.filterErr'));
this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t<LocaleKey>('sheets-filter-ui.permission.filterErr'));
}
}
}
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': 'تبديل التصفية',
},
permission: {
filterErr: 'ليس لديك إذن لاستخدام التصفية.',
},
panel: {
'clear-filter': 'مسح التصفية',
cancel: 'إلغاء',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': 'Alterna el filtre',
},
permission: {
filterErr: 'No teniu permís per utilitzar el filtre.',
},
panel: {
'clear-filter': 'Neteja el filtre',
cancel: 'Cancel·la',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': 'Filter ein-/ausschalten',
},
permission: {
filterErr: 'Sie haben keine Berechtigung, den Filter zu verwenden.',
},
panel: {
'clear-filter': 'Filter löschen',
cancel: 'Abbrechen',
@@ -24,6 +24,9 @@ const locale = {
shortcut: {
'smart-toggle-filter': 'Toggle Filter',
},
permission: {
filterErr: 'You do not have permission to use the filter.',
},
panel: {
'clear-filter': 'Clear Filter',
cancel: 'Cancel',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': 'Alternar filtro',
},
permission: {
filterErr: 'No tiene permiso para usar el filtro.',
},
panel: {
'clear-filter': 'Borrar filtro',
cancel: 'Cancelar',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': 'تغییر حالت فیلتر',
},
permission: {
filterErr: 'شما مجوز استفاده از فیلتر را ندارید.',
},
panel: {
'clear-filter': 'پاک کردن فیلتر',
cancel: 'انصراف',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': 'Inverser le filtre',
},
permission: {
filterErr: 'Vous navez pas lautorisation dutiliser le filtre.',
},
panel: {
'clear-filter': 'Effacer le filtre',
cancel: 'Annuler',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': 'Aktifkan/Nonaktifkan Filter',
},
permission: {
filterErr: 'Anda tidak memiliki izin untuk menggunakan filter.',
},
panel: {
'clear-filter': 'Hapus Filter',
cancel: 'Batal',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': 'Attiva/disattiva filtro',
},
permission: {
filterErr: 'Non hai lautorizzazione per usare il filtro.',
},
panel: {
'clear-filter': 'Cancella filtro',
cancel: 'Annulla',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': 'フィルタの切替',
},
permission: {
filterErr: 'フィルタを使用する権限がありません。',
},
panel: {
'clear-filter': 'フィルタをクリア',
cancel: 'キャンセル',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': '필터 토글',
},
permission: {
filterErr: '필터를 사용할 권한이 없습니다.',
},
panel: {
'clear-filter': '필터 지우기',
cancel: '취소',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': 'Przełącz filtr',
},
permission: {
filterErr: 'Nie masz uprawnień do używania filtra.',
},
panel: {
'clear-filter': 'Wyczyść filtr',
cancel: 'Anuluj',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': 'Alternar Filtro',
},
permission: {
filterErr: 'Você não tem permissão para usar o filtro.',
},
panel: {
'clear-filter': 'Limpar Filtro',
cancel: 'Cancelar',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': 'Переключить фильтр',
},
permission: {
filterErr: 'У вас нет разрешения на использование фильтра.',
},
panel: {
'clear-filter': 'Очистить фильтр',
cancel: 'Отмена',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': 'Prepnúť filter',
},
permission: {
filterErr: 'Nemáte povolenie používať filter.',
},
panel: {
'clear-filter': 'Vymazať filter',
cancel: 'Zrušiť',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': 'Chuyển đổi lọc',
},
permission: {
filterErr: 'Bạn không có quyền sử dụng bộ lọc.',
},
panel: {
'clear-filter': 'Xóa lọc',
cancel: 'Hủy bỏ',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': '切换筛选',
},
permission: {
filterErr: '你没有权限使用筛选。',
},
panel: {
'clear-filter': '清除筛选',
cancel: '取消',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': '切換篩選',
},
permission: {
filterErr: '你沒有權限使用篩選。',
},
panel: {
'clear-filter': '清除篩選',
cancel: '取消',
@@ -26,6 +26,9 @@ const locale: typeof enUS = {
shortcut: {
'smart-toggle-filter': '切換篩選',
},
permission: {
filterErr: '你沒有權限使用篩選。',
},
panel: {
'clear-filter': '清除篩選',
cancel: '取消',
@@ -15,6 +15,7 @@
*/
import type { ISelectProps } from '@univerjs/design';
import type { LocaleKey } from '../../locale/types';
import type { FilterOperator, IFilterConditionFormParams } from '../../models/conditions';
import type { ByConditionsModel } from '../../services/sheets-filter-panel.service';
import { LocaleService } from '@univerjs/core';
@@ -50,15 +51,15 @@ export function FilterByCondition(props: { model: ByConditionsModel }) {
model.onConditionFormChange(diffParams);
}, [model]);
const placeholder = localeService.t('sheets-filter-ui.panel.input-values-placeholder');
const placeholder = localeService.t<LocaleKey>('sheets-filter-ui.panel.input-values-placeholder');
function renderSecondaryCondition(operator: FilterOperator, val: string, name: 'operator1' | 'operator2') {
const shouldRenderInput = FilterConditionItems.getItemByOperator(operator).numOfParameters === 1;
return (
<>
{name === 'operator2' && (
<RadioGroup value={radioValue} onChange={onRadioChange}>
<Radio value="AND">{localeService.t('sheets-filter-ui.panel.and')}</Radio>
<Radio value="OR">{localeService.t('sheets-filter-ui.panel.or')}</Radio>
<Radio value="AND">{localeService.t<LocaleKey>('sheets-filter-ui.panel.and')}</Radio>
<Radio value="OR">{localeService.t<LocaleKey>('sheets-filter-ui.panel.or')}</Radio>
</RadioGroup>
)}
<Select
@@ -103,9 +104,9 @@ export function FilterByCondition(props: { model: ByConditionsModel }) {
data-u-comp="sheets-filter-panel-conditions-desc"
className="univer-mt-2 univer-text-xs univer-text-gray-500"
>
{localeService.t('sheets-filter-ui.panel.?')}
{localeService.t<LocaleKey>('sheets-filter-ui.panel.?')}
<br />
{localeService.t('sheets-filter-ui.panel.*')}
{localeService.t<LocaleKey>('sheets-filter-ui.panel.*')}
</div>
</div>
)
@@ -16,6 +16,7 @@
import type { IRange, Nullable, Styles, Workbook, Worksheet } from '@univerjs/core';
import type { FilterColumn } from '@univerjs/sheets-filter';
import type { LocaleKey } from '../locale/types';
import type { IFilterByValueItem, IFilterByValueWithTreeItem } from '../services/sheets-filter-panel.service';
import {
createIdentifier,
@@ -145,7 +146,7 @@ export function getFilterByValueItems(
const initialBlankChecked = filters ? blankChecked : true;
if (emptyCount > 0) {
const item: IFilterByValueItem = {
value: localeService.t('sheets-filter-ui.panel.empty'),
value: localeService.t<LocaleKey>('sheets-filter-ui.panel.empty'),
checked: initialBlankChecked,
count: emptyCount,
index,
@@ -304,7 +305,7 @@ export function getFilterTreeByValueItems(
: true;
if (emptyCount > 0) {
const item: IFilterByValueWithTreeItem = {
title: localeService.t('sheets-filter-ui.panel.empty'),
title: localeService.t<LocaleKey>('sheets-filter-ui.panel.empty'),
count: emptyCount,
leaf: true,
checked: initialBlankChecked,
@@ -16,6 +16,7 @@
import type { Workbook } from '@univerjs/core';
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
import type { LocaleKey } from '../locale/types';
import { Disposable, Inject, isICellData, LocaleService } from '@univerjs/core';
import { ErrorType, extractFormulaError, FormulaDataModel } from '@univerjs/engine-formula';
import { CellAlertManagerService, CellAlertType, HoverManagerService } from '@univerjs/sheets-ui';
@@ -95,7 +96,7 @@ export class FormulaAlertRenderController extends Disposable implements IRenderM
this._cellAlertManagerService.showAlert({
type: CellAlertType.ERROR,
title: this._localeService.t('sheets-formula-ui.error.title'),
title: this._localeService.t<LocaleKey>('sheets-formula-ui.error.title'),
message: this._localeService.t(`sheets-formula-ui.error.${ErrorTypeToMessageMap[errorType]}`),
location: cellPos.location,
width: 200,
@@ -15,8 +15,16 @@
*/
import type { ICommandInfo } from '@univerjs/core';
import type { LocaleKey } from '../locale/types';
import { Disposable, ICommandService, Inject, LocaleService } from '@univerjs/core';
import { RangeProtectionPermissionEditPoint, SheetPermissionCheckController, WorkbookEditablePermission, WorksheetEditPermission, WorksheetInsertHyperlinkPermission, WorksheetSetCellValuePermission } from '@univerjs/sheets';
import {
RangeProtectionPermissionEditPoint,
SheetPermissionCheckController,
WorkbookEditablePermission,
WorksheetEditPermission,
WorksheetInsertHyperlinkPermission,
WorksheetSetCellValuePermission,
} from '@univerjs/sheets';
import { InsertLinkShortcut } from '../menu/menu';
export class SheetsHyperLinkPermissionController extends Disposable {
@@ -40,7 +48,9 @@ export class SheetsHyperLinkPermissionController extends Disposable {
worksheetTypes: [WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission],
});
if (!permission) {
this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t('sheets-hyper-link-ui.permission.hyperLinkErr'));
this._sheetPermissionCheckController.blockExecuteWithoutPermission(
this._localeService.t<LocaleKey>('sheets-hyper-link-ui.permission.hyperLinkErr')
);
}
}
})
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: 'إدراج ارتباط تشعبي',
},
permission: {
hyperLinkErr: 'ليس لديك إذن لإدراج رابط.',
},
message: {
noSheet: 'تم حذف الورقة المستهدفة',
refError: 'نطاق غير صالح',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: 'Insereix enllaç',
},
permission: {
hyperLinkErr: 'No teniu permís per inserir un enllaç.',
},
message: {
noSheet: 'El full de destinació ha estat eliminat',
refError: 'Interval no vàlid',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: 'Link einfügen',
},
permission: {
hyperLinkErr: 'Sie haben keine Berechtigung, einen Link einzufügen.',
},
message: {
noSheet: 'Zielblatt wurde gelöscht',
refError: 'Ungültiger Bereich',
@@ -36,6 +36,9 @@ const locale = {
menu: {
add: 'Insert Link',
},
permission: {
hyperLinkErr: 'You do not have permission to insert a link.',
},
message: {
noSheet: 'Target sheet has been delete',
refError: 'Invalid Range',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: 'Insertar enlace',
},
permission: {
hyperLinkErr: 'No tiene permiso para insertar un enlace.',
},
message: {
noSheet: 'La hoja de destino ha sido eliminada',
refError: 'Rango no válido',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: 'درج لینک',
},
permission: {
hyperLinkErr: 'شما مجوز درج لینک را ندارید.',
},
message: {
noSheet: 'برگ هدف حذف شده است',
refError: 'محدوده نامعتبر',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: 'Insérer un lien',
},
permission: {
hyperLinkErr: 'Vous navez pas lautorisation dinsérer un lien.',
},
message: {
noSheet: 'La feuille cible a été supprimée',
refError: 'Plage invalide',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: 'Sisipkan Tautan',
},
permission: {
hyperLinkErr: 'Anda tidak memiliki izin untuk menyisipkan tautan.',
},
message: {
noSheet: 'Lembar target telah dihapus',
refError: 'Rentang Tidak Valid',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: 'Inserisci collegamento',
},
permission: {
hyperLinkErr: 'Non hai lautorizzazione per inserire un collegamento.',
},
message: {
noSheet: 'Il foglio di destinazione è stato eliminato',
refError: 'Intervallo non valido',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: 'リンクの挿入',
},
permission: {
hyperLinkErr: 'リンクを挿入する権限がありません。',
},
message: {
noSheet: '対象のワークシートが削除されました',
refError: '無効な範囲です',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: '링크 삽입',
},
permission: {
hyperLinkErr: '링크를 삽입할 권한이 없습니다.',
},
message: {
noSheet: '대상 워크시트가 삭제되었습니다',
refError: '잘못된 범위입니다',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: 'Wstaw łącze',
},
permission: {
hyperLinkErr: 'Nie masz uprawnień do wstawiania łącza.',
},
message: {
noSheet: 'Arkusz docelowy został usunięty',
refError: 'Nieprawidłowy zakres',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: 'Inserir Link',
},
permission: {
hyperLinkErr: 'Você não tem permissão para inserir um link.',
},
message: {
noSheet: 'A planilha de destino foi excluída',
refError: 'Intervalo Inválido',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: 'Вставить ссылку',
},
permission: {
hyperLinkErr: 'У вас нет разрешения на вставку ссылки.',
},
message: {
noSheet: 'Целевой лист был удален',
refError: 'Недопустимый диапазон',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: 'Vložiť odkaz',
},
permission: {
hyperLinkErr: 'Nemáte povolenie vložiť odkaz.',
},
message: {
noSheet: 'Cieľový hárok bol odstránený',
refError: 'Neplatný rozsah',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: 'Thêm liên kết',
},
permission: {
hyperLinkErr: 'Bạn không có quyền chèn liên kết.',
},
message: {
noSheet: 'Bảng con này đã bị xóa',
refError: 'Tham chiếu lỗi',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: '添加链接',
},
permission: {
hyperLinkErr: '你没有权限插入链接。',
},
message: {
noSheet: '该子表已被删除',
refError: '错误的引用',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: '新增連結',
},
permission: {
hyperLinkErr: '你沒有權限插入連結。',
},
message: {
noSheet: '該子表已被刪除',
refError: '錯誤的引用',
@@ -38,6 +38,9 @@ const locale: typeof enUS = {
menu: {
add: '新增連結',
},
permission: {
hyperLinkErr: '你沒有權限插入連結。',
},
message: {
noSheet: '該子表已被刪除',
refError: '錯誤的引用',
@@ -17,6 +17,7 @@
import type { IRange, Nullable, Workbook, Worksheet } from '@univerjs/core';
import type { ISheetRangeLocation } from '@univerjs/sheets';
import type { ISortOption } from '@univerjs/sheets-sort';
import type { LocaleKey } from '../locale/types';
import {
Disposable,
ICommandService,
@@ -157,13 +158,13 @@ export class SheetsSortUIService extends Disposable {
return await this._confirmService.confirm({
id: 'sort-range-check-error',
title: {
title: this._localeService.t('sheets-sort-ui.info.tooltip'),
title: this._localeService.t<LocaleKey>('sheets-sort-ui.info.tooltip'),
},
children: {
title: createSortCheckError(this._localeService.t(content)),
},
cancelText: this._localeService.t('sheets-sort-ui.dialog.cancel'),
confirmText: this._localeService.t('sheets-sort-ui.dialog.confirm'),
cancelText: this._localeService.t<LocaleKey>('sheets-sort-ui.dialog.cancel'),
confirmText: this._localeService.t<LocaleKey>('sheets-sort-ui.dialog.confirm'),
});
}
@@ -172,7 +173,7 @@ export class SheetsSortUIService extends Disposable {
const confirm = await this._confirmService.confirm({
id: 'extend-sort-range-dialog',
title: {
title: this._localeService.t('sheets-sort-ui.dialog.sort-reminder'),
title: this._localeService.t<LocaleKey>('sheets-sort-ui.dialog.sort-reminder'),
},
children: {
title: createExtendConfirm((value: string) => {
@@ -180,8 +181,8 @@ export class SheetsSortUIService extends Disposable {
}),
},
width: 400,
cancelText: this._localeService.t('sheets-sort-ui.dialog.cancel'),
confirmText: this._localeService.t('sheets-sort-ui.dialog.confirm'),
cancelText: this._localeService.t<LocaleKey>('sheets-sort-ui.dialog.cancel'),
confirmText: this._localeService.t<LocaleKey>('sheets-sort-ui.dialog.confirm'),
});
if (confirm) {
return shouldExtend ? EXTEND_TYPE.EXTEND : EXTEND_TYPE.KEEP;
@@ -15,12 +15,30 @@
*/
import type { ICommandInfo } from '@univerjs/core';
import type { IAddCommentCommandParams, IDeleteCommentCommandParams, IDeleteCommentTreeCommandParams, IResolveCommentCommandParams, IUpdateCommentCommandParams } from '@univerjs/thread-comment';
import type {
IAddCommentCommandParams,
IDeleteCommentCommandParams,
IDeleteCommentTreeCommandParams,
IResolveCommentCommandParams,
IUpdateCommentCommandParams,
} from '@univerjs/thread-comment';
import type { LocaleKey } from '../locale/types';
import { Disposable, ICommandService, Inject, LocaleService } from '@univerjs/core';
import { singleReferenceToGrid } from '@univerjs/engine-formula';
import { RangeProtectionPermissionViewPoint, SheetPermissionCheckController, WorkbookCommentPermission, WorksheetViewPermission } from '@univerjs/sheets';
import {
RangeProtectionPermissionViewPoint,
SheetPermissionCheckController,
WorkbookCommentPermission,
WorksheetViewPermission,
} from '@univerjs/sheets';
import { SheetsThreadCommentModel } from '@univerjs/sheets-thread-comment';
import { AddCommentCommand, DeleteCommentCommand, DeleteCommentTreeCommand, ResolveCommentCommand, UpdateCommentCommand } from '@univerjs/thread-comment';
import {
AddCommentCommand,
DeleteCommentCommand,
DeleteCommentTreeCommand,
ResolveCommentCommand,
UpdateCommentCommand,
} from '@univerjs/thread-comment';
import { ShowAddSheetCommentModalOperation, ToggleSheetCommentPanelOperation } from '../commands/operations/comment.operation';
export class SheetsThreadCommentPermissionController extends Disposable {
@@ -46,7 +64,7 @@ export class SheetsThreadCommentPermissionController extends Disposable {
worksheetTypes: [WorksheetViewPermission],
});
if (!permission) {
this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t('sheets-thread-comment-ui.permission.commentErr'));
this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t<LocaleKey>('sheets-thread-comment-ui.permission.commentErr'));
}
} else if (id === AddCommentCommand.id) {
const params = command.params as IAddCommentCommandParams;
@@ -60,7 +78,7 @@ export class SheetsThreadCommentPermissionController extends Disposable {
rangeTypes: [RangeProtectionPermissionViewPoint],
}, [{ startRow: row, startColumn: column, endRow: row, endColumn: column }], unitId, subUnitId);
if (!permission) {
this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t('sheets-thread-comment-ui.permission.commentErr'));
this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t<LocaleKey>('sheets-thread-comment-ui.permission.commentErr'));
}
} else if (id === UpdateCommentCommand.id) {
const params = command.params as IUpdateCommentCommandParams;
@@ -78,7 +96,7 @@ export class SheetsThreadCommentPermissionController extends Disposable {
rangeTypes: [RangeProtectionPermissionViewPoint],
}, [{ startRow: row, startColumn: column, endRow: row, endColumn: column }], unitId, subUnitId);
if (!permission) {
this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t('sheets-thread-comment-ui.permission.commentErr'));
this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t<LocaleKey>('sheets-thread-comment-ui.permission.commentErr'));
}
}
} else if (id === ResolveCommentCommand.id || id === DeleteCommentCommand.id || id === DeleteCommentTreeCommand.id) {
@@ -96,7 +114,7 @@ export class SheetsThreadCommentPermissionController extends Disposable {
rangeTypes: [RangeProtectionPermissionViewPoint],
}, [{ startRow: row, startColumn: column, endRow: row, endColumn: column }], unitId, subUnitId);
if (!permission) {
this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t('sheets-thread-comment-ui.permission.commentErr'));
this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t<LocaleKey>('sheets-thread-comment-ui.permission.commentErr'));
}
}
}
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: 'إدارة التعليقات',
},
permission: {
commentErr: 'ليس لديك إذن لاستخدام التعليقات.',
},
menu: {
addComment: 'إضافة تعليق',
commentManagement: 'إدارة التعليقات',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: 'Gestió de comentaris',
},
permission: {
commentErr: 'No teniu permís per utilitzar comentaris.',
},
menu: {
addComment: 'Afegeix un comentari',
commentManagement: 'Gestió de comentaris',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: 'Kommentarverwaltung',
},
permission: {
commentErr: 'Sie haben keine Berechtigung, Kommentare zu verwenden.',
},
menu: {
addComment: 'Kommentar hinzufügen',
commentManagement: 'Kommentarverwaltung',
@@ -19,6 +19,9 @@ const locale = {
panel: {
title: 'Comment Management',
},
permission: {
commentErr: 'You do not have permission to use comments.',
},
menu: {
addComment: 'Add Comment',
commentManagement: 'Comment Management',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: 'Gestión de comentarios',
},
permission: {
commentErr: 'No tiene permiso para usar comentarios.',
},
menu: {
addComment: 'Añadir comentario',
commentManagement: 'Gestión de comentarios',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: 'مدیریت نظر',
},
permission: {
commentErr: 'شما مجوز استفاده از نظرات را ندارید.',
},
menu: {
addComment: 'افزودن نظر',
commentManagement: 'مدیریت نظر',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: 'Gestion des commentaires',
},
permission: {
commentErr: 'Vous navez pas lautorisation dutiliser les commentaires.',
},
menu: {
addComment: 'Ajouter un commentaire',
commentManagement: 'Gestion des commentaires',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: 'Manajemen Komentar',
},
permission: {
commentErr: 'Anda tidak memiliki izin untuk menggunakan komentar.',
},
menu: {
addComment: 'Tambah Komentar',
commentManagement: 'Manajemen Komentar',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: 'Gestione commenti',
},
permission: {
commentErr: 'Non hai lautorizzazione per usare i commenti.',
},
menu: {
addComment: 'Aggiungi commento',
commentManagement: 'Gestione commenti',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: 'コメント管理',
},
permission: {
commentErr: 'コメントを使用する権限がありません。',
},
menu: {
addComment: 'コメントを追加',
commentManagement: 'コメント管理',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: '댓글 관리',
},
permission: {
commentErr: '댓글을 사용할 권한이 없습니다.',
},
menu: {
addComment: '댓글 추가',
commentManagement: '댓글 관리',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: 'Zarządzanie komentarzami',
},
permission: {
commentErr: 'Nie masz uprawnień do używania komentarzy.',
},
menu: {
addComment: 'Dodaj komentarz',
commentManagement: 'Zarządzanie komentarzami',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: 'Gerenciamento de Comentários',
},
permission: {
commentErr: 'Você não tem permissão para usar comentários.',
},
menu: {
addComment: 'Adicionar Comentário',
commentManagement: 'Gerenciamento de Comentários',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: 'Управление комментариями',
},
permission: {
commentErr: 'У вас нет разрешения на использование комментариев.',
},
menu: {
addComment: 'Добавить комментарий',
commentManagement: 'Управление комментариями',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: 'Správa komentárov',
},
permission: {
commentErr: 'Nemáte povolenie používať komentáre.',
},
menu: {
addComment: 'Pridať komentár',
commentManagement: 'Správa komentárov',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: 'Quản lý bình luận',
},
permission: {
commentErr: 'Bạn không có quyền sử dụng bình luận.',
},
menu: {
addComment: 'Thêm bình luận',
commentManagement: 'Quản lý bình luận',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: '评论管理',
},
permission: {
commentErr: '你没有权限使用评论。',
},
menu: {
addComment: '添加评论',
commentManagement: '评论管理',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: '評論管理',
},
permission: {
commentErr: '你沒有權限使用評論。',
},
menu: {
addComment: '新增評論',
commentManagement: '評論管理',
@@ -21,6 +21,9 @@ const locale: typeof enUS = {
panel: {
title: '評論管理',
},
permission: {
commentErr: '你沒有權限使用評論。',
},
menu: {
addComment: '新增評論',
commentManagement: '評論管理',
@@ -15,6 +15,7 @@
*/
import type { ICommand, IRange } from '@univerjs/core';
import type { LocaleKey } from '../../locale/types';
import { CommandType, ICommandService, IConfirmService, IUniverInstanceService, LocaleService, Rectangle } from '@univerjs/core';
import { DeleteRangeMoveLeftCommand, getSheetCommandTarget, SheetsSelectionsService } from '@univerjs/sheets';
@@ -56,10 +57,10 @@ export const DeleteRangeMoveLeftConfirmCommand: ICommand = {
const result = await confirmService.confirm({
id: DeleteRangeMoveLeftConfirmCommand.id,
title: { title: localeService.t('sheets-ui.merge.confirm.warning') },
children: { title: localeService.t('sheets-ui.merge.confirm.dismantleMergeCellWarning') },
cancelText: localeService.t('sheets-ui.button.cancel'),
confirmText: localeService.t('sheets-ui.button.confirm'),
title: { title: localeService.t<LocaleKey>('sheets-ui.merge.confirm.warning') },
children: { title: localeService.t<LocaleKey>('sheets-ui.merge.confirm.dismantleMergeCellWarning') },
cancelText: localeService.t<LocaleKey>('sheets-ui.button.cancel'),
confirmText: localeService.t<LocaleKey>('sheets-ui.button.confirm'),
});
if (result) {
return commandService.executeCommand(DeleteRangeMoveLeftCommand.id);
@@ -15,6 +15,7 @@
*/
import type { ICommand, IRange } from '@univerjs/core';
import type { LocaleKey } from '../../locale/types';
import { CommandType, ICommandService, IConfirmService, IUniverInstanceService, LocaleService, Rectangle } from '@univerjs/core';
import { DeleteRangeMoveUpCommand, getSheetCommandTarget, SheetsSelectionsService } from '@univerjs/sheets';
@@ -44,9 +45,9 @@ export const DeleteRangeMoveUpConfirmCommand: ICommand = {
if (worksheet.getRowFiltered(i)) {
const result = await confirmService.confirm({
id: DeleteRangeMoveUpConfirmCommand.id,
title: { title: localeService.t('sheets-ui.filter.confirm.error') },
children: { title: localeService.t('sheets-ui.filter.confirm.notAllowedToInsertRange') },
confirmText: localeService.t('sheets-ui.button.confirm'),
title: { title: localeService.t<LocaleKey>('sheets-ui.filter.confirm.error') },
children: { title: localeService.t<LocaleKey>('sheets-ui.filter.confirm.notAllowedToInsertRange') },
confirmText: localeService.t<LocaleKey>('sheets-ui.button.confirm'),
});
if (result) {
return false;
@@ -66,10 +67,10 @@ export const DeleteRangeMoveUpConfirmCommand: ICommand = {
const result = await confirmService.confirm({
id: DeleteRangeMoveUpConfirmCommand.id,
title: { title: localeService.t('sheets-ui.merge.confirm.warning') },
children: { title: localeService.t('sheets-ui.merge.confirm.dismantleMergeCellWarning') },
cancelText: localeService.t('sheets-ui.button.cancel'),
confirmText: localeService.t('sheets-ui.button.confirm'),
title: { title: localeService.t<LocaleKey>('sheets-ui.merge.confirm.warning') },
children: { title: localeService.t<LocaleKey>('sheets-ui.merge.confirm.dismantleMergeCellWarning') },
cancelText: localeService.t<LocaleKey>('sheets-ui.button.cancel'),
confirmText: localeService.t<LocaleKey>('sheets-ui.button.confirm'),
});
if (result) {
return commandService.executeCommand(DeleteRangeMoveUpCommand.id);
@@ -15,6 +15,7 @@
*/
import type { ICommand, IRange } from '@univerjs/core';
import type { LocaleKey } from '../../locale/types';
import { CommandType, ICommandService, IConfirmService, IUniverInstanceService, LocaleService, Rectangle } from '@univerjs/core';
import { getSheetCommandTarget, InsertRangeMoveDownCommand, SheetsSelectionsService } from '@univerjs/sheets';
@@ -48,9 +49,9 @@ export const InsertRangeMoveDownConfirmCommand: ICommand = {
if (worksheet.getRowFiltered(i)) {
const result = await confirmService.confirm({
id: InsertRangeMoveDownConfirmCommand.id,
title: { title: localeService.t('sheets-ui.filter.confirm.error') },
children: { title: localeService.t('sheets-ui.filter.confirm.notAllowedToInsertRange') },
confirmText: localeService.t('sheets-ui.button.confirm'),
title: { title: localeService.t<LocaleKey>('sheets-ui.filter.confirm.error') },
children: { title: localeService.t<LocaleKey>('sheets-ui.filter.confirm.notAllowedToInsertRange') },
confirmText: localeService.t<LocaleKey>('sheets-ui.button.confirm'),
});
if (result) {
return false;
@@ -70,10 +71,10 @@ export const InsertRangeMoveDownConfirmCommand: ICommand = {
const result = await confirmService.confirm({
id: InsertRangeMoveDownConfirmCommand.id,
title: { title: localeService.t('sheets-ui.merge.confirm.warning') },
children: { title: localeService.t('sheets-ui.merge.confirm.dismantleMergeCellWarning') },
cancelText: localeService.t('sheets-ui.button.cancel'),
confirmText: localeService.t('sheets-ui.button.confirm'),
title: { title: localeService.t<LocaleKey>('sheets-ui.merge.confirm.warning') },
children: { title: localeService.t<LocaleKey>('sheets-ui.merge.confirm.dismantleMergeCellWarning') },
cancelText: localeService.t<LocaleKey>('sheets-ui.button.cancel'),
confirmText: localeService.t<LocaleKey>('sheets-ui.button.confirm'),
});
if (result) {
return commandService.executeCommand(InsertRangeMoveDownCommand.id);
@@ -15,6 +15,7 @@
*/
import type { ICommand, IRange } from '@univerjs/core';
import type { LocaleKey } from '../../locale/types';
import { CommandType, ICommandService, IConfirmService, IUniverInstanceService, LocaleService, Rectangle } from '@univerjs/core';
import { getSheetCommandTarget, InsertRangeMoveRightCommand, SheetsSelectionsService } from '@univerjs/sheets';
@@ -58,10 +59,10 @@ export const InsertRangeMoveRightConfirmCommand: ICommand = {
const result = await confirmService.confirm({
id: InsertRangeMoveRightConfirmCommand.id,
title: { title: localeService.t('sheets-ui.merge.confirm.warning') },
children: { title: localeService.t('sheets-ui.merge.confirm.dismantleMergeCellWarning') },
cancelText: localeService.t('sheets-ui.button.cancel'),
confirmText: localeService.t('sheets-ui.button.confirm'),
title: { title: localeService.t<LocaleKey>('sheets-ui.merge.confirm.warning') },
children: { title: localeService.t<LocaleKey>('sheets-ui.merge.confirm.dismantleMergeCellWarning') },
cancelText: localeService.t<LocaleKey>('sheets-ui.button.cancel'),
confirmText: localeService.t<LocaleKey>('sheets-ui.button.confirm'),
});
if (result) {
return commandService.executeCommand(InsertRangeMoveRightCommand.id);
+8
View File
@@ -108,8 +108,16 @@ const locale: typeof enUS = {
cancel: 'إلغاء الدمج',
overlappingError: 'لا يمكن دمج المناطق المتداخلة',
partiallyError: 'لا يمكن إجراء هذه العملية على خلايا مدموجة جزئياً',
confirm: {
warning: 'تحذير',
dismantleMergeCellWarning: 'ستؤدي هذه العملية إلى إلغاء دمج الخلايا المدمجة. هل تريد المتابعة؟',
},
},
filter: {
confirm: {
error: 'لا يمكن تنفيذ هذه العملية',
notAllowedToInsertRange: 'هذه العملية غير مسموح بها لأن النطاق يحتوي على صفوف تمت تصفيتها.',
},
},
textWrap: {
overflow: 'تجاوز',

Some files were not shown because too many files have changed in this diff Show More