As the title suggests, I made a module that translates comment outs in the source file.
Please see github or PyPi for how to use it.
https://github.com/koboriakira/translate-comment-out https://pypi.org/project/translate-comment-out/
I wanted to read the source of webpack.config.js used in React, but it was difficult to read the explanation in English.
For the time being, I wanted to read the Japanese translation because it's okay, so I made it in about 2 hours.
webpack.config.js
// This is the production and development configuration.
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
module.exports = function(webpackEnv) {
  const isEnvDevelopment = webpackEnv === 'development';
  const isEnvProduction = webpackEnv === 'production';
  // Variable used for enabling profiling in Production
  // passed into alias object. Uses a flag if passed into the build command
  const isEnvProductionProfile =
    isEnvProduction && process.argv.includes('--profile');
  // We will provide `paths.publicUrlOrPath` to our app
  // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
  // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
  // Get environment variables to inject into our app.
  const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
This is the file output by tco webpack.config.js> webpack.config_ja.js.
webpack.config_ja.js
//This is a production and development configuration. This is developer experience, fast rebuilding, and minimal
//Focuses on limited bundles.
module.exports = function(webpackEnv) {
  const isEnvDevelopment = webpackEnv === 'development';
  const isEnvProduction = webpackEnv === 'production';
  //Used to enable profiling in the production environment passed to the alias object
  //Variables to be. Use flags if passed to build command
  const isEnvProductionProfile =
    isEnvProduction && process.argv.includes('--profile');
  //In the app`paths.publicUrlOrPath`ʻIndex.html
  // `Then% PUBLIC_URL%, in JavaScript` process.en
  // v.PUBLIC_URL`Provided as. % PUBLIC_URL%/ xyz
  //Is% PUBLIC_Omit the trailing slash because it looks better than URL% xyz
  //please. Gets the environment variables to insert into the app.
  const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
For the above purposes, it can only be used for commenting out with JavaScript //.
The mechanism is simple, so if you want to try it in other languages, please fork and develop it.
Recommended Posts