Multilanguage support
authorAgnieszka Janowicz <a.janowicz@samsung.com>
Fri, 3 Jul 2015 11:46:14 +0000 (13:46 +0200)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Fri, 10 Jul 2015 14:43:52 +0000 (23:43 +0900)
Change-Id: I4edf08d25f8b40f25acc456ef7df6fd822e2d387
Signed-off-by: Agnieszka Janowicz <a.janowicz@samsung.com>
12 files changed:
CMakeLists.sub
CMakeLists.txt
include/logger.h
include/screen_reader.h
packaging/org.tizen.screen-reader.spec
res/po/CMakeLists.txt [new file with mode: 0644]
res/po/en_US.po [new file with mode: 0644]
src/main.c
src/navigator.c
src/screen_reader_spi.c
src/screen_reader_system.c
src/smart_notification.c

index 7c5d679..eab1e8b 100755 (executable)
@@ -20,7 +20,7 @@ SET(SLP_DEBUG_FLAGS "-g")
 SET(SLP_OPT_FLAGS "-O0")
 
 ## COMPILER FLAGS
-SET(SLP_COMPILER_FLAGS "-Wall -Wunused")
+SET(SLP_COMPILER_FLAGS "-Wall -Wunused -Wno-format -Wno-format-security")
 
 ## LINKER FLAGS
 SET(SLP_LINKER_FLAGS "")
index f7d017c..13155e7 100755 (executable)
@@ -4,9 +4,10 @@ ENABLE_TESTING()
 # FIND ALL SOURCE IN A SOURCE DIRECTORY
 AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/src SRCS)
 
-#INCLUDE FILE 
+#INCLUDE FILE
 INCLUDE(CMakeLists.sub)
 SET(RESOURCE_DIR "${CMAKE_SOURCE_DIR}/res")
+SET(LOCALEDIR "/usr/apps/org.tizen.screen-reader/res/locale")
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(pkgs REQUIRED
@@ -48,6 +49,7 @@ INSTALL(DIRECTORY ${RESOURCE_DIR}/icons DESTINATION res)
 # Install Manifest File
 INSTALL(FILES org.tizen.screen-reader.xml DESTINATION /opt/share/packages)
 
+ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/res/po)
 ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/tests)
 ADD_TEST(NAME smart_navi_tests COMMAND ${CMAKE_SOURCE_DIR}/tests/smart_navi_test_suite)
 # END OF A FILE
index 4f69c89..a4af526 100644 (file)
@@ -2,6 +2,7 @@
 #define LOGGER_H_
 
 #include <Eina.h>
+#include <Elementary.h>
 
 extern int _eina_log_dom;
 
index 76396ea..6681fba 100644 (file)
@@ -7,11 +7,6 @@
 
 #define LANGUAGE_NAME_SIZE 6
 
-#define MAX_REACHED ", maximum value reached"
-#define MIN_REACHED ", minimum value reached"
-#define MAX_POS_REACHED ", end of text reached"
-#define MIN_POS_REACHED ", begin of text reached"
-
 #define HIGHLIGHT_CHANGED_SIG "object:state-change:highlighted"
 #define VALUE_CHANGED_SIG "object:property-change:accessible-value"
 #define CARET_MOVED_SIG "object:text-caret-moved"
index 8c024c7..2425572 100755 (executable)
@@ -23,6 +23,7 @@ BuildRequires:  pkgconfig(capi-system-device)
 BuildRequires:  tts
 BuildRequires:  tts-devel
 BuildRequires:  vconf
+BuildRequires:  gettext-tools
 BuildRequires:  pkgconfig(check)
 BuildRequires:  pkgconfig(capi-network-bluetooth)
 BuildRequires:  pkgconfig(tapi)
@@ -57,4 +58,5 @@ rm -rf %{buildroot}
 %manifest org.tizen.screen-reader.manifest
 %{AppInstallPath}/bin/screen-reader
 %{AppInstallPath}/res/icons/screen-reader.png
+%{AppInstallPath}/res/locale/*/LC_MESSAGES/*
 /opt/share/packages/%{name}.xml
diff --git a/res/po/CMakeLists.txt b/res/po/CMakeLists.txt
new file mode 100644 (file)
index 0000000..cb79e62
--- /dev/null
@@ -0,0 +1,21 @@
+SET(POFILES en_US.po)
+SET(MSGFMT "/usr/bin/msgfmt")
+
+MESSAGE(STATUS "po files ---")
+FOREACH(pofile ${POFILES})
+       SET(pofile ${CMAKE_CURRENT_SOURCE_DIR}/${pofile})
+       MESSAGE(PO: "  ${pofile}")
+       GET_FILENAME_COMPONENT(absPofile ${pofile} ABSOLUTE)
+       GET_FILENAME_COMPONENT(lang ${absPofile} NAME_WE)
+       SET(moFile ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo)
+       ADD_CUSTOM_COMMAND(
+                       OUTPUT ${moFile}
+                       COMMAND ${MSGFMT} -o ${moFile} ${absPofile}
+                       DEPENDS ${absPofile}
+       )
+       INSTALL(FILES ${moFile}
+               DESTINATION ${LOCALEDIR}/${lang}/LC_MESSAGES RENAME ${PROJECT_NAME}.mo)
+       SET(moFiles ${moFiles} ${moFile})
+ENDFOREACH(pofile)
+
+ADD_CUSTOM_TARGET(po ALL DEPENDS ${moFiles})
diff --git a/res/po/en_US.po b/res/po/en_US.po
new file mode 100644 (file)
index 0000000..443c516
--- /dev/null
@@ -0,0 +1,155 @@
+msgid "IDS_REACHED_MAX_VAL"
+msgstr ", maximum value reached"
+
+msgid "IDS_REACHED_MIN_VAL"
+msgstr ", minimum value reached"
+
+msgid "IDS_REACHED_MAX_POS"
+msgstr ", end of text reached"
+
+msgid "IDS_REACHED_MIN_POS"
+msgstr ", begin of text reached"
+
+msgid "IDS_NO_VALUE_INTERFACE"
+msgstr "No value interface present"
+
+msgid "IDS_NO_TEXT_INTERFACE"
+msgstr "No text interface present"
+
+msgid "IDS_REACHED_ITEMS_NOTIFICATION"
+msgstr "Visible items from %1$d to %2$d"
+
+msgid "IDS_TRAIT_PD_HOVERSEL"
+msgstr "Dropdown list. Showing %d items. Double tap to open the menu."
+
+msgid "IDS_TRAIT_GROUP_INDEX"
+msgstr "group index"
+
+msgid "IDS_TRAIT_GROUP_INDEX_EXPANDED"
+msgstr "Expandable list, Double tap to collapse"
+
+msgid "IDS_TRAIT_GROUP_INDEX_COLLAPSED"
+msgstr "Expandable list, Double tap to expand"
+
+msgid "IDS_TRAIT_MENU_ITEM_TAB_INDEX"
+msgstr "Tab %1$d of %2$d"
+
+msgid "IDS_TRAIT_TEXT_EDIT"
+msgstr "Double tap to edit"
+
+msgid "IDS_TRAIT_TEXT_EDIT_FOCUSED"
+msgstr "Editing, flick up and down to adjust position."
+
+msgid "IDS_TEXT_BEGIN"
+msgstr "Cursor is at the begining of text"
+
+msgid "IDS_TEXT_END"
+msgstr "Cursor is at the end of text"
+
+msgid "IDS_SYSTEM_CHARGING"
+msgstr "Battery charger connected"
+
+msgid "IDS_SYSTEM_NOT_CHARGING"
+msgstr "Battery charger disconnected"
+
+msgid "IDS_SYSTEM_SCREEN_ON"
+msgstr "Screen is on"
+
+msgid "IDS_SYSTEM_SCREEN_OFF"
+msgstr "Screen is off"
+
+msgid "IDS_SYSTEM_BATTERY_EMPTY"
+msgstr "Battery level is empty"
+
+msgid "IDS_SYSTEM_BATTERY_LOW"
+msgstr "Battery level is low"
+
+msgid "IDS_SYSTEM_BATTERY_HIGH"
+msgstr "Battery level is high"
+
+msgid "IDS_SYSTEM_BATTERY_FULL"
+msgstr "Battery level is full"
+
+msgid "IDS_SYSTEM_BATTERY_CRITICAL"
+msgstr "Battery level is critical"
+
+msgid "IDS_SYSTEM_BATTERY_INFO_CHARGING"
+msgstr "Charging."
+
+msgid "IDS_SYSTEM_BATTERY_INFO_BATTERY_STR"
+msgstr "Battery"
+
+msgid "IDS_SYSTEM_BATTERY_FULLY_CHARGED_STR"
+msgstr "Fully charged"
+
+msgid "IDS_SYSTEM_SIGNAL_STRENGTH"
+msgstr "Signal strength equals:"
+
+msgid "IDS_SYSTEM_SIGNAL_SIMCARD"
+msgstr "Simcard"
+
+msgid "IDS_SYSTEM_NETWORK_SERVICE_LTE"
+msgstr "LTE"
+
+msgid "IDS_SYSTEM_NETWORK_SERVICE_HSDPA"
+msgstr "HSDPA"
+
+msgid "IDS_SYSTEM_NETWORK_SERVICE_3G"
+msgstr "3G"
+
+msgid "IDS_SYSTEM_NETWORK_SERVICE_EDGE"
+msgstr "EDGE"
+
+msgid "IDS_SYSTEM_NETWORK_SERVICE_25G"
+msgstr "2.5G"
+
+msgid "IDS_SYSTEM_NETWORK_SERVICE_2G"
+msgstr "2G"
+
+msgid "IDS_SYSTEM_NETWORK_SERVICE_SEARCHING"
+msgstr "Searching..."
+
+msgid "IDS_SYSTEM_NETWORK_SERVICE_EMERGENCY"
+msgstr "Emergency"
+
+msgid "IDS_SYSTEM_NETWORK_SERVICE_NO_SERVICE"
+msgstr "No service"
+
+msgid "IDS_SYSTEM_NETWORK_SERVICE_UNKNOWN"
+msgstr "Unknown"
+
+msgid "IDS_SYSTEM_NETWORK_TYPE_WIFI"
+msgstr "Wi fi"
+
+msgid "IDS_SYSTEM_WIFI_SIGNAL_GOOD"
+msgstr "Good"
+
+msgid "IDS_SYSTEM_WIFI_SIGNAL_MEDIUM"
+msgstr "Medium"
+
+msgid "IDS_SYSTEM_WIFI_SIGNAL_WEAK"
+msgstr "Weak"
+
+msgid "IDS_SYSTEM_WIFI_SIGNAL_POOR"
+msgstr "Poor"
+
+msgid "IDS_SYSTEM_WIFI_SIGNAL_NO_SIGNAL"
+msgstr "No signal"
+
+msgid "IDS_SYSTEM_NOTIFICATIONS_UNREAD_0"
+msgstr "No event"
+
+msgid "IDS_SYSTEM_NOTIFICATIONS_UNREAD_1"
+msgstr "1 notification unread"
+
+msgid "IDS_SYSTEM_NOTIFICATIONS_UNREAD_MANY"
+msgstr "Notifications unread"
+
+msgid "IDS_SYSTEM_BT_BLUETOOTH_OFF"
+msgstr "Bluetooth off"
+
+msgid "IDS_SYSTEM_BT_NO_DEVICES_CONNECTED"
+msgstr "Nothing connected"
+
+msgid "IDS_SYSTEM_BT_DEVICES_CONNECTED_COUNT"
+msgstr "Devices connected"
index decd757..3a95a6c 100644 (file)
@@ -205,5 +205,5 @@ int main(int argc, char **argv)
    };
    ops.data = get_pointer_to_service_data_struct();
 
-   return appcore_efl_main("Smart Navigation", &argc, &argv, &ops);
+   return appcore_efl_main("screen-reader", &argc, &argv, &ops);
 }
index 2477d52..dc614f0 100644 (file)
 #define TTS_MAX_TEXT_SIZE  2000
 #define GESTURE_LIMIT 10
 
-#define HOVERSEL_TRAIT "Dropdown list. Showing %d items. Double tap to open the menu."
-#define GROUP_INDEX_TRAIT "group index"
-#define MENU_ITEM_TAB_INDEX "Tab %d of %d"
-#define GROUP_INDEX_EXPANDED "Expandable list, Double tap to collapse"
-#define GROUP_INDEX_COLLAPSED "Expandable list, Double tap to expand"
-#define TEXT_EDIT "Double tap to edit"
-#define TEXT_EDIT_FOCUSED "Editing, flick up and down to adjust position."
-#define TEXT_BEGIN "Cursor is at the begining of text"
-#define TEXT_END "Cursor is at the end of text"
-
 #define DEBUG_MODE
 
 #define GERROR_CHECK(error)\
@@ -270,9 +260,9 @@ generate_trait(AtspiAccessible *obj)
          strncat(ret, role_name, sizeof(ret) - strlen(ret) - 1);
          strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1);
          if (atspi_state_set_contains(state_set, ATSPI_STATE_FOCUSED))
-            strncat(ret, TEXT_EDIT_FOCUSED, sizeof(ret) - strlen(ret) - 1);
+            strncat(ret, _("IDS_TRAIT_TEXT_EDIT_FOCUSED"), sizeof(ret) - strlen(ret) - 1);
          else
-            strncat(ret, TEXT_EDIT, sizeof(ret) - strlen(ret) - 1);
+            strncat(ret, _("IDS_TRAIT_TEXT_EDIT"), sizeof(ret) - strlen(ret) - 1);
          free(role_name);
       }
    else if (role == ATSPI_ROLE_MENU_ITEM)
@@ -281,7 +271,7 @@ generate_trait(AtspiAccessible *obj)
          int children_count = atspi_accessible_get_child_count(parent, NULL);
          int index = atspi_accessible_get_index_in_parent(obj, NULL);
          char tab_index[MENU_ITEM_TAB_INDEX_SIZE];
-         snprintf(tab_index, MENU_ITEM_TAB_INDEX_SIZE, MENU_ITEM_TAB_INDEX, index+1, children_count);
+         snprintf(tab_index, MENU_ITEM_TAB_INDEX_SIZE, _("IDS_TRAIT_MENU_ITEM_TAB_INDEX"), index+1, children_count);
          strncat(ret, tab_index, sizeof(ret) - strlen(ret) - 1);
       }
    else if (role == ATSPI_ROLE_GLASS_PANE)
@@ -289,17 +279,17 @@ generate_trait(AtspiAccessible *obj)
          AtspiAccessible *parent = atspi_accessible_get_parent(obj, NULL);
          int children_count = atspi_accessible_get_child_count(parent, NULL);
          char trait[HOVERSEL_TRAIT_SIZE];
-         snprintf(trait, HOVERSEL_TRAIT_SIZE, HOVERSEL_TRAIT, children_count);
+         snprintf(trait, HOVERSEL_TRAIT_SIZE, _("IDS_TRAIT_PD_HOVERSEL"), children_count);
          strncat(ret, trait, sizeof(ret) - strlen(ret) - 1);
       }
    else if (role == ATSPI_ROLE_LIST_ITEM && atspi_state_set_contains(state_set, ATSPI_STATE_EXPANDABLE))
       {
-         strncat(ret, GROUP_INDEX_TRAIT, sizeof(ret) - strlen(ret) - 1);
+         strncat(ret, _("IDS_TRAIT_GROUP_INDEX"), sizeof(ret) - strlen(ret) - 1);
          strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1);
          if (atspi_state_set_contains(state_set, ATSPI_STATE_EXPANDED))
-            strncat(ret, GROUP_INDEX_EXPANDED, sizeof(ret) - strlen(ret) - 1);
+            strncat(ret, _("IDS_TRAIT_GROUP_INDEX_EXPANDED"), sizeof(ret) - strlen(ret) - 1);
          else
-            strncat(ret, GROUP_INDEX_COLLAPSED, sizeof(ret) - strlen(ret) - 1);
+            strncat(ret, _("IDS_TRAIT_GROUP_INDEX_COLLAPSED"), sizeof(ret) - strlen(ret) - 1);
       }
    else
       {
@@ -787,7 +777,7 @@ static void _caret_move_beg(void)
                gchar *text = atspi_text_get_text(text_interface, 0, 1, NULL);
                DEBUG("SPEAK:%s", text);
                tts_speak(text, EINA_TRUE);
-               tts_speak(TEXT_BEGIN, EINA_FALSE);
+               tts_speak(_("IDS_TEXT_BEGIN"), EINA_FALSE);
                g_free(text);
             }
          else
@@ -820,8 +810,8 @@ static void _caret_move_end(void)
          if (ret)
             {
                DEBUG("Caret position increment done");
-               DEBUG("SPEAK:%s", TEXT_END);
-               tts_speak(TEXT_END, EINA_TRUE);
+               DEBUG("SPEAK:%s", _("IDS_TEXT_END"));
+               tts_speak(_("IDS_TEXT_END"), EINA_TRUE);
             }
          else
             ERROR("Caret position to end error");
@@ -859,8 +849,8 @@ static void _caret_move_forward(void)
                DEBUG("Current caret offset:%d", current_offset);
                if (offset_pos == atspi_text_get_character_count (text_interface, NULL))
                   {
-                     DEBUG("SPEAK:%s", TEXT_END);
-                     tts_speak(TEXT_END, EINA_FALSE);
+                     DEBUG("SPEAK:%s", _("IDS_TEXT_END"));
+                     tts_speak(_("IDS_TEXT_END"), EINA_FALSE);
                   }
                else
                   {
@@ -916,8 +906,8 @@ static void _caret_move_backward(void)
                g_free(text);
                if (offset_pos == 0)
                   {
-                     DEBUG("SPEAK:%s", TEXT_BEGIN);
-                     tts_speak(TEXT_BEGIN, EINA_FALSE);
+                     DEBUG("SPEAK:%s", _("IDS_TEXT_BEGIN"));
+                     tts_speak(_("IDS_TEXT_BEGIN"), EINA_FALSE);
                   }
             }
          else
index bcb2dfc..f9126e5 100644 (file)
@@ -8,9 +8,6 @@
 #include "test_suite/test_suite.h"
 #endif
 
-#define NO_VALUE_INTERFACE "No value interface present"
-#define NO_TEXT_INTERFACE "No text interface present"
-
 #define EPS 0.000000001
 
 /** @brief Service_Data used as screen reader internal data struct*/
@@ -167,7 +164,7 @@ static char *spi_on_caret_move_get_text(AtspiEvent *event, void *user_data)
          if(!caret_pos)
             {
                DEBUG("MIN POSITION REACHED");
-               if(asprintf(&return_text, "%s %s", (char*)atspi_text_get_text(text_interface, caret_pos, caret_pos + 1, NULL), MIN_POS_REACHED) < 0)
+               if(asprintf(&return_text, "%s %s", (char*)atspi_text_get_text(text_interface, caret_pos, caret_pos + 1, NULL), _("IDS_REACHED_MIN_POS")) < 0)
                   {
                      ERROR(MEMORY_ERROR);
                      return NULL;
@@ -176,7 +173,7 @@ static char *spi_on_caret_move_get_text(AtspiEvent *event, void *user_data)
          else if(char_count == caret_pos)
             {
                DEBUG("MAX POSITION REACHED");
-               if(asprintf(&return_text, "%s %s", (char*)atspi_text_get_text(text_interface, caret_pos, caret_pos + 1, NULL), MAX_POS_REACHED) < 0)
+               if(asprintf(&return_text, "%s %s", (char*)atspi_text_get_text(text_interface, caret_pos, caret_pos + 1, NULL), _("IDS_REACHED_MAX_POS")) < 0)
                   {
                      ERROR(MEMORY_ERROR);
                      return NULL;
@@ -216,7 +213,7 @@ static char *spi_on_value_changed_get_text(AtspiEvent *event, void *user_data)
          if(abs(current_temp_value - atspi_value_get_maximum_value(value_interface, NULL)) < EPS)
             {
                DEBUG("MAX VALUE REACHED");
-               if(asprintf(&text_to_read, "%.2f %s", current_temp_value, MAX_REACHED) < 0)
+               if(asprintf(&text_to_read, "%.2f %s", current_temp_value, _("IDS_REACHED_MAX_VAL")) < 0)
                   {
                      ERROR(MEMORY_ERROR);
                      return NULL;
@@ -225,7 +222,7 @@ static char *spi_on_value_changed_get_text(AtspiEvent *event, void *user_data)
          else if(abs(current_temp_value - atspi_value_get_minimum_value(value_interface, NULL)) < EPS)
             {
                DEBUG("MIN VALUE REACHED");
-               if(asprintf(&text_to_read, "%.2f %s", current_temp_value, MIN_REACHED) < 0)
+               if(asprintf(&text_to_read, "%.2f %s", current_temp_value, _("IDS_REACHED_MIN_VAL")) < 0)
                   {
                      ERROR(MEMORY_ERROR);
                      return NULL;
index d681111..c8e9891 100644 (file)
 #include "smart_notification.h"
 #include "logger.h"
 
-#define CHARGING "Battery charger connected"
-#define NOT_CHARGING "Battery charger disconnected"
-#define SCREEN_ON "Screen is on"
-#define SCREEN_OFF "Screen is off"
-#define BATTERY_EMPTY "Battery level is empty"
-#define BATTERY_LOW "Battery level is low"
-#define BATTERY_HIGH "Battery level is high"
-#define BATTERY_FULL "Battery level is full"
-#define BATTERY_CRITICAL "Battery level is critical"
 #define MAX_SIM_COUNT 2
 #define DATE_TIME_BUFFER_SIZE 26
-#define BATTERY_INFO_CHARGING "Charging."
-#define BATTERY_INFO_BATTERY_STR "Battery"
-#define BATTERY_STR_FULL_CHARGED "Full charged"
-#define SIGNAL_STR_SIGNAL_STRENGTH "Signal strength equals:"
-#define SIGNAL_STR_SIMCARD "Simcard"
-#define NETWORK_SERVICE_STR_LTE "LTE"
-#define NETWORK_SERVICE_STR_HSDPA "HSDPA"
-#define NETWORK_SERVICE_STR_3G "3G"
-#define NETWORK_SERVICE_STR_EDGE "EDGE"
-#define NETWORK_SERVICE_STR_25G "2.5G"
-#define NETWORK_SERVICE_STR_2G "2G"
-#define NETWORK_SERVICE_STR_SEARCHING "searching..."
-#define NETWORK_SERVICE_STR_EMERGENCY "emergency"
-#define NETWORK_SERVICE_STR_NO_SERVICE "no service"
-#define NETWORK_SERVICE_STR_UNKNOWN "unknown"
-#define NETWORK_TYPE_WIFI "Wi fi"
-#define WIFI_SIGNAL_GOOD "Good"
-#define WIFI_SIGNAL_MEDIUM "Medium"
-#define WIFI_SIGNAL_WEAK "Weak"
-#define WIFI_SIGNAL_POOR "Poor"
-#define WIFI_NO_SIGNAL "No signal"
-#define NOTI_NOTIFICATIONS_UNREAD_0 "No event"
-#define NOTI_NOTIFICATIONS_UNREAD_1 "1 notification unread"
-#define NOTI_NOTIFICATIONS_UNREAD_MANY "notifications unread"
-#define BT_BLUETOOTH_OFF "Bluetooth off"
-#define BT_NO_DEVICES_CONNECTED "Nothing connected"
-#define BT_DEVICES_CONNECTED_COUNT "devices connected"
 
 TapiHandle *tapi_handle[MAX_SIM_COUNT + 1] = {0, };
 
@@ -157,15 +121,15 @@ static void device_system_cb(device_callback_e type, void *value, void *user_dat
 
          if(status == DEVICE_BATTERY_LEVEL_LOW)
             {
-               tts_speak(BATTERY_LOW, EINA_TRUE);
+               tts_speak(_("IDS_SYSTEM_BATTERY_LOW"), EINA_TRUE);
             }
          else if(status == DEVICE_BATTERY_LEVEL_CRITICAL)
             {
-               tts_speak(BATTERY_CRITICAL, EINA_TRUE);
+               tts_speak(_("IDS_SYSTEM_BATTERY_CRITICAL"), EINA_TRUE);
             }
          else if(status == DEVICE_BATTERY_LEVEL_FULL)
             {
-               tts_speak(BATTERY_FULL, EINA_TRUE);
+               tts_speak(_("IDS_SYSTEM_BATTERY_FULL"), EINA_TRUE);
             }
       }
    else if(type == DEVICE_CALLBACK_BATTERY_CHARGING)
@@ -179,11 +143,11 @@ static void device_system_cb(device_callback_e type, void *value, void *user_dat
 
          if(charging)
             {
-               tts_speak(CHARGING, EINA_FALSE);
+               tts_speak(_("IDS_SYSTEM_CHARGING"), EINA_FALSE);
             }
          else
             {
-               tts_speak(NOT_CHARGING, EINA_FALSE);
+               tts_speak(_("IDS_SYSTEM_NOT_CHARGING"), EINA_FALSE);
             }
       }
    else if(type == DEVICE_CALLBACK_DISPLAY_STATE)
@@ -197,11 +161,11 @@ static void device_system_cb(device_callback_e type, void *value, void *user_dat
 
          if(state == DISPLAY_STATE_NORMAL)
             {
-               tts_speak(SCREEN_ON, EINA_FALSE);
+               tts_speak(_("IDS_SYSTEM_SCREEN_ON"), EINA_FALSE);
             }
          else if(state == DISPLAY_STATE_SCREEN_OFF)
             {
-               tts_speak(SCREEN_OFF, EINA_FALSE);
+               tts_speak(_("IDS_SYSTEM_SCREEN_OFF"), EINA_FALSE);
             }
       }
 }
@@ -299,11 +263,11 @@ char *device_error_to_string(int e)
          break;
 
       default:
-         return NETWORK_SERVICE_STR_UNKNOWN;
+         return _("IDS_SYSTEM_NETWORK_SERVICE_UNKNOWN");
          break;
       }
 
-   return NETWORK_SERVICE_STR_UNKNOWN;
+   return _("IDS_SYSTEM_NETWORK_SERVICE_UNKNOWN");
 }
 
 void device_battery_get(void)
@@ -327,7 +291,7 @@ void device_battery_get(void)
 
    if (is_charging)
       {
-         charging_text = BATTERY_INFO_CHARGING;
+         charging_text = _("IDS_SYSTEM_BATTERY_INFO_CHARGING");
       }
    else
       {
@@ -343,7 +307,7 @@ void device_battery_get(void)
 
    if(percent == 100)
       {
-         if (!asprintf(&buffer, "%s %s", charging_text, BATTERY_STR_FULL_CHARGED))
+         if (!asprintf(&buffer, "%s %s", charging_text, _("IDS_SYSTEM_BATTERY_FULLY_CHARGED_STR")))
             {
                ERROR("Buffer length == 0");
                return;
@@ -351,7 +315,7 @@ void device_battery_get(void)
       }
    else
       {
-         if (!asprintf(&buffer, "%s %d %% %s", charging_text, percent, BATTERY_INFO_BATTERY_STR))
+         if (!asprintf(&buffer, "%s %d %% %s", charging_text, percent, _("IDS_SYSTEM_BATTERY_INFO_BATTERY_STR")))
             {
                ERROR("Buffer length == 0");
                return;
@@ -399,9 +363,9 @@ static void _signal_strength_sim_get(void)
             }
 
          if (sim_card_count > 1)
-            eina_strbuf_append_printf(str_buf, "%s %d %s %d; ", SIGNAL_STR_SIMCARD, i + 1, SIGNAL_STR_SIGNAL_STRENGTH, val);
+            eina_strbuf_append_printf(str_buf, "%s %d %s %d; ", _("IDS_SYSTEM_SIGNAL_SIMCARD"), i + 1, _("IDS_SYSTEM_SIGNAL_STRENGTH"), val);
          else
-            eina_strbuf_append_printf(str_buf, "%s %d; ", SIGNAL_STR_SIGNAL_STRENGTH, val);
+            eina_strbuf_append_printf(str_buf, "%s %d; ", _("IDS_SYSTEM_SIGNAL_STRENGTH"), val);
          DEBUG("sim: %d TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL %d", i, val);
 
 
@@ -414,43 +378,43 @@ static void _signal_strength_sim_get(void)
          switch(service_type)
             {
             case TAPI_NETWORK_SERVICE_TYPE_UNKNOWN:
-               service_type_text = NETWORK_SERVICE_STR_UNKNOWN;
+               service_type_text = _("IDS_SYSTEM_NETWORK_SERVICE_UNKNOWN");
                break;
 
             case TAPI_NETWORK_SERVICE_TYPE_NO_SERVICE:
-               service_type_text = NETWORK_SERVICE_STR_NO_SERVICE;
+               service_type_text = _("IDS_SYSTEM_NETWORK_SERVICE_NO_SERVICE");
                break;
 
             case TAPI_NETWORK_SERVICE_TYPE_EMERGENCY:
-               service_type_text = NETWORK_SERVICE_STR_EMERGENCY;
+               service_type_text = _("IDS_SYSTEM_NETWORK_SERVICE_EMERGENCY");
                break;
 
             case TAPI_NETWORK_SERVICE_TYPE_SEARCH:
-               service_type_text = NETWORK_SERVICE_STR_SEARCHING;
+               service_type_text = _("IDS_SYSTEM_NETWORK_SERVICE_SEARCHING");
                break;
 
             case TAPI_NETWORK_SERVICE_TYPE_2G:
-               service_type_text = NETWORK_SERVICE_STR_2G;
+               service_type_text = _("IDS_SYSTEM_NETWORK_SERVICE_2G");
                break;
 
             case TAPI_NETWORK_SERVICE_TYPE_2_5G:
-               service_type_text = NETWORK_SERVICE_STR_25G;
+               service_type_text = _("IDS_SYSTEM_NETWORK_SERVICE_25G");
                break;
 
             case TAPI_NETWORK_SERVICE_TYPE_2_5G_EDGE:
-               service_type_text = NETWORK_SERVICE_STR_EDGE;
+               service_type_text = _("IDS_SYSTEM_NETWORK_SERVICE_EDGE");
                break;
 
             case TAPI_NETWORK_SERVICE_TYPE_3G:
-               service_type_text = NETWORK_SERVICE_STR_3G;
+               service_type_text = _("IDS_SYSTEM_NETWORK_SERVICE_3G");
                break;
 
             case TAPI_NETWORK_SERVICE_TYPE_HSDPA:
-               service_type_text = NETWORK_SERVICE_STR_HSDPA;
+               service_type_text = _("IDS_SYSTEM_NETWORK_SERVICE_HSDPA");
                break;
 
             case TAPI_NETWORK_SERVICE_TYPE_LTE:
-               service_type_text = NETWORK_SERVICE_STR_LTE;
+               service_type_text = _("IDS_SYSTEM_NETWORK_SERVICE_LTE");
                break;
             }
 
@@ -493,9 +457,9 @@ static void _signal_strength_wifi_get(void)
 
          if(!ap)
             {
-               DEBUG("Text to say: %s %s",NETWORK_TYPE_WIFI, "Not connected");
+               DEBUG("Text to say: %s %s",_("IDS_SYSTEM_NETWORK_TYPE_WIFI"), "Not connected");
 
-               if (!asprintf(&buffer, " %s, %s", NETWORK_TYPE_WIFI, "Not connected"))
+               if (!asprintf(&buffer, " %s, %s", _("IDS_SYSTEM_NETWORK_TYPE_WIFI"), "Not connected"))
                   {
                      ERROR("buffer length == 0");
                      return;
@@ -517,27 +481,27 @@ static void _signal_strength_wifi_get(void)
          switch(val)
             {
             case 0:
-               wifi_text = WIFI_NO_SIGNAL;
+               wifi_text = _("IDS_SYSTEM_WIFI_SIGNAL_NO_SIGNAL");
                break;
 
             case 1:
-               wifi_text = WIFI_SIGNAL_POOR;
+               wifi_text = _("IDS_SYSTEM_WIFI_SIGNAL_POOR");
                break;
 
             case 2:
-               wifi_text = WIFI_SIGNAL_WEAK;
+               wifi_text = _("IDS_SYSTEM_WIFI_SIGNAL_WEAK");
                break;
 
             case 3:
-               wifi_text = WIFI_SIGNAL_MEDIUM;
+               wifi_text = _("IDS_SYSTEM_WIFI_SIGNAL_MEDIUM");
                break;
 
             case 4:
-               wifi_text = WIFI_SIGNAL_GOOD;
+               wifi_text = _("IDS_SYSTEM_WIFI_SIGNAL_GOOD");
                break;
             }
 
-         if (!asprintf(&buffer, " %s, %s", NETWORK_TYPE_WIFI, wifi_text))
+         if (!asprintf(&buffer, " %s, %s", _("IDS_SYSTEM_NETWORK_TYPE_WIFI"), wifi_text))
             {
                ERROR("buffer length == 0");
                wifi_ap_destroy(ap);
@@ -614,19 +578,19 @@ void device_missed_events_get(void)
 
    if(noti_count == 0)
       {
-         DEBUG(NOTI_NOTIFICATIONS_UNREAD_0);
-         tts_speak(NOTI_NOTIFICATIONS_UNREAD_0, EINA_FALSE);
+         DEBUG(_("IDS_SYSTEM_NOTIFICATIONS_UNREAD_0"));
+         tts_speak(_("IDS_SYSTEM_NOTIFICATIONS_UNREAD_0"), EINA_FALSE);
       }
    else if(noti_count == 1)
       {
-         DEBUG(NOTI_NOTIFICATIONS_UNREAD_1);
-         tts_speak(NOTI_NOTIFICATIONS_UNREAD_1, EINA_FALSE);
+         DEBUG(_("IDS_SYSTEM_NOTIFICATIONS_UNREAD_1"));
+         tts_speak(_("IDS_SYSTEM_NOTIFICATIONS_UNREAD_1"), EINA_FALSE);
       }
    else
       {
-         DEBUG("%d %s", noti_count, NOTI_NOTIFICATIONS_UNREAD_MANY);
+         DEBUG("%d %s", noti_count, _("IDS_SYSTEM_NOTIFICATIONS_UNREAD_MANY"));
 
-         if (asprintf(&buffer, "%d %s", noti_count, NOTI_NOTIFICATIONS_UNREAD_MANY))
+         if (asprintf(&buffer, "%d %s", noti_count, _("IDS_SYSTEM_NOTIFICATIONS_UNREAD_MANY")))
             {
                ERROR("buffer length equals 0");
             }
@@ -729,8 +693,8 @@ void device_bluetooth_get(void)
 
    if (adapter_state == BT_ADAPTER_DISABLED)
       {
-         DEBUG("Text to say: %s", BT_BLUETOOTH_OFF);
-         tts_speak(BT_BLUETOOTH_OFF, EINA_FALSE);
+         DEBUG("Text to say: %s", _("IDS_SYSTEM_BT_BLUETOOTH_OFF"));
+         tts_speak(_("IDS_SYSTEM_BT_BLUETOOTH_OFF"), EINA_FALSE);
          return;
       }
    else
@@ -739,7 +703,7 @@ void device_bluetooth_get(void)
 
          if(device_count == 0)
             {
-               if (!asprintf(&buffer, BT_NO_DEVICES_CONNECTED))
+               if (!asprintf(&buffer, _("IDS_SYSTEM_BT_NO_DEVICES_CONNECTED")))
                   {
                      ERROR("buffer length == 0");
                   }
@@ -751,7 +715,7 @@ void device_bluetooth_get(void)
          else
             {
                if (asprintf(&buffer, "%d %s", device_count,
-                            BT_DEVICES_CONNECTED_COUNT))
+                            _("IDS_SYSTEM_BT_DEVICES_CONNECTED_COUNT")))
                   {
                      ERROR("buffer length == 0");
                   }
index 0c8cc48..68ac62d 100644 (file)
@@ -11,8 +11,6 @@
 #define RED  "\x1B[31m"
 #define RESET "\033[0m"
 
-#define ITEMS_NOTIFICATION "Visible items from %d to %d"
-
 static Eina_Bool status = EINA_FALSE;
 
 static void _smart_notification_focus_chain_end(void);
@@ -182,7 +180,7 @@ static void _smart_notification_realized_items(int start_idx, int end_idx)
 
    char buf[256];
 
-   snprintf(buf, sizeof(buf), ITEMS_NOTIFICATION, start_idx, end_idx);
+   snprintf(buf, sizeof(buf), _("IDS_REACHED_ITEMS_NOTIFICATION"), start_idx, end_idx);
 
    tts_speak(strdup(buf), EINA_FALSE);
 }