Fix translations. 45/159245/3 devel
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Tue, 7 Nov 2017 15:43:30 +0000 (16:43 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Fri, 10 Nov 2017 06:44:18 +0000 (06:44 +0000)
Explicite bind textdomain to avoid having splitting translation files.

Change-Id: I870d7573cebc6c600ab324feaddade7381b97fb2

clock-common/inc/Common/Defines.h
clock-common/inc/Utils/TizenApp.h
clock-common/src/Utils/TizenApp.cpp
clock-ring/src/Ring.cpp
clock-ring/tizen-manifest.xml
clock/src/Clock.cpp

index 42c02cc..f8ab5cc 100644 (file)
@@ -18,8 +18,9 @@
 #define _CLOCK_COMMON_DEFINES_H_
 
 #define PACKAGE_CLOCK "org.tizen.clock"
-#define PACKAGE_RING "org.tizen.clock-ring"
+#define PACKAGE_RING "org.tizen.clock.ring"
 
+#define TEXT_DOMAIN "clock"
 #define APP_CONTROL_OPERATION_TIMEOUT "http://tizen.org/appcontrol/operation/timeout"
 #define APP_CONTROL_OPERATION_ALARM "http://tizen.org/appcontrol/operation/alarm"
 #define RINGTONE_APP_PACKAGE_ID "org.tizen.setting-ringtone"
index 264e9f5..fa948dd 100644 (file)
@@ -78,6 +78,14 @@ class EXPORT_API TizenApp {
                virtual bool OnCreate() { return false; };
 
                /**
+                * @brief binds and use text domain
+                *
+                * @param[in] domain Text domain main
+                * @param[in] path locale path
+                */
+               void UseTextDomain(const char *domain, const char *locale_path);
+
+               /**
                 * @brief Run Tizen application main loop
                 */
                int Run(int argc, char **argv);
index 30df297..13d4bf8 100644 (file)
@@ -1,3 +1,4 @@
+#include <libintl.h>
 #include "Utils/TizenApp.h"
 #include "Utils/Log.h"
 
@@ -47,6 +48,12 @@ ui_app_lang_changed(app_event_info_h event_info, void *data)
        app->OnLanguageChanged(event_info);
 }
 
+void TizenApp::UseTextDomain(const char *domain, const char *path)
+{
+       bindtextdomain(domain, path);
+       textdomain(domain);
+}
+
 int TizenApp::Run(int argc, char **argv)
 {
        int ret = 0;
index ff571d9..d846343 100644 (file)
@@ -20,6 +20,7 @@
 #include "app.h"
 #include "Ring.h"
 #include "Utils/TizenApp.h"
+#include "Utils/TizenAppUtils.h"
 #include "Utils/SystemSettings.h"
 
 bool RingApp::OnCreate()
@@ -33,6 +34,8 @@ bool RingApp::OnCreate()
        provider_ = new common::AlarmProvider();
        ring_ctrl_ = new controller::RingController(provider_->GetAlarms());
 
+       UseTextDomain(TEXT_DOMAIN, utils::TizenAppUtils::GetResourcePath(utils::TizenAppUtils::APP_DIR_RESOURCE, "locale"));
+
        return true;
 }
 
index 95b0feb..288fcbd 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<manifest xmlns="http://tizen.org/ns/packages" api-version="4.0" package="org.tizen.clock-ring" version="1.0.0">
+<manifest xmlns="http://tizen.org/ns/packages" api-version="4.0" package="org.tizen.clock" version="1.0.0">
     <profile name="mobile"/>
-    <ui-application appid="org.tizen.clock-ring" exec="clock-ring" hw-acceleration="on" launch_mode="single" multiple="false" nodisplay="true" taskmanage="false" type="capp">
+    <ui-application appid="org.tizen.clock.ring" exec="clock-ring" hw-acceleration="on" launch_mode="single" multiple="false" nodisplay="true" taskmanage="false" type="capp">
         <label>clock-ring</label>
         <icon>clock-ring.png</icon>
     </ui-application>
index a6715fe..69ca194 100644 (file)
@@ -21,6 +21,8 @@
 #include "Clock.h"
 #include "Utils/TizenApp.h"
 #include "Utils/SystemSettings.h"
+#include "Utils/TizenAppUtils.h"
+#include "Common/Defines.h"
 
 bool ClockApp::OnCreate()
 {
@@ -33,6 +35,8 @@ bool ClockApp::OnCreate()
        provider_ = new common::AlarmProvider();
        main_ctrl_ = new controller::MainController(provider_);
 
+       UseTextDomain(TEXT_DOMAIN, utils::TizenAppUtils::GetResourcePath(utils::TizenAppUtils::APP_DIR_RESOURCE, "locale"));
+
        return true;
 }