Time Zone Name Localization
Use Cases
In a multi-language environment, time zones may be addressed by users in different regions in different ways. Therefore, your application needs to localize time zone names to adapt to local user habits.
How to Develop
For details about how to use related APIs, see getDisplayName.
-
Import the i18n module.
import { i18n } from '@kit.LocalizationKit'; -
Localize the time zone name, for example, America/Sao_Paulo.
let timezone = i18n.getTimeZone("America/Sao_Paulo"); let timeZoneName = timezone.getDisplayName("zh-Hans", true); // Brasilia Standard Time