1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-24 13:43:12 +02:00

A bit more translations and start using intl component

This commit is contained in:
Jesús Espino 2020-10-24 10:08:22 +02:00
parent 230b0a161c
commit 4be57d72b5
5 changed files with 52 additions and 41 deletions

View File

@ -14,11 +14,16 @@
"TableComponent.plus-new": "+ New",
"TableComponent.random-icon": "Random",
"TableComponent.remove-icon": "Remove Icon",
"ViewHeader.export-board-archive": "Export Board Archive",
"ViewHeader.export-csv": "Export to CSV",
"ViewHeader.filter": "Filter",
"ViewHeader.group-by": "Group by {property}",
"ViewHeader.new": "New",
"ViewHeader.properties": "Properties",
"ViewHeader.search": "Search",
"ViewHeader.search-text": "Search text",
"ViewHeader.sort": "Sort"
}
"ViewHeader.sort": "Sort",
"ViewHeader.test-add-100-cards": "TEST: Add 100 cards",
"ViewHeader.test-add-1000-cards": "TEST: Add 1,000 cards",
"ViewHeader.test-randomize-icons": "TEST: Randomize icons"
}

View File

@ -14,11 +14,16 @@
"TableComponent.plus-new": "+ Nueva",
"TableComponent.random-icon": "Aleatorio",
"TableComponent.remove-icon": "Quitar Icono",
"ViewHeader.export-board-archive": "Exportar Archivo del Panel",
"ViewHeader.export-csv": "Exportar a CSV",
"ViewHeader.filter": "Filtrar",
"ViewHeader.group-by": "Agrupar por {property}",
"ViewHeader.new": "Nueva",
"ViewHeader.properties": "Propiedades",
"ViewHeader.search": "Buscar",
"ViewHeader.search-text": "Texto de búsqueda",
"ViewHeader.sort": "Ordenar"
"ViewHeader.sort": "Ordenar",
"ViewHeader.test-add-100-cards": "TEST: Añadir 100 tarjetas",
"ViewHeader.test-add-1000-cards": "TEST: Añadir 1,000 tarjetas",
"ViewHeader.test-randomize-icons": "TEST: Iconos aleatorios"
}

View File

@ -1464,6 +1464,15 @@
"@types/react": "*"
}
},
"@types/react-intl": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@types/react-intl/-/react-intl-3.0.0.tgz",
"integrity": "sha512-k8F3d05XQGEqSWIfK97bBjZe4z9RruXU9Wa7OZ2iUC5pdeIpzuQDZe/9C2J3Xir5//ZtAkhcv08Wfx3n5TBTQg==",
"dev": true,
"requires": {
"react-intl": "*"
}
},
"@types/react-router": {
"version": "5.1.8",
"resolved": "https://registry.npmjs.org/@types/react-router/-/react-router-5.1.8.tgz",
@ -7428,12 +7437,6 @@
"integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
"dev": true
},
"json-loader": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/json-loader/-/json-loader-0.5.7.tgz",
"integrity": "sha512-QLPs8Dj7lnf3e3QYS1zkCo+4ZwqOiF9d/nZnYozTISxXWCfNs9yuky5rJw4/W34s7POaNlbZmQGaB5NiXCbP4w==",
"dev": true
},
"json-parse-better-errors": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",

View File

@ -34,6 +34,7 @@
"@types/marked": "^1.1.0",
"@types/react": "^16.9.49",
"@types/react-dom": "^16.9.8",
"@types/react-intl": "^3.0.0",
"@types/react-router-dom": "^5.1.6",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",

View File

@ -1,12 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react'
import {FormattedMessage} from 'react-intl'
import {injectIntl, IntlShape, FormattedMessage} from 'react-intl'
import {Archiver} from '../archiver'
import {ISortOption} from '../blocks/boardView'
import {BlockIcons} from '../blockIcons'
import {MutableCard} from '../blocks/card'
import {IPropertyTemplate} from '../blocks/board'
import {BoardTree} from '../viewModel/boardTree'
import ViewMenu from '../components/viewMenu'
import {CsvExporter} from '../csvExporter'
@ -25,6 +26,7 @@ type Props = {
setSearchText: (text: string) => void
addCard: (show: boolean) => void
withGroupBy?: boolean
intl: IntlShape
}
type State = {
@ -32,7 +34,7 @@ type State = {
showFilter: boolean
}
export default class ViewHeader extends React.Component<Props, State> {
class ViewHeader extends React.Component<Props, State> {
private searchFieldRef = React.createRef<Editable>()
shouldComponentUpdate(): boolean {
@ -103,7 +105,7 @@ export default class ViewHeader extends React.Component<Props, State> {
}
render(): JSX.Element {
const {boardTree, showView, withGroupBy} = this.props
const {boardTree, showView, withGroupBy, intl} = this.props
const {board, activeView} = boardTree
const hasFilter = activeView.filter && activeView.filter.filters?.length > 0
@ -141,20 +143,20 @@ export default class ViewHeader extends React.Component<Props, State> {
/>
</div>
<Menu>
{boardTree.board.cardProperties.map((option) => (
{boardTree.board.cardProperties.map((option: IPropertyTemplate) => (
<Menu.Switch
key={option.id}
id={option.id}
name={option.name}
isOn={activeView.visiblePropertyIds.includes(option.id)}
onClick={(propertyId: string) => {
const property = boardTree.board.cardProperties.find((o) => o.id === propertyId)
const property = boardTree.board.cardProperties.find((o: IPropertyTemplate) => o.id === propertyId)
Utils.assertValue(property)
Utils.log(`Toggle property ${property.name}`)
let newVisiblePropertyIds = []
if (activeView.visiblePropertyIds.includes(propertyId)) {
newVisiblePropertyIds = activeView.visiblePropertyIds.filter((o) => o !== propertyId)
newVisiblePropertyIds = activeView.visiblePropertyIds.filter((o: string) => o !== propertyId)
} else {
newVisiblePropertyIds = [...activeView.visiblePropertyIds, propertyId]
}
@ -186,7 +188,7 @@ export default class ViewHeader extends React.Component<Props, State> {
/>
</div>
<Menu>
{boardTree.board.cardProperties.filter((o) => o.type === 'select').map((option) => (
{boardTree.board.cardProperties.filter((o: IPropertyTemplate) => o.type === 'select').map((option: IPropertyTemplate) => (
<Menu.Text
key={option.id}
id={option.id}
@ -225,7 +227,7 @@ export default class ViewHeader extends React.Component<Props, State> {
/>
</div>
<Menu>
{boardTree.board.cardProperties.map((option) => (
{boardTree.board.cardProperties.map((option: IPropertyTemplate) => (
<Menu.Text
key={option.id}
id={option.id}
@ -250,25 +252,18 @@ export default class ViewHeader extends React.Component<Props, State> {
</Menu>
</MenuWrapper>
{this.state.isSearching &&
<FormattedMessage
id='ViewHeader.search-text'
defaultMessage='Search text'
>
{(placeholder: string) => (
<Editable
ref={this.searchFieldRef}
text={boardTree.getSearchText()}
placeholderText={placeholder}
style={{color: '#000000'}}
onChanged={(text) => {
this.searchChanged(text)
}}
onKeyDown={(e) => {
this.onSearchKeyDown(e)
}}
/>
)}
</FormattedMessage>}
<Editable
ref={this.searchFieldRef}
text={boardTree.getSearchText()}
placeholderText={intl.formatMessage({id: 'ViewHeader.search-text', defaultMessage: 'Search text'})}
style={{color: '#000000'}}
onChanged={(text) => {
this.searchChanged(text)
}}
onKeyDown={(e) => {
this.onSearchKeyDown(e)
}}
/>}
{!this.state.isSearching &&
<div
className='octo-button'
@ -286,27 +281,27 @@ export default class ViewHeader extends React.Component<Props, State> {
<Menu>
<Menu.Text
id='exportCsv'
name='Export to CSV'
name={intl.formatMessage({id: 'ViewHeader.export-csv', defaultMessage: 'Export to CSV'})}
onClick={() => CsvExporter.exportTableCsv(boardTree)}
/>
<Menu.Text
id='exportBoardArchive'
name='Export board archive'
name={intl.formatMessage({id: 'ViewHeader.export-board-archive', defaultMessage: 'Export Board Archive'})}
onClick={() => Archiver.exportBoardTree(boardTree)}
/>
<Menu.Text
id='testAdd100Cards'
name='TEST: Add 100 cards'
name={intl.formatMessage({id: 'ViewHeader.test-add-100-cards', defaultMessage: 'TEST: Add 100 cards'})}
onClick={() => this.testAddCards(100)}
/>
<Menu.Text
id='testAdd1000Cards'
name='TEST: Add 1,000 cards'
name={intl.formatMessage({id: 'ViewHeader.test-add-1000-cards', defaultMessage: 'TEST: Add 1,000 cards'})}
onClick={() => this.testAddCards(1000)}
/>
<Menu.Text
id='testRandomizeIcons'
name='TEST: Randomize icons'
name={intl.formatMessage({id: 'ViewHeader.test-randomize-icons', defaultMessage: 'TEST: Randomize icons'})}
onClick={() => this.testRandomizeIcons()}
/>
</Menu>
@ -326,3 +321,5 @@ export default class ViewHeader extends React.Component<Props, State> {
)
}
}
export default injectIntl(ViewHeader)