global_cangjie_wrapper(beta feature)
Introduction
If OpenHarmony systems or applications need to be used globally, they must meet the requirements of users in different regions on languages and cultures. The Globalization subsystem provides the multi-language and multi-cultural capabilities for global use, including:
-
Resource management
The module loads, parses, and initializes system and application resources based on device types and system configurations, and provides APIs for obtaining resources such as character strings and media files.
-
Internationalization (i18n)
The subsystem provides the bottom-layer resource backtracking capabilities, with a wide array of i18n APIs for implementing functions such as calendar.
The currently open Ability Cangjie api only supports standard devices.
Architecture
Figure 1 Architecture of Cangjie Global

As shown in the architecture:
Interface:
- Calendar: Provides the capability to obtain and set calendar properties, such as time, time zone, etc.
- ResourceManager: Provides the capability for application resource acquisition.
- System: Provides the capability to obtain the application's preferred language.
Framework:
-
Calendar wrapper: Implementation encapsulation of Cangjie Calendar, providing Calendar capabilities.
-
ResourceManager wrapper: Implementation encapsulation of Cangjie ResourceManager, providing ResourceManager capabilities.
-
System wrapper: Provides Implementation encapsulation of Cangjie System, providing System capabilities.
-
Explanation of Dependencies in the Architecture Diagram:
-
i18n: Responsible for providing basic internationalization functions, and encapsulates C Language interfaces for Cangjie to conduct interoperation.
-
Resmgr: Responsible for providing basic resource management functions, and encapsulates C Language interfaces for Cangjie to conduct interoperation.
-
cangjie_ark_interop: Responsible for providing Cangjie APILevel class definitions, which are used to annotate APIs, as well as providing the definition of BusinessException class that is thrown to users.
-
JS UI Framework: responsible for providing FFI interfaces related to Resource, which are used to operate application resources.
-
arkui_cangjie_wrapper: Responsible for providing interface definitions such as ResourceColor, which are used to implement the AppResource class.
-
hiviewdfx_cangjie_wrapper: Responsible for providing logging interfaces, which are used to print logs at key points in the execution path.
Directory Structure
base/global/global_cangjie_wrapper
├── figures # architecture pictures
├── kit # Cangjie LocalizationKit kit code
│ └── LocalizationKit
├── ohos # Cangjie Global code
│ ├── BUILD.gn
│ ├── i18n
│ │ ├── calendar.cj # The interface for Calendar
│ │ └── system.cj # The interface for system configuration
│ └── resource_manager # The interface for ResourceManager
└── test # Cangjie Global test cases
├── i18n # i18n test cases
└── resource_manager # resource_manager test cases
Usage Guidelines
The following features are provided:
- Calendar provides the capability to obtain and set calendar properties, such as time, time zone, etc.
- ResourceManager provides the capability for application resource acquisition.
- System provides the capability to obtain the application's preferred language.
For Global-related APIs, please refer to
For relevant guidance, please refer to Internationalization Development Guide and ResourceManager Development Guide
Constraints
The following features are not provided yet:
- Date formatting, number formatting, and sorting.
- Functions such as region management, phone number processing, text processing, time zone and holiday management.
- Cross-thread transmission of resource objects.
Code Contribution
Developers are welcome to contribute code, documentation, etc. For specific contribution processes and methods, please refer to Code Contribution.