-
Notifications
You must be signed in to change notification settings - Fork 8k
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
Conversation
Preview URLs Flaws (4)URL:
External URLs (1)URL:
(comment last updated: 2024-07-17 11:15:08) |
|
||
## 示例 | ||
|
||
[解析 URL 的相对引用](/zh-CN/docs/Web/API/URL_API/Resolving_relative_references) 和 [`URL()` 构造函数](/zh-CN/docs/Web/API/URL/URL#示例) 提供了更多示例,演示了不同的 `url` 和 `base` 值如何解析为最终的绝对 URL(尽管主要使用 `URL()`)。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[解析 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()`)。 |
There was a problem hiding this comment.
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.
There was a problem hiding this 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() |
There was a problem hiding this comment.
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#元数据
本地化短标题与英语文档相同的情况下无需该元数据
short-title: parse() |
|
||
## 示例 | ||
|
||
[解析 URL 的相对引用](/zh-CN/docs/Web/API/URL_API/Resolving_relative_references)和[`URL()` 构造函数](/zh-CN/docs/Web/API/URL/URL#示例)提供了更多示例,演示了不同的 `url` 和 `base` 值如何解析为最终的绝对 URL(尽管主要使用 `URL()`)。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
空格
[解析 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。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- : 一个字符串或任何其他具有 {{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 的结果。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
下一步,我们检查 `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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```html | |
```html hidden |
<pre id="log"></pre> | ||
``` | ||
|
||
```css |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```css | |
```css hidden |
|
||
首先我们定义了一个 HTML `<pre>` 元素用于日志记录,并提供了一个记录方法 `log()`。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
英语文档没有这句话
首先我们定义了一个 HTML `<pre>` 元素用于日志记录,并提供了一个记录方法 `log()`。 |
log(`[2]: ${result.href}`); | ||
|
||
// 相对引用到更复杂的有效基础 URL | ||
// (仅使用方案和域名来解析 URL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// (仅使用方案和域名来解析 URL) | |
//(仅使用协议和域名来解析 URL) |
ok 感谢 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Description
translate for url.parse() method
Motivation
Additional details
Related issues and pull requests