Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(zh): migrate web.dev links #16713

Merged
merged 3 commits into from
Oct 26, 2023
Merged

chore(zh): migrate web.dev links #16713

merged 3 commits into from
Oct 26, 2023

Conversation

yin1999
Copy link
Member

@yin1999 yin1999 commented Oct 26, 2023

Description

migrate web.dev links

Used scripts:

"use strict";

import fs from "fs-extra";
import * as path from "node:path";
import { fdir } from "fdir";
import ora from "ora";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { fromMarkdown } from "mdast-util-from-markdown";
import { visit } from "unist-util-visit";

const spinner = ora().start();

/**
 * define types
 *
 * @typedef {Array<{url: string, line: number, column: number, newUrl: string}>} UrlLocaleErrors
 * @typedef {Array<{url: string, line: number, column: number}>} Urls
 */

/**
 *
 * @param {string} rawContent
 * @returns {Urls}
 */
function findUrlInText(rawContent) {
  const urls = [];
  for (const match of rawContent.matchAll(/href=['"]([^'"]+)['"]/g)) {
    const left = rawContent.slice(0, match.index);
    const line = (left.match(/\n/g) || []).length + 1;
    const lastIndexOf = left.lastIndexOf("\n") + 1;
    const column = match.index - lastIndexOf + 1 + ("href".length + 2);
    urls.push({ url: match[1], line, column });
  }
  return urls;
}

/**
 *
 * @param {string} content
 * @returns {Urls}
 */
function findUrlInMarkdown(content) {
  const tree = fromMarkdown(content);
  const urls = [];
  visit(tree, ["link", "html"], (node) => {
    if (node.type === "link") {
      if (node.children.length === 1) {
        urls.push({
          url: node.url,
          line: node.children[0].position.end.line,
          column: node.children[0].position.end.column + 2,
        });
      } else {
        urls.push({
          url: node.url,
          line: node.position.start.line,
          column: node.position.start.column + 3,
        });
      }
    } else {
      // html
      const urlsInHtml = findUrlInText(node.value);
      const correctedUrls = urlsInHtml.map(({ url, line, column }) => {
        if (line === 1) {
          // if it's the first line, we need to add the column offset
          column += node.position.start.column - 1;
        }
        line += node.position.start.line - 1;
        return { url, line, column };
      });
      urls.push(...correctedUrls);
    }
  });
  return urls;
}

/**
 *
 * @param {string} content
 * @returns {Promise<UrlLocaleErrors>}
 */
async function checkUrls(content) {
  const urls = findUrlInMarkdown(content);
  const reportUrls = [];
  for (const { url, line, column } of urls) {
    if (!url.startsWith("http")) {
      continue;
    }
    let u = new URL(url);
    if (u.hostname !== "web.dev") {
      continue;
    }
    // check if the url has been redirected
    const res = await fetch(url, {
      redirect: "manual",
      method: "HEAD",
    });
    if (res.status !== 301) {
      continue;
    }

    const location = res.headers.get("location");

    if (!location) {
      // warn if the url is redirected to nowhere
      console.warn(`"${url}" is redirected to nowhere!`);
    }
    const newUrl = new URL(location, url).toString();
    if (newUrl === url) {
      // ignore if the url is redirected to itself
      continue;
    }
    reportUrls.push({
      url,
      line,
      column,
      newUrl,
    });
  }
  return reportUrls;
}

/**
 *
 * @param {string} filePath
 * @param {UrlLocaleErrors} errors
 * @param {string} expectedLocale
 */
function generateReport(filePath, errors, expectedLocale) {
  return errors
    .map(
      (e) =>
        `  - ${filePath}:${e.line}:${e.column}: ${e.url} (${e.urlLocale} ==> ${expectedLocale})`,
    )
    .join("\n");
}

/**
 *
 * @param {string} content
 * @param {UrlLocaleErrors} errors
 * @param {string} expectedLocale
 */
function fixUrls(content, errors) {
  errors.sort((a, b) => {
    if (a.line === b.line) {
      // sort by column, descending
      return b.column - a.column;
    }
    return a.line - b.line;
  });
  const lines = content.split("\n");
  for (const { url, line, column, newUrl } of errors) {
    let lineContent = lines[line - 1];
    const prefix = lineContent.slice(0, column - 1);
    // replace the slashed locale with the expected locale
    // to prevent replacing the empty url locale
    const suffix = lineContent.slice(column - 1).replace(url, newUrl);
    lines[line - 1] = `${prefix}${suffix}`;
  }
  return lines.join("\n");
}

async function main() {
  const { argv } = yargs(hideBin(process.argv)).command(
    "$0 [files..]",
    "Check the url locales of the given files",
    (yargs) => {
      yargs
        .positional("files", {
          describe:
            "The files to check (relative to the current working directory)",
          type: "string",
          array: true,
          default: ["./files/"],
        });
    },
  );

  const files = [];

  spinner.text = "Crawling files...";

  for (const fp of argv.files) {
    const fstats = await fs.stat(fp);

    if (fstats.isDirectory()) {
      files.push(
        ...new fdir()
          .withBasePath()
          .filter((path) => path.endsWith(".md"))
          .crawl(fp)
          .sync(),
      );
    } else if (fstats.isFile()) {
      files.push(fp);
    }
  }

  let exitCode = 0;

  for (const i in files) {
    const file = files[i];

    spinner.text = `${i}/${files.length}: ${file}...`;

    const relativePath = path.relative(process.cwd(), file);
    const parts = relativePath.split(path.sep);
    if (parts.length < 2 || parts[0] !== "files") {
      spinner.warn(`File "${file}" is not in the files directory!`);
      spinner.start();
      continue;
    }

    try {
      const content = await fs.readFile(relativePath, "utf8");

      const urlLocaleErrors = await checkUrls(content);

      if (urlLocaleErrors.length > 0) {
        spinner.info(
          `${file}: Found ${urlLocaleErrors.length} URL locale errors! Fixing...`,
        );
        const newContent = fixUrls(
          content,
          urlLocaleErrors,
        );
        if (newContent === content) {
          spinner.fail(`${file}: Fixing URL locale errors failed!`);
          exitCode = 1;
        } else {
          await fs.writeFile(relativePath, newContent);
        }
        spinner.start();
      }
    } catch (e) {
      spinner.fail(`${file}: ${e}`);
      spinner.start();
    }
  }

  spinner.stop();

  if (exitCode === 0) {
    console.log("Checked all files successfully!");
  } else {
    process.exitCode = exitCode;
  }
}

await main();

@github-actions github-actions bot added the l10n-zh Issues related to Chinese content. label Oct 26, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 26, 2023

Preview URLs (84 pages)
Flaws (327)

Note! 32 documents with no flaws that don't need to be listed. 🎉

URL: /zh-TW/docs/WebAssembly
Title: WebAssembly
Flaw count: 24

  • macros:
    • /zh-TW/docs/Web/JavaScript/Reference/Global_objects/WebAssembly does not exist but fell back to /en-US/docs/WebAssembly/JavaScript_interface
    • /zh-TW/docs/Web/JavaScript/Reference/Global_objects/WebAssembly/Global does not exist but fell back to /en-US/docs/WebAssembly/JavaScript_interface/Global
    • /zh-TW/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module does not exist but fell back to /en-US/docs/WebAssembly/JavaScript_interface/Module
    • /zh-TW/docs/Web/JavaScript/Reference/Global_objects/WebAssembly/Module does not exist but fell back to /en-US/docs/WebAssembly/JavaScript_interface/Module
    • /zh-TW/docs/Web/JavaScript/Reference/Global_objects/WebAssembly/Instance does not exist but fell back to /en-US/docs/WebAssembly/JavaScript_interface/Instance
    • and 6 more flaws omitted
  • broken_links:
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • and 8 more flaws omitted

URL: /zh-TW/docs/Web/HTTP
Title: HTTP
Flaw count: 7

  • broken_links:
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • and 2 more flaws omitted

URL: /zh-TW/docs/Web/HTTP/Headers/Cache-Control
Title: Cache-Control
Flaw count: 3

  • macros:
    • /zh-TW/docs/Glossary/General_header does not exist but fell back to /en-US/docs/Glossary/General_header
    • /zh-TW/docs/Glossary/Forbidden_header_name does not exist but fell back to /en-US/docs/Glossary/Forbidden_header_name
    • /zh-TW/docs/Glossary/CORS-safelisted_response_header does not exist but fell back to /en-US/docs/Glossary/CORS-safelisted_response_header

URL: /zh-CN/docs/Learn/Performance/CSS
Title: CSS 性能优化
Flaw count: 29

  • macros:
    • /zh-CN/docs/Learn/MathML/First_steps/Three_famous_mathematical_formulas does not exist but fell back to /en-US/docs/Learn/MathML/First_steps/Three_famous_mathematical_formulas
    • /zh-CN/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Deployment does not exist but fell back to /en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Deployment
    • /zh-CN/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_events_state does not exist but fell back to /en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_events_state
    • /zh-CN/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_filtering_conditional_rendering does not exist but fell back to /en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_filtering_conditional_rendering
    • /zh-CN/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_accessibility does not exist but fell back to /en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_accessibility
    • and 20 more flaws omitted
  • broken_links:
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback

URL: /zh-CN/docs/Learn/Performance/JavaScript
Title: JavaScript 性能优化
Flaw count: 28

  • macros:
    • /zh-CN/docs/Learn/MathML/First_steps/Three_famous_mathematical_formulas does not exist but fell back to /en-US/docs/Learn/MathML/First_steps/Three_famous_mathematical_formulas
    • /zh-CN/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Deployment does not exist but fell back to /en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Deployment
    • /zh-CN/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_events_state does not exist but fell back to /en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_events_state
    • /zh-CN/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_filtering_conditional_rendering does not exist but fell back to /en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_filtering_conditional_rendering
    • /zh-CN/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_accessibility does not exist but fell back to /en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_accessibility
    • and 22 more flaws omitted
  • broken_links:
    • Can use the English (en-US) link as a fallback

URL: /zh-CN/docs/Web/API/Push_API
Title: Push API
Flaw count: 13

  • macros:
    • /zh-CN/docs/Web/API/PushSubscription does not exist but fell back to /en-US/docs/Web/API/PushSubscription
    • /zh-CN/docs/Web/API/ServiceWorkerGlobalScope/push_event does not exist but fell back to /en-US/docs/Web/API/ServiceWorkerGlobalScope/push_event
    • /zh-CN/docs/Web/API/ServiceWorkerRegistration/showNotification does not exist but fell back to /en-US/docs/Web/API/ServiceWorkerRegistration/showNotification
    • /zh-CN/docs/Web/API/PushEvent does not exist but fell back to /en-US/docs/Web/API/PushEvent
    • /zh-CN/docs/Web/API/PushSubscription does not exist but fell back to /en-US/docs/Web/API/PushSubscription
    • and 7 more flaws omitted
  • translation_differences:
    • Differences in the important macros (3 in common of 4 possible)

URL: /zh-CN/docs/Web/API/File_System_API
Title: 文件系统 API
Flaw count: 16

  • macros:
    • /zh-CN/docs/Web/API/FileSystemDirectoryHandle does not exist but fell back to /en-US/docs/Web/API/FileSystemDirectoryHandle
    • /zh-CN/docs/Web/API/DataTransferItem/getAsFileSystemHandle does not exist but fell back to /en-US/docs/Web/API/DataTransferItem/getAsFileSystemHandle
    • /zh-CN/docs/Web/API/FileSystemWritableFileStream does not exist but fell back to /en-US/docs/Web/API/FileSystemWritableFileStream
    • /zh-CN/docs/Web/API/FileSystemSyncAccessHandle does not exist but fell back to /en-US/docs/Web/API/FileSystemSyncAccessHandle
    • /zh-CN/docs/Web/API/FileSystemSyncAccessHandle/write does not exist but fell back to /en-US/docs/Web/API/FileSystemSyncAccessHandle/write
    • and 10 more flaws omitted
  • broken_links:
    • Can use the English (en-US) link as a fallback

URL: /zh-CN/docs/Web/API/XMLHttpRequest
Title: XMLHttpRequest
Flaw count: 16

  • macros:
    • /zh-CN/docs/Web/API/XMLHttpRequest/onreadystatechange redirects to /zh-CN/docs/Web/API/XMLHttpRequest/readystatechange_event
    • wrong xref macro used (consider changing which macro you use)
    • wrong xref macro used (consider changing which macro you use)
    • wrong xref macro used (consider changing which macro you use)
    • wrong xref macro used (consider changing which macro you use)
    • and 10 more flaws omitted
  • translation_differences:
    • Differences in the important macros (3 in common of 4 possible)

URL: /zh-CN/docs/Web/API/Window/showDirectoryPicker
Title: Window:showDirectoryPicker() 方法
Flaw count: 4

  • macros:
    • /zh-CN/docs/Web/API/FileSystemDirectoryHandle does not exist but fell back to /en-US/docs/Web/API/FileSystemDirectoryHandle
    • /zh-CN/docs/Web/API/FileSystemDirectoryHandle does not exist but fell back to /en-US/docs/Web/API/FileSystemDirectoryHandle
  • broken_links:
    • Can use the English (en-US) link as a fallback
  • translation_differences:
    • Differences in the important macros (3 in common of 5 possible)

URL: /zh-CN/docs/Web/API/Window/showSaveFilePicker
Title: Window:showSaveFilePicker() 方法
Flaw count: 2

  • broken_links:
    • Can use the English (en-US) link as a fallback
  • translation_differences:
    • Differences in the important macros (3 in common of 5 possible)

URL: /zh-CN/docs/Web/API/Window/showOpenFilePicker
Title: Window:showOpenFilePicker() 方法
Flaw count: 2

  • broken_links:
    • Can use the English (en-US) link as a fallback
  • translation_differences:
    • Differences in the important macros (3 in common of 5 possible)

URL: /zh-CN/docs/Web/API/FileSystemHandle
Title: FileSystemHandle
Flaw count: 4

  • macros:
    • /zh-CN/docs/Web/API/File_System_Access_API redirects to /zh-CN/docs/Web/API/File_System_API
    • /zh-CN/docs/Web/API/FileSystemDirectoryHandle does not exist but fell back to /en-US/docs/Web/API/FileSystemDirectoryHandle
    • /zh-CN/docs/Web/API/FileSystemDirectoryHandle does not exist but fell back to /en-US/docs/Web/API/FileSystemDirectoryHandle
  • translation_differences:
    • Differences in the important macros (2 in common of 4 possible)

URL: /zh-CN/docs/Web/API/FileSystemHandle/kind
Title: FileSystemHandle:kind 属性
Flaw count: 2

  • macros:
    • /zh-CN/docs/Web/API/FileSystemDirectoryHandle does not exist but fell back to /en-US/docs/Web/API/FileSystemDirectoryHandle
  • translation_differences:
    • Differences in the important macros (2 in common of 4 possible)

URL: /zh-CN/docs/Web/API/FileSystemHandle/requestPermission
Title: FileSystemHandle:requestPermission() 方法
Flaw count: 2

  • macros:
    • /zh-CN/docs/Web/API/PermissionStatus/state does not exist but fell back to /en-US/docs/Web/API/PermissionStatus/state
  • translation_differences:
    • Differences in the important macros (3 in common of 5 possible)

URL: /zh-CN/docs/Web/API/FileSystemHandle/queryPermission
Title: FileSystemHandle:queryPermission() 方法
Flaw count: 2

  • macros:
    • /zh-CN/docs/Web/API/PermissionStatus/state does not exist but fell back to /en-US/docs/Web/API/PermissionStatus/state
  • translation_differences:
    • Differences in the important macros (3 in common of 5 possible)

URL: /zh-CN/docs/Web/API/FileSystemHandle/name
Title: FileSystemHandle:name 属性
Flaw count: 1

  • translation_differences:
    • Differences in the important macros (2 in common of 4 possible)

URL: /zh-CN/docs/Web/API/FileSystemHandle/isSameEntry
Title: FileSystemHandle:isSameEntry() 方法
Flaw count: 1

  • translation_differences:
    • Differences in the important macros (2 in common of 4 possible)

URL: /zh-CN/docs/Web/API/WebCodecs_API
Title: WebCodecs API
Flaw count: 17

  • macros:
    • /zh-CN/docs/Web/API/AudioDecoder does not exist but fell back to /en-US/docs/Web/API/AudioDecoder
    • /zh-CN/docs/Web/API/EncodedAudioChunk does not exist but fell back to /en-US/docs/Web/API/EncodedAudioChunk
    • /zh-CN/docs/Web/API/VideoDecoder does not exist but fell back to /en-US/docs/Web/API/VideoDecoder
    • /zh-CN/docs/Web/API/EncodedVideoChunk does not exist but fell back to /en-US/docs/Web/API/EncodedVideoChunk
    • /zh-CN/docs/Web/API/AudioEncoder does not exist but fell back to /en-US/docs/Web/API/AudioEncoder
    • and 12 more flaws omitted

URL: /zh-CN/docs/Web/API/IndexedDB_API/Using_IndexedDB
Title: 使用 IndexedDB
Flaw count: 18

  • macros:
    • /zh-CN/docs/Web/API/IDBDatabase/transaction does not exist but fell back to /en-US/docs/Web/API/IDBDatabase/transaction
    • /zh-CN/docs/Web/API/IDBIndex/objectStore does not exist but fell back to /en-US/docs/Web/API/IDBIndex/objectStore
    • /zh-CN/docs/Web/API/IDBTransaction/complete_event does not exist but fell back to /en-US/docs/Web/API/IDBTransaction/complete_event
    • /zh-CN/docs/Web/API/IDBDatabase/transaction does not exist but fell back to /en-US/docs/Web/API/IDBDatabase/transaction
    • /zh-CN/docs/Web/API/IDBTransaction/abort does not exist but fell back to /en-US/docs/Web/API/IDBTransaction/abort
    • and 6 more flaws omitted
  • broken_links:
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • and 2 more flaws omitted

URL: /zh-CN/docs/Web/API/Navigator/sendBeacon
Title: Navigator.sendBeacon()
Flaw count: 2

  • macros:
    • wrong xref macro used (consider changing which macro you use)
    • wrong xref macro used (consider changing which macro you use)

URL: /zh-CN/docs/Web/API/FileSystemFileHandle
Title: FileSystemFileHandle
Flaw count: 6

  • macros:
    • /zh-CN/docs/Web/API/FileSystemSyncAccessHandle does not exist but fell back to /en-US/docs/Web/API/FileSystemSyncAccessHandle
    • /zh-CN/docs/Web/API/FileSystemWritableFileStream does not exist but fell back to /en-US/docs/Web/API/FileSystemWritableFileStream
    • /zh-CN/docs/Web/API/FileSystemSyncAccessHandle/close does not exist but fell back to /en-US/docs/Web/API/FileSystemSyncAccessHandle/close
    • /zh-CN/docs/Web/API/FileSystemSyncAccessHandle/flush does not exist but fell back to /en-US/docs/Web/API/FileSystemSyncAccessHandle/flush
    • /zh-CN/docs/Web/API/FileSystemSyncAccessHandle/getSize does not exist but fell back to /en-US/docs/Web/API/FileSystemSyncAccessHandle/getSize
    • and 1 more flaws omitted

URL: /zh-CN/docs/Web/API/FileSystemFileHandle/getFile
Title: FileSystemFileHandle:getFile() 方法
Flaw count: 1

  • macros:
    • /zh-CN/docs/Web/API/PermissionStatus/state does not exist but fell back to /en-US/docs/Web/API/PermissionStatus/state

URL: /zh-CN/docs/Web/API/FileSystemFileHandle/createSyncAccessHandle
Title: FileSystemFileHandle:createSyncAccessHandle() 方法
Flaw count: 8

  • macros:
    • /zh-CN/docs/Web/API/FileSystemSyncAccessHandle does not exist but fell back to /en-US/docs/Web/API/FileSystemSyncAccessHandle
    • /zh-CN/docs/Web/API/FileSystemSyncAccessHandle does not exist but fell back to /en-US/docs/Web/API/FileSystemSyncAccessHandle
    • /zh-CN/docs/Web/API/FileSystemSyncAccessHandle does not exist but fell back to /en-US/docs/Web/API/FileSystemSyncAccessHandle
    • /zh-CN/docs/Web/API/FileSystemWritableFileStream does not exist but fell back to /en-US/docs/Web/API/FileSystemWritableFileStream
    • /zh-CN/docs/Web/API/FileSystemSyncAccessHandle does not exist but fell back to /en-US/docs/Web/API/FileSystemSyncAccessHandle
    • and 1 more flaws omitted
  • broken_links:
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback

URL: /zh-CN/docs/Web/API/FileSystemFileHandle/createWritable
Title: FileSystemFileHandle:createWritable() 方法
Flaw count: 3

  • macros:
    • /zh-CN/docs/Web/API/FileSystemWritableFileStream does not exist but fell back to /en-US/docs/Web/API/FileSystemWritableFileStream
    • /zh-CN/docs/Web/API/FileSystemWritableFileStream does not exist but fell back to /en-US/docs/Web/API/FileSystemWritableFileStream
    • /zh-CN/docs/Web/API/PermissionStatus/state does not exist but fell back to /en-US/docs/Web/API/PermissionStatus/state

URL: /zh-CN/docs/Web/CSS/scroll-margin-inline-end
Title: scroll-margin-inline-end
Flaw count: 1

  • translation_differences:
    • Differences in the important macros (5 in common of 7 possible)

URL: /zh-CN/docs/Web/CSS/scroll-margin-inline
Title: scroll-margin-inline
Flaw count: 1

  • translation_differences:
    • Differences in the important macros (5 in common of 7 possible)

URL: /zh-CN/docs/Web/CSS/CSS_scroll_snap
Title: CSS 滚动吸附
Flaw count: 2

  • broken_links:
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback

URL: /zh-CN/docs/Web/CSS/scroll-snap-stop
Title: scroll-snap-stop
Flaw count: 1

  • translation_differences:
    • Differences in the important macros (5 in common of 7 possible)

URL: /zh-CN/docs/Web/CSS/scroll-margin-inline-start
Title: scroll-margin-inline-start
Flaw count: 1

  • translation_differences:
    • Differences in the important macros (5 in common of 7 possible)

URL: /zh-CN/docs/Web/CSS/scroll-margin
Title: scroll-margin
Flaw count: 1

  • translation_differences:
    • Differences in the important macros (5 in common of 7 possible)

URL: /zh-CN/docs/Web/CSS/scroll-snap-type
Title: scroll-snap-type
Flaw count: 1

  • translation_differences:
    • Differences in the important macros (5 in common of 7 possible)

URL: /zh-CN/docs/Web/CSS/content-visibility
Title: content-visibility
Flaw count: 1

  • translation_differences:
    • Differences in the important macros (5 in common of 7 possible)

URL: /zh-CN/docs/Web/CSS/contain-intrinsic-size
Title: contain-intrinsic-size
Flaw count: 1

  • translation_differences:
    • Differences in the important macros (4 in common of 7 possible)

URL: /zh-CN/docs/Web/Text_fragments
Title: 文本片段
Flaw count: 6

  • macros:
    • /zh-CN/docs/Web/API/FragmentDirective does not exist but fell back to /en-US/docs/Web/API/FragmentDirective
    • /zh-CN/docs/Web/API/Document/fragmentDirective does not exist but fell back to /en-US/docs/Web/API/Document/fragmentDirective
    • /zh-CN/docs/Web/API/FragmentDirective does not exist but fell back to /en-US/docs/Web/API/FragmentDirective
    • /zh-CN/docs/Web/API/FragmentDirective does not exist but fell back to /en-US/docs/Web/API/FragmentDirective
    • /zh-CN/docs/Web/API/Document/fragmentDirective does not exist but fell back to /en-US/docs/Web/API/Document/fragmentDirective
    • and 1 more flaws omitted

URL: /zh-CN/docs/Web/HTTP/Headers/Sec-CH-UA-Arch
Title: Sec-CH-UA-Arch
Flaw count: 1

  • broken_links:
    • Can use the English (en-US) link as a fallback

URL: /zh-CN/docs/Web/HTTP/Headers/Sec-CH-UA
Title: Sec-CH-UA
Flaw count: 1

  • broken_links:
    • Can use the English (en-US) link as a fallback

URL: /zh-CN/docs/Web/HTTP/Headers/Sec-CH-UA-Bitness
Title: Sec-CH-UA-Bitness
Flaw count: 1

  • broken_links:
    • Can use the English (en-US) link as a fallback

URL: /zh-CN/docs/Web/HTTP/Headers/Sec-CH-UA-Full-Version
Title: Sec-CH-UA-Full-Version
Flaw count: 1

  • broken_links:
    • Can use the English (en-US) link as a fallback

URL: /zh-CN/docs/Web/HTTP/Headers/Sec-Fetch-Dest
Title: Sec-Fetch-Dest
Flaw count: 5

  • macros:
    • /zh-CN/docs/Glossary/CORS-safelisted_request_header does not exist but fell back to /en-US/docs/Glossary/CORS-safelisted_request_header
    • /zh-CN/docs/Web/API/Request/destination does not exist but fell back to /en-US/docs/Web/API/Request/destination
    • /zh-CN/docs/Web/API/Worklet/addModule does not exist but fell back to /en-US/docs/Web/API/Worklet/addModule
    • /zh-CN/docs/Web/API/Worklet/addModule does not exist but fell back to /en-US/docs/Web/API/Worklet/addModule
  • broken_links:
    • Can use the English (en-US) link as a fallback

URL: /zh-CN/docs/Web/HTTP/Headers/Sec-CH-UA-Full-Version-List
Title: Sec-CH-UA-Full-Version-List
Flaw count: 1

  • broken_links:
    • Can use the English (en-US) link as a fallback

URL: /zh-CN/docs/Web/HTTP/Client_hints
Title: HTTP 客户端提示(Clinet Hint)
Flaw count: 3

  • broken_links:
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback

URL: /zh-CN/docs/Web/Security/Same-origin_policy
Title: 浏览器的同源策略
Flaw count: 1

  • broken_links:
    • Can use the English (en-US) link as a fallback

URL: /zh-CN/docs/Web/Progressive_web_apps
Title: 渐进式 Web 应用(PWA)
Flaw count: 13

  • broken_links:
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • and 8 more flaws omitted

URL: /zh-CN/docs/Web/Progressive_web_apps/Tutorials/CycleTracker/Manifest_file
Title: 经期跟踪器:清单和图标
Flaw count: 13

  • broken_links:
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • and 8 more flaws omitted

URL: /zh-CN/docs/Web/Progressive_web_apps/Guides/Best_practices
Title: 渐进式 Web 应用的最佳实践
Flaw count: 6

  • broken_links:
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • and 1 more flaws omitted

URL: /zh-CN/docs/Web/Progressive_web_apps/Guides/Caching
Title: 缓存
Flaw count: 5

  • macros:
    • /zh-CN/docs/Web/API/ServiceWorkerGlobalScope/fetch_event does not exist but fell back to /en-US/docs/Web/API/ServiceWorkerGlobalScope/fetch_event
    • /zh-CN/docs/Web/API/ServiceWorkerGlobalScope/install_event does not exist but fell back to /en-US/docs/Web/API/ServiceWorkerGlobalScope/install_event
    • /zh-CN/docs/Web/API/ServiceWorkerGlobalScope/activate_event does not exist but fell back to /en-US/docs/Web/API/ServiceWorkerGlobalScope/activate_event
  • broken_links:
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback

URL: /zh-CN/docs/Web/Progressive_web_apps/Guides/Offline_and_background_operation
Title: 离线和后台操作
Flaw count: 39

  • macros:
    • /zh-CN/docs/Web/API/ServiceWorkerGlobalScope/fetch_event does not exist but fell back to /en-US/docs/Web/API/ServiceWorkerGlobalScope/fetch_event
    • /zh-CN/docs/Web/API/ServiceWorkerContainer/ready does not exist but fell back to /en-US/docs/Web/API/ServiceWorkerContainer/ready
    • /zh-CN/docs/Web/API/ServiceWorkerRegistration does not exist but fell back to /en-US/docs/Web/API/ServiceWorkerRegistration
    • /zh-CN/docs/Web/API/SyncManager/register does not exist but fell back to /en-US/docs/Web/API/SyncManager/register
    • /zh-CN/docs/Web/API/BackgroundFetchManager/fetch does not exist but fell back to /en-US/docs/Web/API/BackgroundFetchManager/fetch
    • and 21 more flaws omitted
  • broken_links:
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • Can use the English (en-US) link as a fallback
    • and 8 more flaws omitted

URL: /zh-CN/docs/Web/Guide/Audio_and_video_manipulation
Title: 音频与视频处理
Flaw count: 4

  • macros:
    • /zh-CN/docs/Web/API/AudioBufferSourceNode/playbackRate does not exist but fell back to /en-US/docs/Web/API/AudioBufferSourceNode/playbackRate
    • /zh-CN/docs/Web/API/PannerNode does not exist but fell back to /en-US/docs/Web/API/PannerNode
  • broken_links:
    • Can use the English (en-US) link as a fallback
  • translation_differences:
    • Differences in the important macros (1 in common of 7 possible)

URL: /zh-CN/docs/Web/Performance/Lazy_loading
Title: 懒加载
Flaw count: 2

  • macros:
    • /zh-CN/docs/Glossary/visual_viewport does not exist but fell back to /en-US/docs/Glossary/Visual_Viewport
    • /zh-CN/docs/Web/API/HTMLImageElement/complete does not exist but fell back to /en-US/docs/Web/API/HTMLImageElement/complete

URL: /zh-CN/docs/Web/JavaScript/Guide/Typed_arrays
Title: JavaScript 类型化数组
Flaw count: 2

  • macros:
    • /zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Int16Array does not exist but fell back to /en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array
    • /zh-CN/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array does not exist but fell back to /en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array

URL: /zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise
Title: Promise
Flaw count: 1

  • translation_differences:
    • Differences in the important macros (2 in common of 4 possible)

URL: /zh-CN/docs/Glossary/Fetch_metadata_request_header
Title: Fetch 元数据请求标头
Flaw count: 1

  • macros:
    • /zh-CN/docs/Glossary/resource_isolation_policy does not exist
External URLs (88)

URL: /zh-TW/docs/WebAssembly
Title: WebAssembly


URL: /zh-TW/docs/Web/HTTP
Title: HTTP


URL: /zh-TW/docs/Web/HTTP/Headers/Cache-Control
Title: Cache-Control


URL: /zh-CN/docs/Learn/Performance/CSS
Title: CSS 性能优化


URL: /zh-CN/docs/Learn/Performance/JavaScript
Title: JavaScript 性能优化


URL: /zh-CN/docs/Web/API/Push_API
Title: Push API


URL: /zh-CN/docs/Web/API/File_System_API
Title: 文件系统 API


URL: /zh-CN/docs/Web/API/XMLHttpRequest
Title: XMLHttpRequest


URL: /zh-CN/docs/Web/API/Window/showDirectoryPicker
Title: Window:showDirectoryPicker() 方法


URL: /zh-CN/docs/Web/API/Window/showSaveFilePicker
Title: Window:showSaveFilePicker() 方法


URL: /zh-CN/docs/Web/API/Window/showOpenFilePicker
Title: Window:showOpenFilePicker() 方法


URL: /zh-CN/docs/Web/API/FileSystemHandle
Title: FileSystemHandle


URL: /zh-CN/docs/Web/API/FileSystemHandle/kind
Title: FileSystemHandle:kind 属性


URL: /zh-CN/docs/Web/API/FileSystemHandle/requestPermission
Title: FileSystemHandle:requestPermission() 方法


URL: /zh-CN/docs/Web/API/FileSystemHandle/queryPermission
Title: FileSystemHandle:queryPermission() 方法


URL: /zh-CN/docs/Web/API/FileSystemHandle/name
Title: FileSystemHandle:name 属性


URL: /zh-CN/docs/Web/API/FileSystemHandle/isSameEntry
Title: FileSystemHandle:isSameEntry() 方法


URL: /zh-CN/docs/Web/API/EyeDropper_API
Title: EyeDropper API


URL: /zh-CN/docs/Web/API/WebCodecs_API
Title: WebCodecs API


URL: /zh-CN/docs/Web/API/AbortSignal/timeout_static
Title: AbortSignal.timeout()


URL: /zh-CN/docs/Web/API/ResizeObserverEntry/devicePixelContentBoxSize
Title: ResizeObserverEntry.devicePixelContentBoxSize


URL: /zh-CN/docs/Web/API/IndexedDB_API/Using_IndexedDB
Title: 使用 IndexedDB


URL: /zh-CN/docs/Web/API/Navigator/sendBeacon
Title: Navigator.sendBeacon()


URL: /zh-CN/docs/Web/API/FileSystemFileHandle
Title: FileSystemFileHandle


URL: /zh-CN/docs/Web/API/FileSystemFileHandle/getFile
Title: FileSystemFileHandle:getFile() 方法


URL: /zh-CN/docs/Web/API/FileSystemFileHandle/createSyncAccessHandle
Title: FileSystemFileHandle:createSyncAccessHandle() 方法


URL: /zh-CN/docs/Web/API/FileSystemFileHandle/createWritable
Title: FileSystemFileHandle:createWritable() 方法


URL: /zh-CN/docs/Web/API/TransformStream
Title: TransformStream


URL: /zh-CN/docs/Web/API/TransformStream/TransformStream
Title: TransformStream()


URL: /zh-CN/docs/Web/CSS/scroll-margin-right
Title: scroll-margin-right


URL: /zh-CN/docs/Web/CSS/scroll-margin-inline-end
Title: scroll-margin-inline-end


URL: /zh-CN/docs/Web/CSS/contain-intrinsic-block-size
Title: contain-intrinsic-block-size


URL: /zh-CN/docs/Web/CSS/scroll-padding-bottom
Title: scroll-padding-bottom


URL: /zh-CN/docs/Web/CSS/scroll-padding-left
Title: scroll-padding-left


URL: /zh-CN/docs/Web/CSS/scroll-padding-inline-start
Title: scroll-padding-inline-start


URL: /zh-CN/docs/Web/CSS/scroll-padding-block
Title: scroll-padding-block


URL: /zh-CN/docs/Web/CSS/mask-image
Title: mask-image


URL: /zh-CN/docs/Web/CSS/scroll-margin-inline
Title: scroll-margin-inline


URL: /zh-CN/docs/Web/CSS/scroll-padding-right
Title: scroll-padding-right


URL: /zh-CN/docs/Web/CSS/CSS_scroll_snap
Title: CSS 滚动吸附


URL: /zh-CN/docs/Web/CSS/CSS_scroll_snap/Basic_concepts
Title: 滚动吸附的基本概念


URL: /zh-CN/docs/Web/CSS/scroll-margin-block-start
Title: scroll-margin-block-start


URL: /zh-CN/docs/Web/CSS/scroll-snap-align
Title: scroll-snap-align


URL: /zh-CN/docs/Web/CSS/scroll-margin-bottom
Title: scroll-margin-bottom


URL: /zh-CN/docs/Web/CSS/scroll-padding-block-end
Title: scroll-padding-block-end


URL: /zh-CN/docs/Web/CSS/contain-intrinsic-width
Title: contain-intrinsic-width


URL: /zh-CN/docs/Web/CSS/scroll-padding
Title: scroll-padding


URL: /zh-CN/docs/Web/CSS/scroll-padding-inline
Title: scroll-padding-inline


URL: /zh-CN/docs/Web/CSS/scroll-snap-stop
Title: scroll-snap-stop


URL: /zh-CN/docs/Web/CSS/contain-intrinsic-inline-size
Title: contain-intrinsic-inline-size


URL: /zh-CN/docs/Web/CSS/contain-intrinsic-height
Title: contain-intrinsic-height


URL: /zh-CN/docs/Web/CSS/scroll-margin-inline-start
Title: scroll-margin-inline-start


URL: /zh-CN/docs/Web/CSS/scroll-padding-block-start
Title: scroll-padding-block-start


URL: /zh-CN/docs/Web/CSS/scroll-padding-inline-end
Title: scroll-padding-inline-end


URL: /zh-CN/docs/Web/CSS/scroll-margin
Title: scroll-margin


URL: /zh-CN/docs/Web/CSS/scroll-margin-top
Title: scroll-margin-top


URL: /zh-CN/docs/Web/CSS/scroll-margin-left
Title: scroll-margin-left


URL: /zh-CN/docs/Web/CSS/scroll-margin-block-end
Title: scroll-margin-block-end


URL: /zh-CN/docs/Web/CSS/scroll-snap-type
Title: scroll-snap-type


URL: /zh-CN/docs/Web/CSS/scroll-margin-block
Title: scroll-margin-block


URL: /zh-CN/docs/Web/CSS/content-visibility
Title: content-visibility


URL: /zh-CN/docs/Web/CSS/contain-intrinsic-size
Title: contain-intrinsic-size


URL: /zh-CN/docs/Web/CSS/scroll-padding-top
Title: scroll-padding-top


URL: /zh-CN/docs/Web/Text_fragments
Title: 文本片段


URL: /zh-CN/docs/Web/HTTP
Title: HTTP


URL: /zh-CN/docs/Web/HTTP/Headers/Sec-CH-UA-Arch
Title: Sec-CH-UA-Arch


URL: /zh-CN/docs/Web/HTTP/Headers/Sec-CH-UA
Title: Sec-CH-UA


URL: /zh-CN/docs/Web/HTTP/Headers/Sec-CH-UA-Bitness
Title: Sec-CH-UA-Bitness


URL: /zh-CN/docs/Web/HTTP/Headers/Sec-CH-UA-Full-Version
Title: Sec-CH-UA-Full-Version


URL: /zh-CN/docs/Web/HTTP/Headers/Sec-Fetch-Dest
Title: Sec-Fetch-Dest


URL: /zh-CN/docs/Web/HTTP/Headers/Sec-CH-UA-Full-Version-List
Title: Sec-CH-UA-Full-Version-List


URL: /zh-CN/docs/Web/HTTP/Client_hints
Title: HTTP 客户端提示(Clinet Hint)


URL: /zh-CN/docs/Web/Security/Same-origin_policy
Title: 浏览器的同源策略


URL: /zh-CN/docs/Web/Progressive_web_apps
Title: 渐进式 Web 应用(PWA)


URL: /zh-CN/docs/Web/Progressive_web_apps/Tutorials/CycleTracker/Manifest_file
Title: 经期跟踪器:清单和图标


URL: /zh-CN/docs/Web/Progressive_web_apps/Guides/Best_practices
Title: 渐进式 Web 应用的最佳实践


URL: /zh-CN/docs/Web/Progressive_web_apps/Guides/Caching
Title: 缓存


URL: /zh-CN/docs/Web/Progressive_web_apps/Guides/Offline_and_background_operation
Title: 离线和后台操作


URL: /zh-CN/docs/Web/Guide/Audio_and_video_manipulation
Title: 音频与视频处理


URL: /zh-CN/docs/Web/Guide/Performance
Title: 优化和性能


URL: /zh-CN/docs/Web/Performance/Lazy_loading
Title: 懒加载


URL: /zh-CN/docs/Web/JavaScript/Guide/Typed_arrays
Title: JavaScript 类型化数组


URL: /zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise
Title: Promise


URL: /zh-CN/docs/Glossary/Fetch_metadata_request_header
Title: Fetch 元数据请求标头

(comment last updated: 2023-10-26 13:44:51)

@yin1999 yin1999 marked this pull request as ready for review October 26, 2023 11:39
@yin1999 yin1999 requested a review from a team as a code owner October 26, 2023 11:39
@yin1999 yin1999 requested review from jasonren0403 and removed request for a team October 26, 2023 11:39
@yin1999 yin1999 changed the title chore(zh-cn): migrate web.dev links chore(zh): migrate web.dev links Oct 26, 2023
Copy link
Contributor

@jasonren0403 jasonren0403 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

files/zh-cn/web/progressive_web_apps/tutorials/cycletracker/manifest_file/index.md:

- 所有图标都应该有相同的外观和感觉,以确保用户可以识别你的 PWA。但图标越大,它可以包含的细节就越丰富。尽管所有图标文件都是正方形的,但有些操作系统会以不同的形状渲染图标,裁剪部分区域或“遮挡”图标以适应 UI,或者如果图标不可遮挡则会缩小并居中放置在背景上。[安全区域](/zh-CN/docs/Web/Progressive_web_apps/How_to/Define_app_icons#支持遮挡),即图标被遮挡为圆形时也会正常渲染的内部 80% 区域。通过将 `purpose` 成员设置为 `maskable`,可以将图标定义为[自适应图标](https://web.dev/maskable-icons/)。
+ 所有图标都应该有相同的外观和感觉,以确保用户可以识别你的 PWA。但图标越大,它可以包含的细节就越丰富。尽管所有图标文件都是正方形的,但有些操作系统会以不同的形状渲染图标,裁剪部分区域或“遮挡”图标以适应 UI,或者如果图标不可遮挡则会缩小并居中放置在背景上。[安全区域](/zh-CN/docs/Web/Progressive_web_apps/How_to/Define_app_icons#支持遮挡),即图标被遮挡为圆形时也会正常渲染的内部 80% 区域。通过将 `purpose` 成员设置为 `maskable`,可以将图标定义为[自适应图标](https://web.dev/articles/maskable-icon)。

@yin1999 yin1999 requested a review from jasonren0403 October 26, 2023 13:41
Copy link
Contributor

@jasonren0403 jasonren0403 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jasonren0403 jasonren0403 merged commit eb2f976 into mdn:main Oct 26, 2023
7 checks passed
@yin1999 yin1999 deleted the zh-cn-web-dev branch October 26, 2023 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
l10n-zh Issues related to Chinese content.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants