Response Languages
It is possible to change the default language (English) of the description in the automatic response, for example, status code 404, the description will be: 'Not Found'. To change, pass an object with the following parameter:
English (default)
- CommonJs
- ES Modules
const swaggerAutogen = require('swagger-autogen')();
// In this case, for example, the description of status code 404 will be:
// 'Not Found'
swaggerAutogen()(outputFile, routes, doc);
// In this case, for example, the description of status code 404 will be:
// 'Not Found'
Portuguese [Brazil]
- CommonJs
- ES Modules
const swaggerAutogen = require('swagger-autogen')({ language: 'pt-BR' });
// In this case, for example, the description of status code 404 will be:
// 'Não Encontrado'
swaggerAutogen({ language: 'pt-BR' })(outputFile, routes, doc);
// In this case, for example, the description of status code 404 will be:
// 'Não Encontrado'
Chinese [Simplified]
- CommonJs
- ES Modules
const swaggerAutogen = require('swagger-autogen')({ language: 'zh-CN' });
// In this case, for example, the description of status code 404 will be:
// '未找到'
swaggerAutogen({ language: 'zh-CN' })(outputFile, routes, doc);
// In this case, for example, the description of status code 404 will be:
// '未找到'
Korean
- CommonJs
- ES Modules
const swaggerAutogen = require('swagger-autogen')({ language: 'ko' });
// In this case, for example, the description of status code 404 will be:
// '찾을 수 없음'
swaggerAutogen({ language: 'ko' })(outputFile, routes, doc);
// In this case, for example, the description of status code 404 will be:
// '찾을 수 없음'
French
- CommonJs
- ES Modules
const swaggerAutogen = require('swagger-autogen')({ language: 'fr' });
// In this case, for example, the description of status code 404 will be:
// 'Non Trouvé'
swaggerAutogen({ language: 'fr' })(outputFile, routes, doc);
// In this case, for example, the description of status code 404 will be:
// 'Non Trouvé'