mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-07 13:30:33 +03:00
feat: added localization for some labels (#1675)
This commit is contained in:
parent
eba55124c9
commit
ec50858ec4
|
@ -14,6 +14,7 @@ import {
|
|||
InfoSpanBox,
|
||||
InfoSpanBoxWrap,
|
||||
} from './styled.elements';
|
||||
import { l } from '../../services/Labels';
|
||||
|
||||
export interface ApiInfoProps {
|
||||
store: AppStore;
|
||||
|
@ -79,14 +80,14 @@ export class ApiInfo extends React.Component<ApiInfoProps> {
|
|||
</ApiHeader>
|
||||
{!hideDownloadButton && (
|
||||
<p>
|
||||
Download OpenAPI specification:
|
||||
{l('downloadSpecification')}:
|
||||
<DownloadButton
|
||||
download={downloadFilename || true}
|
||||
target="_blank"
|
||||
href={downloadLink}
|
||||
onClick={this.handleDownloadClick}
|
||||
>
|
||||
Download
|
||||
{l('download')}
|
||||
</DownloadButton>
|
||||
</p>
|
||||
)}
|
||||
|
|
|
@ -6,6 +6,7 @@ import { SourceCodeWithCopy } from '../SourceCode/SourceCode';
|
|||
|
||||
import { RightPanelHeader, Tab, TabList, TabPanel, Tabs } from '../../common-elements';
|
||||
import { OptionsContext } from '../OptionsProvider';
|
||||
import { l } from '../../services/Labels';
|
||||
|
||||
export interface RequestSamplesProps {
|
||||
operation: OperationModel;
|
||||
|
@ -26,7 +27,7 @@ export class RequestSamples extends React.Component<RequestSamplesProps> {
|
|||
return (
|
||||
(hasSamples && (
|
||||
<div>
|
||||
<RightPanelHeader> Request samples </RightPanelHeader>
|
||||
<RightPanelHeader> {l('requestSamples')} </RightPanelHeader>
|
||||
|
||||
<Tabs defaultIndex={0}>
|
||||
<TabList hidden={hideTabList}>
|
||||
|
|
|
@ -5,6 +5,7 @@ import { OperationModel } from '../../services/models';
|
|||
|
||||
import { RightPanelHeader, Tab, TabList, TabPanel, Tabs } from '../../common-elements';
|
||||
import { PayloadSamples } from '../PayloadSamples/PayloadSamples';
|
||||
import { l } from '../../services/Labels';
|
||||
|
||||
export interface ResponseSamplesProps {
|
||||
operation: OperationModel;
|
||||
|
@ -23,7 +24,7 @@ export class ResponseSamples extends React.Component<ResponseSamplesProps> {
|
|||
return (
|
||||
(responses.length > 0 && (
|
||||
<div>
|
||||
<RightPanelHeader> Response samples </RightPanelHeader>
|
||||
<RightPanelHeader> {l('responseSamples')} </RightPanelHeader>
|
||||
|
||||
<Tabs defaultIndex={0}>
|
||||
<TabList>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as React from 'react';
|
||||
import { l } from '../../services/Labels';
|
||||
import { ResponseModel } from '../../services/models';
|
||||
import styled from '../../styled-components';
|
||||
import { ResponseView } from './Response';
|
||||
|
@ -26,7 +27,7 @@ export class ResponsesList extends React.PureComponent<ResponseListProps> {
|
|||
|
||||
return (
|
||||
<div>
|
||||
<ResponsesHeader>{isCallback ? 'Callback responses' : 'Responses'}</ResponsesHeader>
|
||||
<ResponsesHeader>{isCallback ? l('callbackResponses') : l('responses')}</ResponsesHeader>
|
||||
{responses.map(response => {
|
||||
return <ResponseView key={response.code} response={response} />;
|
||||
})}
|
||||
|
|
|
@ -10,6 +10,12 @@ export interface LabelsConfig {
|
|||
arrayOf: string;
|
||||
webhook: string;
|
||||
const: string;
|
||||
download: string;
|
||||
downloadSpecification: string;
|
||||
responses: string;
|
||||
callbackResponses: string;
|
||||
requestSamples: string;
|
||||
responseSamples: string;
|
||||
}
|
||||
|
||||
export type LabelsConfigRaw = Partial<LabelsConfig>;
|
||||
|
@ -26,6 +32,12 @@ const labels: LabelsConfig = {
|
|||
arrayOf: 'Array of ',
|
||||
webhook: 'Event',
|
||||
const: 'Value',
|
||||
download: 'Download',
|
||||
downloadSpecification: 'Download OpenAPI specification',
|
||||
responses: 'Responses',
|
||||
callbackResponses: 'Callback responses',
|
||||
requestSamples: 'Request samples',
|
||||
responseSamples: 'Response samples',
|
||||
};
|
||||
|
||||
export function setRedocLabels(_labels?: LabelsConfigRaw) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user