From 01b0e12ba27b5069248fd09235e9a7143915ee30 Mon Sep 17 00:00:00 2001 From: Irvin Date: Wed, 16 Feb 2022 02:02:49 +0800 Subject: remove `notranslate` class in zh-CN --- .../javascript/reference/global_objects/intl/locale/index.html | 4 ++-- .../reference/global_objects/intl/relativetimeformat/index.html | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/global_objects/intl') diff --git a/files/zh-cn/web/javascript/reference/global_objects/intl/locale/index.html b/files/zh-cn/web/javascript/reference/global_objects/intl/locale/index.html index 181d9dc0bf..08af53d8fa 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/intl/locale/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/intl/locale/index.html @@ -64,13 +64,13 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Intl/Locale

很简单,就是需要给{{jsxref("Locale/Locale", "Intl.Locale")}} 构造函数传入一个 locale 标识字符串作为参数:

-
let us = new Intl.Locale('zh-Hans-CN');
+
let us = new Intl.Locale('zh-Hans-CN');

使用配置实例化

构造函数支持传入 object 作为配置,object 中可包含多个配置属性。例如,设置 hourCycle 属性,用于设置您所需要的小时周期类型:

-
let zh12hour = new Intl.Locale("zh-Hans-CN", {hourCycle: "h12"});
+
let zh12hour = new Intl.Locale("zh-Hans-CN", {hourCycle: "h12"});
 console.log(zh12hour.hourCycle); // Prints "h12"

规范

diff --git a/files/zh-cn/web/javascript/reference/global_objects/intl/relativetimeformat/index.html b/files/zh-cn/web/javascript/reference/global_objects/intl/relativetimeformat/index.html index 561af8a1fe..a05c3385dd 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/intl/relativetimeformat/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/intl/relativetimeformat/index.html @@ -14,7 +14,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat

句法

-
new Intl.RelativeTimeFormat([locales[, options]])
+
new Intl.RelativeTimeFormat([locales[, options]])
 

参数

@@ -84,7 +84,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat

以下示例显示如何使用英语创建相对时间格式化程序。

-
//在语言环境中创建相对时间格式化程序
+
//在语言环境中创建相对时间格式化程序
 //显式传入默认值。
 const rtf = new Intl.RelativeTimeFormat("en",{
     localeMatcher: "bestfit",//其他值:"lookup"
@@ -104,7 +104,7 @@ rtf.format(1,"day");
 
 

如果numeric:auto选项被传递,它将生成字符串yesterdaytomorrow代替1 day agoin 1 day。这允许不必总是在输出中使用数值。

-
//在语言环境中创建相对时间格式化程序
+
//在语言环境中创建相对时间格式化程序
 //使用数字:传入"auto"选项值。
 const rtf = new Intl.RelativeTimeFormat("en",{numeric: "auto"});
 
@@ -121,7 +121,7 @@ rtf.format(1,"day");
 
 

以下示例显示如何创建返回格式化部件的相对时间格式器

-
const rtf = new Intl.RelativeTimeFormat("en",{numeric: "auto"});
+
const rtf = new Intl.RelativeTimeFormat("en",{numeric: "auto"});
 
 //使用日期单位格式化相对时间。
 rtf.formatToParts(-1,"day");
-- 
cgit v1.2.3-54-g00ecf