• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef HI_GV_LAN_H
17 #define HI_GV_LAN_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 /* language country abbreviation */
24 /* *he format of language is <language>_<territory>. The <language> should satisfy iso639-2 and <territory> should
25  * satisfy iso3166-1
26 */
27 #define LAN_CN    "cn"
28 #define LAN_ZH    "zh"
29 #define LAN_ZH_CN "zh_CN"
30 #define LAN_ZH_TW "zh_TW"
31 #define LAN_ZH_HK "zh_HK"
32 #define LAN_AR    "ar"
33 #define LAN_CS    "cs"
34 #define LAN_DA    "da"
35 #define LAN_DE    "de"
36 #define LAN_DE_AT "de_AT"
37 #define LAN_DE_CH "de_CH"
38 #define LAN_EL    "el"
39 #define LAN_EN    "en"
40 #define LAN_EN_US "en_US"
41 #define LAN_EN_CA "en_CA"
42 #define LAN_EN_GB "en_GB"
43 #define LAN_ES    "es"
44 #define LAN_FA    "fa"
45 #define LAN_FI    "fi"
46 #define LAN_FR    "fr"
47 #define LAN_FR_CA "fr_CA"
48 #define LAN_FR_CH "fr_CH"
49 #define LAN_IT    "it"
50 #define LAN_IT_CH "it_CH"
51 #define LAN_HE    "he"
52 #define LAN_JA    "ja"
53 #define LAN_KO    "ko"
54 #define LAN_KO_KR "ko_KR"
55 #define LAN_NL    "nl"
56 #define LAN_NL_BE "nl_BE"
57 #define LAN_PT    "pt"
58 #define LAN_PT_BR "pt_BR"
59 #define LAN_RU    "ru"
60 #define LAN_SV    "sv"
61 #define LAN_TH    "th"
62 #define LAN_TR    "tr"
63 #define LAN_PO    "po"
64 #define LAN_VN    "vn"
65 #define LAN_HU    "hu"
66 #define LAN_UKR   "ukr"
67 #define LAN_RO    "ro"
68 #define LAN_HR    "hr"
69 #define LAN_SR    "sr"
70 #define LAN_BS    "bs"
71 #define LAN_MK    "mk"
72 #define LAN_BG    "bg"
73 #define LAN_ET    "et"
74 #define LAN_LV    "lv"
75 #define LAN_LT    "lt"
76 #define LAN_IND   "ind"
77 
78 /* Direction of language   **/
79 typedef enum {
80     HI_LAN_DIR_LTR = 0, /* Left to right */
81     HI_LAN_DIR_RTL = 1,  /* Right to left */
82     HI_LAN_DIR_BUTT
83 } HI_LAN_DIR;
84 
85 /*
86  * brief Register the multi-language.
87  * attention:This api should call after the BIN loaded.
88  *
89  * param[in] resFile
90  * param[in] fontHandle
91  * param[in] langId Language ID.
92  * retval ::HI_SUCCESS Success.
93  * retval ::HI_ERR_COMM_INVAL Invalid parameter.
94  * retval ::HI_ERR_COMM_EXIST This language has registered.
95  * retval ::HI_ERR_LANG_INVALID_LOCALE  Locale is not setting.
96  * retval ::HI_ERR_COMM_FULL  the max language is 16 or The total string count is over
97  * 128*1024.
98  *
99  * see: HI_GV_Lan_UnRegister
100 */
101 HI_S32 HI_GV_Lan_Register(const HI_CHAR *resFile, HIGV_HANDLE fontHandle, const HI_CHAR *langId);
102 
103 /*
104  * brief Unregister the language.
105  * param[in] langId Language ID.
106  * retval ::HI_SUCCESS Success.
107  * retval ::HI_ERR_COMM_INVAL Invalid parameter.
108  * etval ::HI_ERR_COMM_PAERM Unsupported operation.
109  * see :HI_GV_Lan_Register
110 */
111 HI_S32 HI_GV_Lan_UnRegister(const HI_CHAR *langId);
112 
113 /*
114  * brief Register the multi-language.
115  * param[in] langId Language ID.
116  * retval ::HI_SUCCESS Success.
117  * retval ::HI_ERR_COMM_INVAL Invalid parameter.
118  * retval ::HI_ERR_COMM_PAERM Unsupported operation.
119 */
120 HI_S32 HI_GV_Lan_SetLocale(const HI_CHAR *locale);
121 
122 /*
123  * brief Register font info of the language.
124  * param[in]  langId  Language ID.
125  * param[in]  fontHandle Font handle.
126  * retval ::HI_SUCCESS Success.
127  * retval ::HI_ERR_LOSTInvalid handle.
128  * retval ::HI_ERR_COMM_INVAL Invalid parameter.
129 */
130 HI_S32 HI_GV_Lan_FontRegister(const HI_CHAR *langId, HIGV_HANDLE fontHandle);
131 
132 /*
133  * brief Change the language.
134  * param[in] langId Language ID.
135  * retval ::HI_SUCCESS Success.
136  * retval ::HI_ERR_COMM_EMPTY Invalid parameter.
137  * see:::HI_GV_Lan_Register
138 */
139 HI_S32 HI_GV_Lan_Change(const HI_CHAR *langId);
140 
141 /*
142  * brief Find current language id.
143  * param[in] langId Language ID.
144  * retval ::HI_SUCCESS Success.
145  * retval ::HI_ERR_COMM_EMPTY The language is not registered.
146  * retval ::HI_ERR_COMM_INVAL Invalid parameter.
147  * see : ::HI_GV_Lan_Register
148 */
149 HI_S32 HI_GV_Lan_GetCurLangID(HI_CHAR **langId);
150 
151 /*
152  * brief Get the text by string id.
153  * param[in]  strID  String ID.
154  * param[in]  langId  Language ID.
155  * param[out] str The pointer of string.
156  * retval ::HI_SUCCESS Success.
157  * retval ::HI_ERR_COMM_LOST Invalid handle.
158  * retval ::HI_ERR_COMM_INVAL Invalid parameter.
159 */
160 HI_S32 HI_GV_Lan_GetLangString(const HI_CHAR *langId, const HI_U32 strId, HI_CHAR **str);
161 
162 /*
163  * brief Get the dirction of the language.
164  * param[in] direction Direction.
165  * param[in] langId   Language ID.
166  * retval ::HI_SUCCESS Success.
167  * see : HI_GV_Lan_Register
168 */
169 HI_S32 HI_GV_Lan_GetLangIDDirection(const HI_CHAR *langId, HI_LAN_DIR *direction);
170 
171 #ifdef __cplusplus
172 }
173 #endif
174 #endif /* HI_GV_LAN_H */
175