mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
Make a good part of the app localizable and add French translations (#325)
Co-authored-by: Yohan Boniface <yohanboniface@free.fr>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import {makeT} from 'app/client/lib/localization';
|
||||
import {allCommands} from 'app/client/components/commands';
|
||||
import {ViewSectionRec} from 'app/client/models/DocModel';
|
||||
import {urlState} from 'app/client/models/gristUrlState';
|
||||
@@ -5,6 +6,8 @@ import {testId} from 'app/client/ui2018/cssVars';
|
||||
import {menuDivider, menuItemCmd, menuItemLink} from 'app/client/ui2018/menus';
|
||||
import {dom} from 'grainjs';
|
||||
|
||||
const t = makeT('ViewLayoutMenu');
|
||||
|
||||
/**
|
||||
* Returns a list of menu items for a view section.
|
||||
*/
|
||||
@@ -21,11 +24,11 @@ export function makeViewLayoutMenu(viewSection: ViewSectionRec, isReadonly: bool
|
||||
|
||||
const contextMenu = [
|
||||
menuItemCmd(allCommands.deleteRecords,
|
||||
'Delete record',
|
||||
t('DeleteRecord'),
|
||||
testId('section-delete-card'),
|
||||
dom.cls('disabled', isReadonly || isAddRow)),
|
||||
menuItemCmd(allCommands.copyLink,
|
||||
'Copy anchor link',
|
||||
t('CopyAnchorLink'),
|
||||
testId('section-card-link'),
|
||||
),
|
||||
menuDivider(),
|
||||
@@ -36,30 +39,30 @@ export function makeViewLayoutMenu(viewSection: ViewSectionRec, isReadonly: bool
|
||||
return [
|
||||
dom.maybe((use) => ['single'].includes(use(viewSection.parentKey)), () => contextMenu),
|
||||
dom.maybe((use) => !use(viewSection.isRaw) && !isLight,
|
||||
() => menuItemCmd(allCommands.showRawData, 'Show raw data', testId('show-raw-data')),
|
||||
() => menuItemCmd(allCommands.showRawData, t('ShowRawData'), testId('show-raw-data')),
|
||||
),
|
||||
menuItemCmd(allCommands.printSection, 'Print widget', testId('print-section')),
|
||||
menuItemCmd(allCommands.printSection, t('PrintWidget'), testId('print-section')),
|
||||
menuItemLink({ href: gristDoc.getCsvLink(), target: '_blank', download: ''},
|
||||
'Download as CSV', testId('download-section')),
|
||||
t('DownloadCSV'), testId('download-section')),
|
||||
menuItemLink({ href: gristDoc.getXlsxActiveViewLink(), target: '_blank', download: ''},
|
||||
'Download as XLSX', testId('download-section')),
|
||||
t('DownloadXLSX'), testId('download-section')),
|
||||
dom.maybe((use) => ['detail', 'single'].includes(use(viewSection.parentKey)), () =>
|
||||
menuItemCmd(allCommands.editLayout, 'Edit Card Layout',
|
||||
menuItemCmd(allCommands.editLayout, t('EditCardLayout'),
|
||||
dom.cls('disabled', isReadonly))),
|
||||
|
||||
dom.maybe(!isLight, () => [
|
||||
menuDivider(),
|
||||
menuItemCmd(allCommands.viewTabOpen, 'Widget options', testId('widget-options')),
|
||||
menuItemCmd(allCommands.sortFilterTabOpen, 'Advanced Sort & Filter'),
|
||||
menuItemCmd(allCommands.dataSelectionTabOpen, 'Data selection'),
|
||||
menuItemCmd(allCommands.viewTabOpen, t('WidgetOptions'), testId('widget-options')),
|
||||
menuItemCmd(allCommands.sortFilterTabOpen, t('AdvancedSortFilter')),
|
||||
menuItemCmd(allCommands.dataSelectionTabOpen, t('DataSelection')),
|
||||
]),
|
||||
|
||||
menuDivider(),
|
||||
dom.maybe((use) => use(viewSection.parentKey) === 'custom' && use(viewSection.hasCustomOptions), () =>
|
||||
menuItemCmd(allCommands.openWidgetConfiguration, 'Open configuration',
|
||||
menuItemCmd(allCommands.openWidgetConfiguration, t('OpenConfiguration'),
|
||||
testId('section-open-configuration')),
|
||||
),
|
||||
menuItemCmd(allCommands.deleteSection, 'Delete widget',
|
||||
menuItemCmd(allCommands.deleteSection, t('DeleteWidget'),
|
||||
dom.cls('disabled', !viewRec.getRowId() || viewRec.viewSections().peekLength <= 1 || isReadonly),
|
||||
testId('section-delete')),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user