1# @ohos.i18n (国际化-I18n)(系统接口) 2 3 本模块提供系统相关的或者增强的国际化能力,包括区域管理、电话号码处理、日历等,相关接口为ECMA 402标准中未定义的补充接口。[Intl模块](js-apis-intl.md)提供了ECMA 402标准定义的基础国际化接口,与本模块共同使用可提供完整地国际化支持能力。 4 5> **说明:** 6> - 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 7> 8> - 从API version 11开始,本模块部分接口支持在ArkTS卡片中使用。 9> 10> - 当前页面仅包含本模块的系统接口,其他公开接口参见[@ohos.i18n (国际化-I18n)](js-apis-intl.md)。 11 12 13## 导入模块 14 15```ts 16import { i18n } from '@kit.LocalizationKit'; 17``` 18 19## System<sup>9+</sup> 20 21### setSystemLanguage<sup>9+</sup> 22 23static setSystemLanguage(language: string): void 24 25设置系统语言。当前调用该接口不支持系统界面语言的实时刷新。 26 27若要监听系统语言变化,可以监听[事件](../apis-basic-services-kit/common_event/commonEventManager-definitions.md#common_event_locale_changed)OHOS::EventFwk::CommonEventSupport::COMMON_EVENT_LOCALE_CHANGED。 28 29**系统接口**:此接口为系统接口。 30 31**需要权限**:ohos.permission.UPDATE_CONFIGURATION 32 33**系统能力**:SystemCapability.Global.I18n 34 35**参数:** 36 37| 参数名 | 类型 | 必填 | 说明 | 38| -------- | ------ | ---- | ----- | 39| language | string | 是 | 合法的语言ID。 | 40 41**错误码:** 42 43以下错误码的详细介绍请参见[ohos.i18n错误码](errorcode-i18n.md)和[通用错误码](../errorcode-universal.md)。 44 45| 错误码ID | 错误信息 | 46| ------ | ---------------------- | 47| 201 | Permission verification failed. The application does not have the permission required to call the API. | 48| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. | 49| 890001 | Invalid parameter. Possible causes: Parameter verification failed. | 50 51**示例:** 52 ```ts 53 import { BusinessError, commonEventManager } from '@kit.BasicServicesKit'; 54 55 // 设置系统语言 56 try { 57 i18n.System.setSystemLanguage('zh'); // 设置系统当前语言为 "zh" 58 } catch(error) { 59 let err: BusinessError = error as BusinessError; 60 console.error(`call System.setSystemLanguage failed, error code: ${err.code}, message: ${err.message}.`); 61 } 62 63 // 订阅公共事件 64 let subscriber: commonEventManager.CommonEventSubscriber; // 用于保存创建成功的订阅者对象,后续使用其完成订阅及退订的动作 65 let subscribeInfo: commonEventManager.CommonEventSubscribeInfo = { // 订阅者信息 66 events: [commonEventManager.Support.COMMON_EVENT_LOCALE_CHANGED] 67 }; 68 commonEventManager.createSubscriber(subscribeInfo).then((commonEventSubscriber:commonEventManager.CommonEventSubscriber) => { // 创建订阅者 69 console.info("createSubscriber"); 70 subscriber = commonEventSubscriber; 71 commonEventManager.subscribe(subscriber, (err, data) => { 72 if (err) { 73 console.error(`Failed to subscribe common event. error code: ${err.code}, message: ${err.message}.`); 74 return; 75 } 76 console.info("the subscribed event has occurred."); // 订阅的事件发生时执行 77 }) 78 }).catch((err: BusinessError) => { 79 console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`); 80 }); 81 ``` 82 83### setSystemRegion<sup>9+</sup> 84 85static setSystemRegion(region: string): void 86 87设置系统地区。 88 89若要监听系统地区变化,可以监听[事件](../apis-basic-services-kit/common_event/commonEventManager-definitions.md#common_event_locale_changed)OHOS::EventFwk::CommonEventSupport::COMMON_EVENT_LOCALE_CHANGED。 90 91**系统接口**:此接口为系统接口。 92 93**需要权限**:ohos.permission.UPDATE_CONFIGURATION 94 95**系统能力**:SystemCapability.Global.I18n 96 97**参数:** 98 99| 参数名 | 类型 | 必填 | 说明 | 100| ------ | ------ | ---- | ----- | 101| region | string | 是 | 合法的地区ID。 | 102 103**错误码:** 104 105以下错误码的详细介绍请参见[ohos.i18n错误码](errorcode-i18n.md)和[通用错误码](../errorcode-universal.md)。 106 107| 错误码ID | 错误信息 | 108| ------ | ---------------------- | 109| 201 | Permission verification failed. The application does not have the permission required to call the API. | 110| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. | 111| 890001 | Invalid parameter. Possible causes: Parameter verification failed. | 112 113**示例:** 114 ```ts 115 import { BusinessError } from '@kit.BasicServicesKit'; 116 117 try { 118 i18n.System.setSystemRegion('CN'); // 设置系统当前地区为 "CN" 119 } catch(error) { 120 let err: BusinessError = error as BusinessError; 121 console.error(`call System.setSystemRegion failed, error code: ${err.code}, message: ${err.message}.`); 122 } 123 ``` 124 125 126 127### setSystemLocale<sup>9+</sup> 128 129static setSystemLocale(locale: string): void 130 131设置系统区域。 132 133若要监听系统区域变化,可以监听[事件](../apis-basic-services-kit/common_event/commonEventManager-definitions.md#common_event_locale_changed)OHOS::EventFwk::CommonEventSupport::COMMON_EVENT_LOCALE_CHANGED。 134 135**系统接口**:此接口为系统接口。 136 137**需要权限**:ohos.permission.UPDATE_CONFIGURATION 138 139**系统能力**:SystemCapability.Global.I18n 140 141**参数:** 142 143| 参数名 | 类型 | 必填 | 说明 | 144| ------ | ------ | ---- | --------------- | 145| locale | string | 是 | [表示区域ID的字符串](../../internationalization/i18n-locale-culture.md#实现原理),由语言、脚本、国家或地区组成。 | 146 147**错误码:** 148 149以下错误码的详细介绍请参见[ohos.i18n错误码](errorcode-i18n.md)和[通用错误码](../errorcode-universal.md)。 150 151| 错误码ID | 错误信息 | 152| ------ | ---------------------- | 153| 201 | Permission verification failed. The application does not have the permission required to call the API. | 154| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. | 155| 890001 | Invalid parameter. Possible causes: Parameter verification failed. | 156 157**示例:** 158 ```ts 159 import { BusinessError } from '@kit.BasicServicesKit'; 160 161 try { 162 i18n.System.setSystemLocale('zh-CN'); // 设置系统当前区域ID为 "zh-CN" 163 } catch(error) { 164 let err: BusinessError = error as BusinessError; 165 console.error(`call System.setSystemLocale failed, error code: ${err.code}, message: ${err.message}.`); 166 } 167 ``` 168 169 170### set24HourClock<sup>9+</sup> 171 172static set24HourClock(option: boolean): void 173 174设置系统时间为24小时。 175 176**系统接口**:此接口为系统接口。 177 178**需要权限**:ohos.permission.UPDATE_CONFIGURATION 179 180**系统能力**:SystemCapability.Global.I18n 181 182**参数:** 183 184| 参数名 | 类型 | 必填 | 说明 | 185| ------ | ------- | ---- | ---------------------------------------- | 186| option | boolean | 是 | true表示开启系统24小时制开关,false表示关闭系统24小时开关。 | 187 188**错误码:** 189 190以下错误码的详细介绍请参见[ohos.i18n错误码](errorcode-i18n.md)和[通用错误码](../errorcode-universal.md)。 191 192| 错误码ID | 错误信息 | 193| ------ | ---------------------- | 194| 201 | Permission verification failed. The application does not have the permission required to call the API. | 195| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. | 196| 890001 | Invalid parameter. Possible causes: Parameter verification failed. | 197 198**示例:** 199 ```ts 200 import { BusinessError } from '@kit.BasicServicesKit'; 201 202 // 将系统时间设置为24小时制 203 try { 204 i18n.System.set24HourClock(true); 205 } catch(error) { 206 let err: BusinessError = error as BusinessError; 207 console.error(`call System.set24HourClock failed, error code: ${err.code}, message: ${err.message}.`); 208 } 209 ``` 210 211### addPreferredLanguage<sup>9+</sup> 212 213static addPreferredLanguage(language: string, index?: number): void 214 215在系统偏好语言列表中的指定位置添加偏好语言。 216 217**系统接口**:此接口为系统接口。 218 219**需要权限**:ohos.permission.UPDATE_CONFIGURATION 220 221**系统能力**:SystemCapability.Global.I18n 222 223**参数:** 224 225| 参数名 | 类型 | 必填 | 说明 | 226| -------- | ------ | ---- | ---------- | 227| language | string | 是 | 待添加的偏好语言,要求是合法的语言ID。 | 228| index | number | 否 | 偏好语言的添加位置。默认值:系统偏好语言列表长度。 | 229 230**错误码:** 231 232以下错误码的详细介绍请参见[ohos.i18n错误码](errorcode-i18n.md)和[通用错误码](../errorcode-universal.md)。 233 234| 错误码ID | 错误信息 | 235| ------ | ---------------------- | 236| 201 | Permission verification failed. The application does not have the permission required to call the API. | 237| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. | 238| 890001 | Invalid parameter. Possible causes: Parameter verification failed. | 239 240**示例:** 241 ```ts 242 import { BusinessError } from '@kit.BasicServicesKit'; 243 244 // 将语言zh-CN添加到系统偏好语言列表中 245 let language = 'zh-CN'; 246 let index = 0; 247 try { 248 i18n.System.addPreferredLanguage(language, index); // 将zh-CN添加到系统偏好语言列表的第1位 249 } catch(error) { 250 let err: BusinessError = error as BusinessError; 251 console.error(`call System.addPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); 252 } 253 ``` 254 255### removePreferredLanguage<sup>9+</sup> 256 257static removePreferredLanguage(index: number): void 258 259删除系统偏好语言列表中指定位置的偏好语言。 260 261**系统接口**:此接口为系统接口。 262 263**需要权限**:ohos.permission.UPDATE_CONFIGURATION 264 265**系统能力**:SystemCapability.Global.I18n 266 267**参数:** 268 269| 参数名 | 类型 | 必填 | 说明 | 270| ----- | ------ | ---- | --------------------- | 271| index | number | 是 | 待删除偏好语言在系统偏好语言列表中的位置。 | 272 273**错误码:** 274 275以下错误码的详细介绍请参见[ohos.i18n错误码](errorcode-i18n.md)和[通用错误码](../errorcode-universal.md)。 276 277| 错误码ID | 错误信息 | 278| ------ | ---------------------- | 279| 201 | Permission verification failed. The application does not have the permission required to call the API. | 280| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. | 281| 890001 | Invalid parameter. Possible causes: Parameter verification failed. | 282 283**示例:** 284 ```ts 285 import { BusinessError } from '@kit.BasicServicesKit'; 286 287 // 删除系统偏好语言列表中的第一个偏好语言 288 let index: number = 0; 289 try { 290 i18n.System.removePreferredLanguage(index); 291 } catch(error) { 292 let err: BusinessError = error as BusinessError; 293 console.error(`call System.removePreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); 294 } 295 ``` 296 297### setUsingLocalDigit<sup>9+</sup> 298 299static setUsingLocalDigit(flag: boolean): void 300 301设置系统是否使用本地数字。 302 303**系统接口**:此接口为系统接口。 304 305**需要权限**:ohos.permission.UPDATE_CONFIGURATION 306 307**系统能力**:SystemCapability.Global.I18n 308 309**参数:** 310 311| 参数名 | 类型 | 必填 | 说明 | 312| ---- | ------- | ---- | ------------------------------- | 313| flag | boolean | 是 | true表示打开本地数字开关,false表示关闭本地数字开关。 | 314 315**错误码:** 316 317以下错误码的详细介绍请参见[ohos.i18n错误码](errorcode-i18n.md)和[通用错误码](../errorcode-universal.md)。 318 319| 错误码ID | 错误信息 | 320| ------ | ---------------------- | 321| 201 | Permission verification failed. The application does not have the permission required to call the API. | 322| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. | 323| 890001 | Invalid parameter. Possible causes: Parameter verification failed. | 324 325**示例:** 326 ```ts 327 import { BusinessError } from '@kit.BasicServicesKit'; 328 329 try { 330 i18n.System.setUsingLocalDigit(true); // 打开本地化数字开关 331 } catch(error) { 332 let err: BusinessError = error as BusinessError; 333 console.error(`call System.setUsingLocalDigit failed, error code: ${err.code}, message: ${err.message}.`); 334 } 335 ``` 336 337 338### setTemperatureType<sup>18+</sup> 339 340static setTemperatureType(type: TemperatureType): void 341 342设置用户偏好的温度单位。 343 344**系统接口**:此接口为系统接口。 345 346**需要权限**:ohos.permission.UPDATE_CONFIGURATION 347 348**系统能力**:SystemCapability.Global.I18n 349 350**参数:** 351 352| 参数名 | 类型 | 必填 | 说明 | 353| ---- | ------- | ---- | ------------------------------- | 354| type | [TemperatureType](./js-apis-i18n.md#temperaturetype18) | 是 | 温度单位。 | 355 356**错误码:** 357 358以下错误码的详细介绍请参见[ohos.i18n错误码](errorcode-i18n.md)和[通用错误码](../errorcode-universal.md)。 359 360| 错误码ID | 错误信息 | 361| ------ | ---------------------- | 362| 201 | Permission verification failed. The application does not have the permission required to call the API. | 363| 202 | Permission verification failed. A non-system application calls a system API. | 364| 890001 | Invalid parameter. Possible causes: Parameter verification failed. | 365 366> **说明** 367> 368> 890001的报错信息请以接口的实际报错为准。 369 370**示例:** 371 ```ts 372 import { BusinessError } from '@kit.BasicServicesKit'; 373 374 try { 375 i18n.System.setTemperatureType(i18n.TemperatureType.CELSIUS); // 设置温度单位为摄氏度 376 } catch(error) { 377 let err: BusinessError = error as BusinessError; 378 console.error(`call System.setTemperatureType failed, error code: ${err.code}, message: ${err.message}.`); 379 } 380 ``` 381 382### setFirstDayOfWeek<sup>18+</sup> 383 384static setFirstDayOfWeek(type: WeekDay): void 385 386设置用户偏好的周起始日。 387 388**系统接口**:此接口为系统接口。 389 390**需要权限**:ohos.permission.UPDATE_CONFIGURATION 391 392**系统能力**:SystemCapability.Global.I18n 393 394**参数:** 395 396| 参数名 | 类型 | 必填 | 说明 | 397| ---- | ------- | ---- | ------------------------------- | 398| type | [WeekDay](./js-apis-i18n.md#weekday18) | 是 | 周期起始日。 | 399 400**错误码:** 401 402以下错误码的详细介绍请参见[ohos.i18n错误码](errorcode-i18n.md)和[通用错误码](../errorcode-universal.md)。 403 404| 错误码ID | 错误信息 | 405| ------ | ---------------------- | 406| 201 | Permission verification failed. The application does not have the permission required to call the API. | 407| 202 | Permission verification failed. A non-system application calls a system API. | 408| 890001 | Invalid parameter. Possible causes: Parameter verification failed. | 409 410> **说明** 411> 412> 890001的报错信息请以接口的实际报错为准。 413 414**示例:** 415 ```ts 416 import { BusinessError } from '@kit.BasicServicesKit'; 417 418 try { 419 i18n.System.setFirstDayOfWeek(i18n.WeekDay.MON); // 设置用户偏好的周起始日为周一 420 } catch(error) { 421 let err: BusinessError = error as BusinessError; 422 console.error(`call System.setFirstDayOfWeek failed, error code: ${err.code}, message: ${err.message}.`); 423 } 424 ``` 425 426 427## SystemLocaleManager<sup>10+</sup> 428 429### constructor<sup>10+</sup> 430 431constructor() 432 433创建SystemLocaleManager对象。 434 435**系统接口**:此接口为系统接口。 436 437**系统能力**:SystemCapability.Global.I18n 438 439**示例:** 440 ```ts 441 let systemLocaleManager: i18n.SystemLocaleManager = new i18n.SystemLocaleManager(); 442 ``` 443 444 445### getLanguageInfoArray<sup>10+</sup> 446 447getLanguageInfoArray(languages: Array<string>, options?: SortOptions): Array<LocaleItem> 448 449获取语言排序数组。 450 451**系统接口**:此接口为系统接口。 452 453**系统能力**:SystemCapability.Global.I18n 454 455**参数:** 456 457| 参数名 | 类型 | 必填 | 说明 | 458| --------- | ------------- | ---- | ------------- | 459| languages | Array<string> | 是 | 待排序语言列表,要求是合法的语言ID。| 460| options | [SortOptions](#sortoptions10) | 否 | 语言排序选项。 | 461 462**返回值:** 463 464| 类型 | 说明 | 465| ----------------- | -------------------- | 466| Array<[LocaleItem](#localeitem10)> | 排序后的语言列表信息。 | 467 468**错误码:** 469 470以下错误码的详细介绍请参见[ohos.i18n错误码](errorcode-i18n.md)和[通用错误码](../errorcode-universal.md)。 471 472| 错误码ID | 错误信息 | 473| ------ | ---------------------- | 474| 202 | Permission verification failed. A non-system application calls a system API. | 475| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. | 476| 890001 | Invalid parameter. Possible causes: Parameter verification failed. | 477 478**示例:** 479 ```ts 480 import { BusinessError } from '@kit.BasicServicesKit'; 481 482 // 当系统语言为zh-Hans,系统地区为CN,系统区域为zh-Hans-CN时 483 let systemLocaleManager: i18n.SystemLocaleManager = new i18n.SystemLocaleManager(); 484 let languages: string[] = ["zh-Hans", "en-US", "pt", "ar"]; 485 let sortOptions: i18n.SortOptions = {locale: "zh-Hans-CN", isUseLocalName: true, isSuggestedFirst: true}; 486 try { 487 // 排序后的语言顺序为: [zh-Hans, en-US, pt, ar] 488 let sortedLanguages: Array<i18n.LocaleItem> = systemLocaleManager.getLanguageInfoArray(languages, sortOptions); 489 } catch(error) { 490 let err: BusinessError = error as BusinessError; 491 console.error(`call systemLocaleManager.getLanguageInfoArray failed, error code: ${err.code}, message: ${err.message}.`); 492 } 493 ``` 494 495 496### getRegionInfoArray<sup>10+</sup> 497 498getRegionInfoArray(regions: Array<string>, options?: SortOptions): Array<LocaleItem> 499 500获取国家或地区排序数组。 501 502**系统接口**:此接口为系统接口。 503 504**系统能力**:SystemCapability.Global.I18n 505 506**参数:** 507 508| 参数名 | 类型 | 必填 | 说明 | 509| --------- | ------------- | ---- | ------------- | 510| regions | Array<string> | 是 | 待排序的国家或地区列表,要求是合法的国家或地区ID。| 511| options | [SortOptions](#sortoptions10) | 否 | 国家或地区排序选项。<br>区域ID的默认值为系统当前区域ID,isUseLocalName的默认值为false,isSuggestedFirst的默认值为true。 | 512 513**返回值:** 514 515| 类型 | 说明 | 516| ----------------- | -------------------- | 517| Array<[LocaleItem](#localeitem10)> | 排序后的国家或地区列表信息。 | 518 519**错误码:** 520 521以下错误码的详细介绍请参见[ohos.i18n错误码](errorcode-i18n.md)和[通用错误码](../errorcode-universal.md)。 522 523| 错误码ID | 错误信息 | 524| ------ | ---------------------- | 525| 202 | Permission verification failed. A non-system application calls a system API. | 526| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. | 527| 890001 | Invalid parameter. Possible causes: Parameter verification failed. | 528 529**示例:** 530 ```ts 531 import { BusinessError } from '@kit.BasicServicesKit'; 532 533 // 当系统语言为zh-Hans,系统地区为CN,系统区域为zh-Hans-CN时 534 let systemLocaleManager: i18n.SystemLocaleManager = new i18n.SystemLocaleManager(); 535 let regions: string[] = ["CN", "US", "PT", "EG"]; 536 let sortOptions: i18n.SortOptions = {locale: "zh-Hans-CN", isUseLocalName: false, isSuggestedFirst: true}; 537 try { 538 // 排序后的地区顺序为: [CN, EG, US, PT] 539 let sortedRegions: Array<i18n.LocaleItem> = systemLocaleManager.getRegionInfoArray(regions, sortOptions); 540 } catch(error) { 541 let err: BusinessError = error as BusinessError; 542 console.error(`call systemLocaleManager.getRegionInfoArray failed, error code: ${err.code}, message: ${err.message}.`); 543 } 544 ``` 545 546### getTimeZoneCityItemArray<sup>10+</sup> 547 548static getTimeZoneCityItemArray(): Array<TimeZoneCityItem> 549 550获取时区城市组合信息的数组。 551 552**系统接口**:此接口为系统接口。 553 554**系统能力**:SystemCapability.Global.I18n 555 556**返回值:** 557 558| 类型 | 说明 | 559| ----------------- | -------------------- | 560| Array<[TimeZoneCityItem](#timezonecityitem10)> | 排序后的时区城市组合信息数组。 | 561 562**错误码:** 563 564以下错误码的详细介绍请参见[ohos.i18n错误码](errorcode-i18n.md)和[通用错误码](../errorcode-universal.md)。 565 566| 错误码ID | 错误信息 | 567| ------ | ---------------------- | 568| 202 | Permission verification failed. A non-system application calls a system API. | 569 570**示例:** 571 ```ts 572 import { BusinessError } from '@kit.BasicServicesKit'; 573 574 try { 575 let timeZoneCityItemArray: Array<i18n.TimeZoneCityItem> = i18n.SystemLocaleManager.getTimeZoneCityItemArray(); 576 for (let i = 0; i < timeZoneCityItemArray.length; i++) { 577 console.log(timeZoneCityItemArray[i].zoneId + ", " + timeZoneCityItemArray[i].cityId + ", " + timeZoneCityItemArray[i].cityDisplayName + 578 ", " + timeZoneCityItemArray[i].offset + "\r\n"); 579 } 580 } catch(error) { 581 let err: BusinessError = error as BusinessError; 582 console.error(`call SystemLocaleManager.getTimeZoneCityItemArray failed, error code: ${err.code}, message: ${err.message}.`); 583 } 584 ``` 585 586## LocaleItem<sup>10+</sup> 587 588SystemLocaleManager对语言或国家地区列表的排序结果信息项。 589 590**系统接口**:此接口为系统接口。 591 592**系统能力**:SystemCapability.Global.I18n 593 594| 名称 | 类型 | 必填 | 说明 | 595| --------------- | --------------- | ------ | --------------------------------------- | 596| id | string | 是 | 语言代码或国家地区代码,如"zh"、"CN"。 | 597| suggestionType | [SuggestionType](#suggestiontype10) | 是 | 语言或国家地区推荐类型。 | 598| displayName | string | 是 | id在SystemLocaleManager的指定区域下的表示。| 599| localName | string | 否 | id的本地名称。 | 600 601## TimeZoneCityItem<sup>10+</sup> 602 603时区城市组合信息。 604 605**系统接口**:此接口为系统接口。 606 607**系统能力**:SystemCapability.Global.I18n 608 609| 名称 | 类型 | 必填 | 说明 | 610| --------------- | --------------- | ------ | --------------------------------------- | 611| zoneId | string | 是 | 时区ID,例如Asia/Shanghai。 | 612| cityId | string | 是 | 城市ID,例如Shanghai。 | 613| cityDisplayName | string | 是 | 城市ID在系统区域下显示的名称。 | 614| offset | int | 是 | 时区ID的偏移量。 | 615| zoneDisplayName | string | 是 | 时区ID在系统区域下显示的名称。 | 616| rawOffset | int | 否 | 时区ID的固定偏移量。 | 617 618 619## SuggestionType<sup>10+</sup> 620 621语言或国家地区的推荐类型。 622 623**系统接口**:此接口为系统接口。 624 625**系统能力**:SystemCapability.Global.I18n 626 627| 名称 | 值 | 说明 | 628| ---------------------- | ---- | ---- | 629| SUGGESTION_TYPE_NONE | 0x00 | 非推荐语言或国家地区。 | 630| SUGGESTION_TYPE_RELATED| 0x01 | 系统语言推荐的国家地区或系统国家地区推荐的语言。 | 631| SUGGESTION_TYPE_SIM | 0x02 | Sim卡国家地区推荐的语言。 | 632 633 634## SortOptions<sup>10+<sup> 635 636语言或国家地区排序选项。 637 638**系统接口**:此接口为系统接口。 639 640**系统能力**:SystemCapability.Global.I18n 641 642| 名称 | 类型 | 必填 | 说明 | 643| --------------- | --------------- | ---- | --------------------------------------- | 644| locale | string | 否 | [表示区域ID的字符串](../../internationalization/i18n-locale-culture.md#实现原理),由语言、脚本、国家或地区组成,如"zh-Hans-CN"。<br>默认值:系统当前区域ID。 | 645| isUseLocalName | boolean | 否 | true表示使用本地名称进行排序,false表示不使用本地名称进行排序。<br>若调用方法为getLanguageInfoArray,isUseLocalName属性默认值为true。<br>若调用方法为getRegionInfoArray,isUseLocalName属性默认值为false。 | 646| isSuggestedFirst | boolean | 否 | true表示将推荐语言或国家地区在排序结果中置顶,false表示不将推荐语言或国家地区在排序结果中置顶。<br>isSuggestedFirst属性默认值为true。 | 647