npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@expo-harmony/expo-localization

v55.0.19-harmony.2

Published

HarmonyOS port of expo-localization

Readme

@expo-harmony/expo-localization

GitHub 仓库 | 官方文档

为 HarmonyOS 上的 React Native 应用提供 Expo Localization 的原生实现,与官方同版本的 expo-localization 配套使用。支持读取系统的偏好语言、地区、货币、日历、时区和时间格式,并在这些设置变化时更新。

安装

npm install @expo-harmony/expo-localization [email protected]

本包适配 Expo SDK 55 的 expo-localization,原生模块通过 Expo Harmony 自动链接。最低支持 HarmonyOS 5.0.1(API 13),宿主的 compatibleSdkVersion 也要满足这一要求。

官方插件的 supportedLocales、supportsRTL、forcesRTL 和 allowDynamicLocaleChangesAndroid 不作用于 HarmonyOS。应用语言资源使用 HarmonyOS 资源目录,布局方向由 React Native 的 I18nManager 管理。

业务代码从官方包导入:

import { getLocales, getCalendars, useLocales, useCalendars } from 'expo-localization';

const locales = getLocales();
const calendars = getCalendars();

API 对照表

Hooks

useLocales()

返回 Locale[],至少一项。系统语言或地区变化后重新读取,应用回到前台时也会重新读取。

useCalendars()

返回 Calendar[],至少一项。系统时间、时间格式或时区变化后重新读取,应用回到前台时也会重新读取。

Methods

Localization.getLocales()

返回 Locale[],同步读取,至少一项。列表按系统偏好语言的顺序排列,每一项给出该语言自身的语言标签和货币,地区、数字格式与计量制取系统地区设置。不带地区的偏好语言使用系统地区补全,例如系统地区为 CN 时,zh-Hans 返回 zh-Hans-CN,en-CA 这类已经指定地区的语言保持原地区。偏好列表为空或没有可解析的语言时,回退到系统语言和地区。

系统地区没有配置时,regionCode、currencyCode、currencySymbol 和 measurementSystem 为 null。measurementSystem 在地区为 GB 时取 'uk',为 US、LR、MM 时取 'us',其余取 'metric'。temperatureUnit 在 API 18 及以上读系统的温度单位偏好,系统取 Kelvin 时返回 null;更早的系统按地区推断,地区没有配置时为 null,以华氏为默认单位时返回 'fahrenheit',否则返回 'celsius'。数字分隔符、货币代码和货币符号来自系统 ICU,不同系统版本的数据可能不同。

Localization.getCalendars()

返回 Calendar[],同步读取,恒为一项。历法标识取系统 ICU 的历法类型,时区取系统时区,24 小时制取系统偏好。每周起始日在 API 18 及以上取系统偏好,更早的系统按语言数据推断。

Types

Calendar

| 属性 | 类型 | 说明 | | ----------------- | ---------------- | -------------------------------- | | calendar | string \| null | Unicode 历法类型,如 'gregory' | | firstWeekday | number | 每周起始日,周日为 1,周六为 7 | | timeZone | string \| null | 系统时区标识 | | uses24hourClock | boolean | 系统是否使用 24 小时制 |

Locale

| 属性 | 类型 | 说明 | | ------------------------ | ----------------------------------- | ----------------------------------- | | languageTag | string | 语言标签,带地区,如 'zh-Hans-CN' | | languageCode | string \| null | 语言代码,不含地区,如 'zh' | | languageScriptCode | string \| null | 文字代码,如 'Hans' | | languageRegionCode | string \| null | 该语言自身的地区代码,缺省时使用系统地区 | | regionCode | string \| null | 系统地区设置中的地区代码 | | textDirection | 'ltr' \| 'rtl' | 文字方向 | | decimalSeparator | string \| null | 小数分隔符 | | digitGroupingSeparator | string \| null | 数字分组分隔符 | | measurementSystem | 'metric' \| 'us' \| 'uk' \| null | 计量制 | | currencyCode | string \| null | 系统地区的货币代码 | | currencySymbol | string \| null | 系统地区的货币符号 | | languageCurrencyCode | string \| null | 该语言地区的货币代码 | | languageCurrencySymbol | string \| null | 该语言地区的货币符号 | | temperatureUnit | 'celsius' \| 'fahrenheit' \| null | 温度单位 |

Enums

CalendarIdentifier

Unicode 历法类型,取值由系统 ICU 提供。公历可以写作 GREGORIAN 或 GREGORY。

Weekday

SUNDAY = 1、MONDAY = 2、TUESDAY = 3、WEDNESDAY = 4、THURSDAY = 5、FRIDAY = 6、SATURDAY = 7。

Author

expo-harmony © Baoshuo, Released under the MIT License. Authored and maintained by Baoshuo with help from contributors

Personal Website · Blog · GitHub @renbaoshuo · Twitter @renbaoshuo