Wie der Titel schon sagt, habe ich ein Modul erstellt, das Kommentare in der Quelldatei übersetzt.
Informationen zur Verwendung finden Sie unter Github oder PyPi.
https://github.com/koboriakira/translate-comment-out https://pypi.org/project/translate-comment-out/
Ich wollte die Quelle von webpack.config.js
lesen, die in React verwendet wurde, aber es war schwierig, die Erklärung auf Englisch zu lesen.
Vorerst wollte ich die japanische Übersetzung lesen, weil es in Ordnung ist, also habe ich es in ungefähr 2 Stunden geschafft.
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));
Dies ist die Datei, die von tco webpack.config.js> webpack.config_ja.js
ausgegeben wird.
webpack.config_ja.js
//Dies ist eine Produktions- und Entwicklungskonfiguration. Dies ist Entwicklererfahrung, schnelle Neuerstellung und minimal
//Der Fokus liegt auf begrenzten Bundles.
module.exports = function(webpackEnv) {
const isEnvDevelopment = webpackEnv === 'development';
const isEnvProduction = webpackEnv === 'production';
//Wird verwendet, um die Profilerstellung in der Produktionsumgebung zu aktivieren, die an das Alias-Objekt übergeben wird
//Variablen zu sein Verwenden Sie das Flag, wenn es an den Build-Befehl übergeben wird
const isEnvProductionProfile =
isEnvProduction && process.argv.includes('--profile');
//In der App`paths.publicUrlOrPath`Index.html
// `Dann% PUBLIC_URL% in JavaScript` process.en
// v.PUBLIC_URL`Vorausgesetzt als. % ÖFFENTLICHKEIT_URL%/ xyz
//Ist% PUBLIC_Lassen Sie den abschließenden Schrägstrich weg, da er besser aussieht als die URL% xyz
//Bitte. Ruft die Umgebungsvariablen ab, die in die App eingefügt werden sollen.
const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
Für die oben genannten Zwecke kann es nur zum Auskommentieren mit //
in JavaScript verwendet werden.
Der Mechanismus ist einfach. Wenn Sie ihn also in anderen Sprachen ausprobieren möchten, teilen Sie ihn bitte mit und entwickeln Sie ihn weiter.
Recommended Posts