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