mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-11-04 09:47:31 +03:00 
			
		
		
		
	feat: use translate=no attribute in code sensitive renderings
Signed-off-by: Marques Johansson <marques@displague.com>
This commit is contained in:
		
							parent
							
								
									ce27184254
								
							
						
					
					
						commit
						8199abf46e
					
				| 
						 | 
					@ -67,7 +67,7 @@ export class ApiInfo extends React.Component<ApiInfoProps> {
 | 
				
			||||||
      )) ||
 | 
					      )) ||
 | 
				
			||||||
      null;
 | 
					      null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const version = (info.version && <span>({info.version})</span>) || null;
 | 
					    const version = (info.version && <span translate="no">({info.version})</span>) || null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
      <Section>
 | 
					      <Section>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,10 +50,10 @@ export class Endpoint extends React.Component<EndpointProps, EndpointState> {
 | 
				
			||||||
        {options => (
 | 
					        {options => (
 | 
				
			||||||
          <OperationEndpointWrap>
 | 
					          <OperationEndpointWrap>
 | 
				
			||||||
            <EndpointInfo onClick={this.toggle} $expanded={expanded} $inverted={inverted}>
 | 
					            <EndpointInfo onClick={this.toggle} $expanded={expanded} $inverted={inverted}>
 | 
				
			||||||
              <HttpVerb type={operation.httpVerb} $compact={this.props.compact}>
 | 
					              <HttpVerb type={operation.httpVerb} $compact={this.props.compact} translate="no">
 | 
				
			||||||
                {operation.httpVerb}
 | 
					                {operation.httpVerb}
 | 
				
			||||||
              </HttpVerb>
 | 
					              </HttpVerb>
 | 
				
			||||||
              <ServerRelativeURL>{operation.path}</ServerRelativeURL>
 | 
					              <ServerRelativeURL translate="no">{operation.path}</ServerRelativeURL>
 | 
				
			||||||
              <ShelfIcon
 | 
					              <ShelfIcon
 | 
				
			||||||
                float={'right'}
 | 
					                float={'right'}
 | 
				
			||||||
                color={inverted ? 'black' : 'white'}
 | 
					                color={inverted ? 'black' : 'white'}
 | 
				
			||||||
| 
						 | 
					@ -73,7 +73,7 @@ export class Endpoint extends React.Component<EndpointProps, EndpointState> {
 | 
				
			||||||
                    <Markdown source={server.description || ''} compact={true} />
 | 
					                    <Markdown source={server.description || ''} compact={true} />
 | 
				
			||||||
                    <SelectOnClick>
 | 
					                    <SelectOnClick>
 | 
				
			||||||
                      <ServerUrl>
 | 
					                      <ServerUrl>
 | 
				
			||||||
                        <span>
 | 
					                        <span translate="no">
 | 
				
			||||||
                          {hideHostname || options.hideHostname
 | 
					                          {hideHostname || options.hideHostname
 | 
				
			||||||
                            ? basePath === '/'
 | 
					                            ? basePath === '/'
 | 
				
			||||||
                              ? ''
 | 
					                              ? ''
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,13 +80,13 @@ export class Field extends React.Component<FieldProps> {
 | 
				
			||||||
          onKeyPress={this.handleKeyPress}
 | 
					          onKeyPress={this.handleKeyPress}
 | 
				
			||||||
          aria-label={`expand ${name}`}
 | 
					          aria-label={`expand ${name}`}
 | 
				
			||||||
        >
 | 
					        >
 | 
				
			||||||
          {!hidePropertiesPrefix &&
 | 
					 | 
				
			||||||
            fieldParentsName.map(
 | 
					 | 
				
			||||||
              name => name + '.\u200B', // zero-width space, a special character is used for correct line breaking
 | 
					 | 
				
			||||||
            )}
 | 
					 | 
				
			||||||
          <span className="property-name">{name}</span>
 | 
					 | 
				
			||||||
          <ShelfIcon direction={expanded ? 'down' : 'right'} />
 | 
					          <ShelfIcon direction={expanded ? 'down' : 'right'} />
 | 
				
			||||||
        </button>
 | 
					        </button>
 | 
				
			||||||
 | 
					        {!hidePropertiesPrefix &&
 | 
				
			||||||
 | 
					          fieldParentsName.map(
 | 
				
			||||||
 | 
					            name => name + '.\u200B', // zero-width space, a special character is used for correct line breaking
 | 
				
			||||||
 | 
					          )}
 | 
				
			||||||
 | 
					        <span className="property-name" translate="no">{name}</span>
 | 
				
			||||||
        {labels}
 | 
					        {labels}
 | 
				
			||||||
      </ClickablePropertyNameCell>
 | 
					      </ClickablePropertyNameCell>
 | 
				
			||||||
    ) : (
 | 
					    ) : (
 | 
				
			||||||
| 
						 | 
					@ -96,7 +96,7 @@ export class Field extends React.Component<FieldProps> {
 | 
				
			||||||
          fieldParentsName.map(
 | 
					          fieldParentsName.map(
 | 
				
			||||||
            name => name + '.\u200B', // zero-width space, a special character is used for correct line breaking
 | 
					            name => name + '.\u200B', // zero-width space, a special character is used for correct line breaking
 | 
				
			||||||
          )}
 | 
					          )}
 | 
				
			||||||
        <span className="property-name">{name}</span>
 | 
					        <span className="property-name" translate="no">{name}</span>
 | 
				
			||||||
        {labels}
 | 
					        {labels}
 | 
				
			||||||
      </PropertyNameCell>
 | 
					      </PropertyNameCell>
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,7 +14,7 @@ export class ConstraintsView extends React.PureComponent<ConstraintsViewProps> {
 | 
				
			||||||
      <span>
 | 
					      <span>
 | 
				
			||||||
        {' '}
 | 
					        {' '}
 | 
				
			||||||
        {this.props.constraints.map(constraint => (
 | 
					        {this.props.constraints.map(constraint => (
 | 
				
			||||||
          <ConstraintItem key={constraint}> {constraint} </ConstraintItem>
 | 
					          <ConstraintItem key={constraint} translate="no"> {constraint} </ConstraintItem>
 | 
				
			||||||
        ))}
 | 
					        ))}
 | 
				
			||||||
      </span>
 | 
					      </span>
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,7 +31,7 @@ export class SecurityDefs extends React.PureComponent<SecurityDefsProps> {
 | 
				
			||||||
            <SecurityDetailsStyle>
 | 
					            <SecurityDetailsStyle>
 | 
				
			||||||
              <SecurityRow>
 | 
					              <SecurityRow>
 | 
				
			||||||
                <b>Security Scheme Type: </b>
 | 
					                <b>Security Scheme Type: </b>
 | 
				
			||||||
                <span>{AUTH_TYPES[scheme.type] || scheme.type}</span>
 | 
					                <span translate="no">{AUTH_TYPES[scheme.type] || scheme.type}</span>
 | 
				
			||||||
              </SecurityRow>
 | 
					              </SecurityRow>
 | 
				
			||||||
              <SecurityDetails scheme={scheme} />
 | 
					              <SecurityDetails scheme={scheme} />
 | 
				
			||||||
            </SecurityDetailsStyle>
 | 
					            </SecurityDetailsStyle>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,11 +27,11 @@ function stringifyStringLiteral(str: string) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function decorateWithSpan(value, className) {
 | 
					function decorateWithSpan(value, className) {
 | 
				
			||||||
  return '<span class="' + className + '">' + htmlEncode(value) + '</span>';
 | 
					  return '<span class="' + className + '" translate="no">' + htmlEncode(value) + '</span>';
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function punctuation(val) {
 | 
					function punctuation(val) {
 | 
				
			||||||
  return '<span class="token punctuation">' + val + '</span>';
 | 
					  return '<span class="token punctuation" translate="no">' + val + '</span>';
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function valueToHTML(value, maxExpandLevel: number) {
 | 
					function valueToHTML(value, maxExpandLevel: number) {
 | 
				
			||||||
| 
						 | 
					@ -106,7 +106,7 @@ function objectToHTML(json, maxExpandLevel: number) {
 | 
				
			||||||
    const key = keys[i];
 | 
					    const key = keys[i];
 | 
				
			||||||
    hasContents = true;
 | 
					    hasContents = true;
 | 
				
			||||||
    output += '<li><div class="hoverable ' + collapsed + '">';
 | 
					    output += '<li><div class="hoverable ' + collapsed + '">';
 | 
				
			||||||
    output += '<span class="property token string">"' + htmlEncode(key) + '"</span>: ';
 | 
					    output += '<span class="property token string" translate="no">"' + htmlEncode(key) + '"</span>: ';
 | 
				
			||||||
    output += valueToHTML(json[key], maxExpandLevel);
 | 
					    output += valueToHTML(json[key], maxExpandLevel);
 | 
				
			||||||
    if (i < length - 1) {
 | 
					    if (i < length - 1) {
 | 
				
			||||||
      output += punctuation(',');
 | 
					      output += punctuation(',');
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user