[cleanup]revise file location and so on
[apps/native/ug-wifi-efl.git] / common / i18nmanager.c
1 /*
2  * Wi-Fi
3  *
4  * Copyright 2012 Samsung Electronics Co., Ltd
5  *
6  * Licensed under the Flora License, Version 1.1 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.tizenopensource.org/license
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #include "i18nmanager.h"
21 #include <libintl.h>
22 #include <stdio.h>
23 #include <string.h>
24
25 static char* apply_i18n(const char *pkg_name, I18N_MODES mode, const char *string)
26 {
27         switch (mode) {
28         case I18N_MODE_SELF_MADE:
29                 return (char*) dgettext(pkg_name, string);
30         case I18N_MODE_NO_NEEDED:
31                 return (char*) gettext(string);
32         default:
33                 return "(debug)applying_i18n_failed";
34         }
35 }
36
37 char* i18n_manager_get_text(const char *pkg_name, I18N_TYPES type)
38 {
39         switch (type) {
40         case I18N_TYPE_Ok:
41                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_SK2_OK");
42         case I18N_TYPE_Find:
43                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_COM_BODY_FIND");
44         case I18N_TYPE_Cancel:
45                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_SK_CANCEL");
46         case I18N_TYPE_Wi_Fi:
47                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_WI_FI");
48         case I18N_TYPE_Name:
49                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_NAME");
50         case I18N_TYPE_Unknown:
51                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_UNKNOWN");
52         case I18N_TYPE_Scan:
53                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BUTTON_SCAN");
54         case I18N_TYPE_Next:
55                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_STU_BUTTON_NEXT");
56         case I18N_TYPE_Prev:
57                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_STU_BUTTON_PREVIOUS");
58         case I18N_TYPE_On:
59                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_OPT_MOBILEACCESSSERVICEATCIVATION_ON");
60         case I18N_TYPE_Off:
61                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_OPT_MOBILEACCESSSERVICEATCIVATION_OFF");
62         case I18N_TYPE_Maximum_Number_Of_Characters_PD_Reached:
63                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_TPOP_MAXIMUM_NUMBER_OF_CHARACTERS_PD_REACHED");
64         case I18N_TYPE_Connected_To_Wi_Fi_Network:
65                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_TPOP_CONNECTED_TO_WI_FI_NETWORK_PS");
66         case I18N_TYPE_Wrong_Password:
67                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_POP_WRONG_PASSWORD");
68         case I18N_TYPE_No_Wi_Fi_AP_Found:
69                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_POP_NO_WI_FI_AP_FOUND");
70         case I18N_TYPE_Available_networks:
71                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_HEADER_AVAILABLE_NETWORKS");
72         case I18N_TYPE_Open:
73                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_POP_OPEN");
74         case I18N_TYPE_Secured:
75                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_SECURED_ABB_M_WIFI_AP_SUMMARY");
76         case I18N_TYPE_WPS_Available:
77                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_WPS_AVAILABLE");
78         case I18N_TYPE_EAP:
79                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_EAP");
80         case I18N_TYPE_Saved:
81                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_CONFIGURATION_SAVED_M_STATUS");
82         case I18N_TYPE_Connecting:
83                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_CONNECTING_ING");
84         case I18N_TYPE_Obtaining_IP_addr:
85                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_OBTAINING_IP_ADDRESS_ING");
86         case I18N_TYPE_Connected:
87                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_SBODY_CONNECTED_M_STATUS");
88         case I18N_TYPE_Find_Hidden_Network:
89                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BUTTON_FIND_HIDDEN_NETWORK");
90         case I18N_TYPE_Password:
91                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_HEADER_PASSWORD");
92         case I18N_TYPE_Show_password:
93                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_OPT_SHOW_PASSWORD");
94         case I18N_TYPE_Wi_Fi_network_info:
95                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_HEADER_WI_FI_NETWORK_INFO_ABB");
96         case I18N_TYPE_Connect:
97                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_CONNECT");
98         case I18N_TYPE_WPS:
99                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_OPT_WPS");
100         case I18N_TYPE_WPS_Button:
101                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BUTTON_WPS_BUTTON");
102         case I18N_TYPE_WPS_PIN:
103                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_SK_WPS_PIN");
104         case I18N_TYPE_Press_WPS_On_Your_Wi_Fi_Access_Point:
105                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_POP_PRESS_WPS_ON_YOUR_WI_FI_ACCESS_POINT_WITHIN_PD_MINUTES");
106         case I18N_TYPE_Enter_PIN_number_on_your_WIFI_access_point:
107                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_ENTER_THE_P1SS_PIN_ON_YOUR_WI_FI_ROUTER_THE_SETUP_CAN_TAKE_UP_TO_P2SD_MINUTES_TO_COMPLETE");
108         case I18N_TYPE_Static_IP:
109                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_STATIC_IP");
110         case I18N_TYPE_IP_address:
111                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_IP_ADDRESS");
112         case I18N_TYPE_MAC_addr:
113                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_MAC_ADDRESS");
114         case I18N_TYPE_Proxy_address:
115                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_SBODY_PROXY_ADDRESS");
116         case I18N_TYPE_Proxy_port:
117                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_SBODY_PROXY_PORT");
118         case I18N_TYPE_Subnet_mask:
119                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_SUBNET_MASK");
120         case I18N_TYPE_Gateway_address:
121                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_GATEWAY_ADDRESS");
122         case I18N_TYPE_DNS_1:
123                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_DNS_1");
124         case I18N_TYPE_DNS_2:
125                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_DNS_2");
126         case I18N_TYPE_Forget:
127                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_SK_FORGET");
128         case I18N_TYPE_Forget_Network:
129                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_OPT_FORGET_NETWORK");
130         case I18N_TYPE_EAP_method:
131                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_EAP_METHOD");
132         case I18N_TYPE_Phase_2_authentication:
133                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_COM_BODY_PHASE_2_AUTHENTICATION");
134         case I18N_TYPE_User_Certificate:
135                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_USER_CERTIFICATE_ABB");
136         case I18N_TYPE_Unspecified:
137                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_UNSPECIFIED");
138         case I18N_TYPE_Identity:
139                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_IDENTITY");
140         case I18N_TYPE_Enter_Identity:
141                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_ENTER_IDENTITY");
142         case I18N_TYPE_Enter_password:
143                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_HEADER_ENTER_PASSWORD");
144         case I18N_TYPE_Ssid:
145                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_NETWORK_SSID");
146         case I18N_TYPE_A_Wi_Fi_Network_Has_Been_Detected:
147                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_A_WI_FI_NETWORK_HAS_BEEN_DETECTED_YOU_WILL_BE_CONNECTED");
148         case I18N_TYPE_Advanced_setting:
149                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_ADVANCED_SETTINGS");
150         case I18N_TYPE_Network_notification:
151                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_NETWORK_NOTIFICATION");
152         case I18N_TYPE_Network_notify_me_later:
153                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_RECEIVE_NOTIFICATIONS_WHEN_NETWORKS_ARE_AVAILABLE");
154         case I18N_TYPE_Keep_WIFI_on_during_sleep:
155                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_KEEP_WI_FI_ON_DURING_SLEEP");
156         case I18N_TYPE_Always:
157                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_CLD_OPT_ALWAYS_ABB");
158         case I18N_TYPE_Plugged:
159                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_WHILE_CHARGING_ONLY_ABB");
160         case I18N_TYPE_Donot_Use:
161                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_TMBODY_NEVER_M_ALWAYS_OFF");
162         case I18N_TYPE_Increases_Data_Usage:
163                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_SBODY_INCREASES_DATA_USAGE_ABB");
164         case I18N_TYPE_Sort_by:
165                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_SORT_BY");
166         case I18N_TYPE_Alphabetical:
167                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_EMAIL_POP_ALPHABETICAL");
168         case I18N_TYPE_Signal_Strength:
169                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_MBODY_SIGNAL_STRENGTH_KOR_SKT");
170         case I18N_TYPE_Advanced:
171                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_ADVANCED");
172         case I18N_TYPE_Current_Network_Will_Be_Disconnected:
173                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_POP_CURRENT_NETWORK_WILL_BE_DISCONNECTED");
174         case I18N_TYPE_Select_WPS_Method:
175                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_HEADER_SELECT_WPS_METHOD_ABB");
176
177         case I18N_TYPE_Invalid_pin:
178                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_GC_POP_INVALID_PIN");
179         case I18N_TYPE_Invalid_certificate:
180                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_BR_POP_INVALID_CERTIFICATE");
181         case I18N_TYPE_Skip:
182                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_OPT_SKIP");
183         case I18N_TYPE_WiFi_network_detected_connect:
184                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_A_WI_FI_NETWORK_HAS_BEEN_DETECTED_YOU_WILL_BE_CONNECTED");
185         case I18N_TYPE_WIFI_AUTHENTICATION_ERROR_OCCURRED:
186                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_SBODY_AUTHENTICATION_ERROR_OCCURRED_M_STATUS");
187         case I18N_TYPE_WIFI_FAILED_TO_OBTAIN_IP_ADDRESS:
188                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_TPOP_FAILED_TO_OBTAIN_IP_ADDRESS");
189
190                 /* TTS */
191         case I18N_TYPE_Button:
192                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_BR_BODY_BUTTON_T_TTS");
193         case I18N_TYPE_Double_tap:
194                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_HEADER_DOUBLE_TAP");
195         case I18N_TYPE_Connect_to_device:
196                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_BT_BODY_CONNECT_TO_DEVICE");
197         case I18N_TYPE_Excellent:
198                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_EXCELLENT");
199         case I18N_TYPE_Good:
200                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_GOOD_M_BATTERY");
201         case I18N_TYPE_Weak:
202                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_WEAK_M_STRENGTH");
203         case I18N_TYPE_Activating:
204                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_TURNING_ON_ING");
205         case I18N_TYPE_WiFi_network_will_disable_tethering:
206                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_POP_TURNING_ON_WI_FI_WILL_DISABLE_WI_FI_TETHERING");
207         case I18N_TYPE_Scanning:
208                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_SCANNING_ING");
209
210
211         case I18N_TYPE_Help_tap_the_network_to_connect:
212                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_HELP_BODY_TAP_THE_NETWORK_YOU_WANT_TO_CONNECT_TO");
213         case I18N_TYPE_Help_automatically_connected:
214                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_HELP_BODY_YOU_HAVE_BEEN_AUTOMATICALLY_CONNECTED_TO_THE_REMEMBERED_NETWORK_TO_SEE_THE_NETWORK_DETAILS_TAP_THE_PS_ICON");
215         case I18N_TYPE_Help_successfully_connected:
216                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_HELP_BODY_YOU_HAVE_BEEN_CONNECTED_TO_THE_NETWORK_TO_SEE_THE_NETWORK_DETAILS_TAP_THE_PS_ICON");
217         case I18N_TYPE_Help_connect_to_secured_network:
218                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_HELP_POP_TO_CONNECT_TO_A_SECURED_NETWORK_YOU_MAY_NEED_TO_ENTER_A_PASSWORD_OR_OTHER_CREDENTIALS");
219         case I18N_TYPE_Help_tap_to_scan:
220                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_HELP_POP_TAP_TO_SCAN_FOR_WI_FI_NETWORKS");
221         case I18N_TYPE_Help_no_wifi_networks:
222                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_HELP_POP_NO_WI_FI_NETWORKS_FOUND_CHANGE_YOUR_LOCATION_OR_TRY_LATER");
223         case I18N_TYPE_Help_invalid_action:
224                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_HELP_POP_INVALID_ACTION_TRY_AGAIN");
225         case I18N_TYPE_WiFi_direct:
226                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_WI_FI_DIRECT_ABB");
227         case I18N_TYPE_Automatically_switch:
228                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_SBODY_AUTOMATICALLY_SWITCH_BETWEEN_WI_FI_AND_MOBILE_NETWORKS_TO_MAINTAIN_A_STABLE_INTERNET_CONNECTION");
229         case I18N_TYPE_Do_not_show_again:
230                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_MOBILEAP_POP_DO_NOT_SHOW_AGAIN");
231         case I18N_TYPE_None:
232                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_NONE");
233         case I18N_TYPE_Install_certificate:
234                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BODY_INSTALL_CERTIFICATE");
235         case I18N_TYPE_SIM_method_desc_popup:
236                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_POP_SELECT_SIM_CARD_OR_AKA_OPTION_ON_EAP_METHOD_GUIDE_MSG");
237         case I18N_TYPE_Turn_on_wifi_to_view_available_networks:
238                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_TURN_ON_WI_FI_TO_VIEW_A_LIST_OF_AVAILABLE_NETWORKS");
239
240         case I18N_TYPE_Security:
241                 return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BUTTON_SECURITY_ABB");
242
243         default:
244                 return apply_i18n(pkg_name, I18N_MODE_NO_NEEDED, "(debugapplying_i18n_failed");
245         }
246 }