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

[zh-CN] add web api url.parse() translation #22159

Merged
merged 6 commits into from
Jul 17, 2024
Merged

Conversation

little-huang
Copy link
Contributor

Description

translate for url.parse() method

Motivation

Additional details

Related issues and pull requests

@little-huang little-huang requested a review from a team as a code owner July 4, 2024 09:58
@little-huang little-huang requested review from jasonren0403 and removed request for a team July 4, 2024 09:58
@github-actions github-actions bot added the l10n-zh Issues related to Chinese content. label Jul 4, 2024
files/zh-cn/web/api/url/parse_static/index.md Outdated Show resolved Hide resolved
files/zh-cn/web/api/url/parse_static/index.md Outdated Show resolved Hide resolved
files/zh-cn/web/api/url/parse_static/index.md Outdated Show resolved Hide resolved
files/zh-cn/web/api/url/parse_static/index.md Outdated Show resolved Hide resolved
files/zh-cn/web/api/url/parse_static/index.md Outdated Show resolved Hide resolved
Copy link
Contributor

github-actions bot commented Jul 4, 2024

Preview URLs

Flaws (4)

URL: /zh-CN/docs/Web/API/URL/parse_static
Title: URL:parse() 静态方法
Flaw count: 4

  • macros:
    • /zh-CN/docs/Web/API/URL/canParse_static does not exist but fell back to /en-US/docs/Web/API/URL/canParse_static
    • /zh-CN/docs/Glossary/stringifier does not exist but fell back to /en-US/docs/Glossary/Stringifier
    • /zh-CN/docs/Web/API/HTMLAnchorElement does not exist but fell back to /en-US/docs/Web/API/HTMLAnchorElement
  • translation_differences:
    • Differences in the important macros (3 in common of 5 possible)
External URLs (1)

URL: /zh-CN/docs/Web/API/URL/parse_static
Title: URL:parse() 静态方法

(comment last updated: 2024-07-17 11:15:08)

files/zh-cn/web/api/url/parse_static/index.md Outdated Show resolved Hide resolved

## 示例

[解析 URL 的相对引用](/zh-CN/docs/Web/API/URL_API/Resolving_relative_references) 和 [`URL()` 构造函数](/zh-CN/docs/Web/API/URL/URL#示例) 提供了更多示例,演示了不同的 `url` 和 `base` 值如何解析为最终的绝对 URL(尽管主要使用 `URL()`)。
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
[解析 URL 的相对引用](/zh-CN/docs/Web/API/URL_API/Resolving_relative_references) [`URL()` 构造函数](/zh-CN/docs/Web/API/URL/URL#示例) 提供了更多示例,演示了不同的 `url``base` 值如何解析为最终的绝对 URL(尽管主要使用 `URL()`)。
[解析 URL 的相对引用](/zh-CN/docs/Web/API/URL_API/Resolving_relative_references)[`URL()` 构造函数](/zh-CN/docs/Web/API/URL/URL#示例)提供了更多示例,演示了不同的 `url``base` 值如何解析为最终的绝对 URL(尽管主要使用 `URL()`)。
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok , it’s been changed. thank you.

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.

一些需要修改的地方

@@ -0,0 +1,128 @@
---
title: URL:parse() 静态方法
short-title: parse()
Copy link
Contributor

Choose a reason for hiding this comment

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

https://github.com/mdn/translated-content/blob/main/docs/zh-cn/translation-guide.md#元数据

本地化短标题与英语文档相同的情况下无需该元数据

Suggested change
short-title: parse()
files/zh-cn/web/api/url/parse_static/index.md Show resolved Hide resolved

## 示例

[解析 URL 的相对引用](/zh-CN/docs/Web/API/URL_API/Resolving_relative_references)和[`URL()` 构造函数](/zh-CN/docs/Web/API/URL/URL#示例)提供了更多示例,演示了不同的 `url` 和 `base` 值如何解析为最终的绝对 URL(尽管主要使用 `URL()`)。
Copy link
Contributor

@jasonren0403 jasonren0403 Jul 10, 2024

Choose a reason for hiding this comment

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

空格

Suggested change
[解析 URL 的相对引用](/zh-CN/docs/Web/API/URL_API/Resolving_relative_references)[`URL()` 构造函数](/zh-CN/docs/Web/API/URL/URL#示例)提供了更多示例,演示了不同的 `url``base` 值如何解析为最终的绝对 URL(尽管主要使用 `URL()`)。
[解析 URL 的相对引用](/zh-CN/docs/Web/API/URL_API/Resolving_relative_references) [`URL()` 构造函数](/zh-CN/docs/Web/API/URL/URL#示例)提供了更多示例,演示了不同的 `url``base` 值如何解析为最终的绝对 URL(尽管主要使用 `URL()`)。
### 参数

- `url`
- : 一个字符串或任何其他具有 {{Glossary("stringifier")}} 的对象,表示绝对 URL 或 URL 的相对引用。如果 `url` 是相对引用,则需要 `base`,并用于解析最终的 URL。如果 `url` 是绝对 URL,则不会使用给定的 `base` 来创建结果 URL。
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- : 一个字符串或任何其他具有 {{Glossary("stringifier")}} 的对象,表示绝对 URL 或 URL 的相对引用。如果 `url` 是相对引用,则需要 `base`,并用于解析最终的 URL。如果 `url` 是绝对 URL,则不会使用给定的 `base` 来创建结果 URL。
- : 一个字符串或任何其他具有{{Glossary("stringifier", "字符串化器")}}的对象,表示绝对 URL 或 URL 的相对引用。如果 `url` 是相对引用, `base` 是必需的,并用于解析最终的 URL。如果 `url` 是绝对 URL,则不会使用给定的 `base` 来创建结果 URL。
}
```

下一步,我们检查 `URL.parse()` 方法是否受支持,使用条件 `"parse" in URL`。如果该方法受支持,我们会记录检查绝对 URL 的结果、相对引用和基础 URL 的结果、具有更[复杂基础 URL](/zh-CN/docs/Web/API/URL_API/Resolving_relative_references)的相对引用的结果、具有有效基础 URL 的有效绝对 URL(基础 URL 未使用)的结果,以及导致方法返回 `null` 的无效基础 URL 的结果。
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
下一步,我们检查 `URL.parse()` 方法是否受支持,使用条件 `"parse" in URL`。如果该方法受支持,我们会记录检查绝对 URL 的结果、相对引用和基础 URL 的结果、具有更[复杂基础 URL](/zh-CN/docs/Web/API/URL_API/Resolving_relative_references)的相对引用的结果、具有有效基础 URL 的有效绝对 URL(基础 URL 未使用)的结果,以及导致方法返回 `null` 的无效基础 URL 的结果。
首先,我们使用条件 `"parse" in URL` 检查是否支持 `URL.parse()` 方法。如果该方法受支持,我们会记录检查绝对 URL 的结果、相对引用和基础 URL 的结果、具有更[复杂基础 URL](/zh-CN/docs/Web/API/URL_API/Resolving_relative_references)的相对引用的结果、具有有效基础 URL 的有效绝对 URL(基础 URL 未使用)的结果,以及导致方法返回 `null` 的无效基础 URL 的结果。

首先我们定义了一个 HTML `<pre>` 元素用于日志记录,并提供了一个记录方法 `log()`。

```html
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
```html
```html hidden
<pre id="log"></pre>
```

```css
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
```css
```css hidden
Comment on lines 43 to 44

首先我们定义了一个 HTML `<pre>` 元素用于日志记录,并提供了一个记录方法 `log()`。
Copy link
Contributor

Choose a reason for hiding this comment

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

英语文档没有这句话

Suggested change
首先我们定义了一个 HTML `<pre>` 元素用于日志记录,并提供了一个记录方法 `log()`
log(`[2]: ${result.href}`);

// 相对引用到更复杂的有效基础 URL
// (仅使用方案和域名来解析 URL)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// (仅使用方案和域名来解析 URL)
//(仅使用协议和域名来解析 URL)
@little-huang
Copy link
Contributor Author

一些需要修改的地方

ok 感谢

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 enabled auto-merge (squash) July 17, 2024 11:14
@jasonren0403 jasonren0403 merged commit 60f599b into mdn:main Jul 17, 2024
6 of 7 checks passed
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.
3 participants