Add internationalization (#114)

🇬🇧 and 🇮🇹
This commit is contained in:
Riccardo Graziosi
2022-06-05 11:40:43 +02:00
committed by GitHub
parent ba86e81aa0
commit 78049a820c
71 changed files with 802 additions and 266 deletions

View File

@@ -1,4 +1,5 @@
import * as React from 'react';
import I18n from 'i18n-js';
import { Draggable } from 'react-beautiful-dnd';
@@ -74,7 +75,7 @@ class PostStatusEditable extends React.Component<Props, State> {
<PostStatusLabel name={name} color={color} />
<div className="postStatusEditableActions">
<a onClick={this.toggleEditMode}>Edit</a>
<a onClick={this.toggleEditMode}>{I18n.t('common.buttons.edit')}</a>
<Separator />
@@ -82,7 +83,7 @@ class PostStatusEditable extends React.Component<Props, State> {
onClick={() => handleDelete(id)}
data-confirm="Are you sure?"
>
Delete
{I18n.t('common.buttons.delete')}
</a>
</div>
</React.Fragment>
@@ -99,7 +100,7 @@ class PostStatusEditable extends React.Component<Props, State> {
<a
className="postStatusFormCancelButton"
onClick={this.toggleEditMode}>
Cancel
{I18n.t('common.buttons.cancel')}
</a>
</React.Fragment>
}

View File

@@ -1,4 +1,5 @@
import * as React from 'react';
import I18n from 'i18n-js';
import Button from '../../shared/Button';
@@ -89,7 +90,7 @@ class PostStatusForm extends React.Component<Props, State> {
<div className="postStatusForm">
<input
type="text"
placeholder="Post status name"
placeholder={I18n.t('site_settings.post_statuses.form.name')}
value={name}
onChange={e => this.onNameChange(e.target.value)}
className="form-control"
@@ -107,7 +108,12 @@ class PostStatusForm extends React.Component<Props, State> {
className="newPostStatusButton"
disabled={!this.isFormValid()}
>
{mode === 'create' ? 'Create' : 'Save'}
{
mode === 'create' ?
I18n.t('common.buttons.create')
:
I18n.t('common.buttons.update')
}
</Button>
</div>
);

View File

@@ -1,4 +1,5 @@
import * as React from 'react';
import I18n from 'i18n-js';
import { DragDropContext, Droppable } from 'react-beautiful-dnd';
import IPostStatus from '../../../interfaces/IPostStatus';
@@ -85,7 +86,7 @@ class PostStatusesSiteSettingsP extends React.Component<Props> {
return (
<React.Fragment>
<div className="content">
<h2>Post statuses</h2>
<h2>{I18n.t('site_settings.post_statuses.title')}</h2>
{
postStatuses.items.length > 0 ?
@@ -116,12 +117,12 @@ class PostStatusesSiteSettingsP extends React.Component<Props> {
postStatuses.areLoading ?
<Spinner />
:
<CenteredMutedText>There are no post statuses. Create one below!</CenteredMutedText>
<CenteredMutedText>{I18n.t('site_settings.post_statuses.empty')}</CenteredMutedText>
}
</div>
<div className="content">
<h2>New</h2>
<h2>{I18n.t('site_settings.post_statuses.new')}</h2>
<PostStatusForm mode='create' handleSubmit={this.handleSubmit} />
</div>