Commit bc078d65 authored by Simon Morlat's avatar Simon Morlat

fix translations for mac os

parent 82e74fe4
......@@ -92,6 +92,9 @@
<binary>
${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/engines/*.so
</binary>
<binary>
${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/immodules/*.so
</binary>
<!-- Copy GIO modules, required for https access for wizard-->
<binary>
${prefix}/lib/gio/modules/libgiognutls.so
......@@ -104,6 +107,12 @@
<translations name="linphone">
${prefix}/share/locale
</translations>
<translations name="gdk-pixbuf">
${prefix}/share/locale
</translations>
<translations name="glib20">
${prefix}/share/locale
</translations>
<translations name="gtk20">
${prefix}/share/locale
</translations>
......
......@@ -66,7 +66,7 @@ extern "C" {
#ifdef HAVE_GETTEXT
#include <libintl.h>
#ifndef _
#define _(String) gettext(String)
#define _(String) dgettext(GETTEXT_PACKAGE,String)
#endif
#else
#ifndef _
......
......@@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef ENABLE_NLS
# include <libintl.h>
# undef _
# define _(String) gettext (String)
# define _(String) dgettext (GETTEXT_PACKAGE,String)
#else
# define _(String) (String)
# define ngettext(singular,plural,number) ((number>1) ? (plural) : (singular) )
......@@ -164,4 +164,4 @@ void linphone_gtk_uninit_instance(void);
void linphone_gtk_monitor_usb(void);
void linphone_gtk_unmonitor_usb(void);
gchar *linphone_gtk_get_record_path(const LinphoneAddress *address, gboolean is_conference);
\ No newline at end of file
gchar *linphone_gtk_get_record_path(const LinphoneAddress *address, gboolean is_conference);
......@@ -361,6 +361,8 @@ GtkWidget *linphone_gtk_create_window(const char *window_name){
if (get_ui_file(window_name,path,sizeof(path))==-1) return NULL;
gtk_builder_set_translation_domain(builder,GETTEXT_PACKAGE);
if (!gtk_builder_add_from_file (builder, path, &error)){
g_error("Couldn't load builder file: %s", error->message);
g_error_free (error);
......@@ -387,6 +389,9 @@ GtkWidget *linphone_gtk_create_widget(const char *filename, const char *widget_n
object_ids[1]=NULL;
if (get_ui_file(filename,path,sizeof(path))==-1) return NULL;
gtk_builder_set_translation_domain(builder,GETTEXT_PACKAGE);
if (!gtk_builder_add_objects_from_file(builder,path,object_ids,&error)){
g_error("Couldn't load %s from builder file %s: %s", widget_name,path,error->message);
g_error_free (error);
......@@ -2070,9 +2075,6 @@ static gboolean on_block_termination(void){
#endif
int main(int argc, char *argv[]){
#ifdef ENABLE_NLS
void *p;
#endif
char *config_file;
const char *factory_config_file;
const char *lang;
......@@ -2122,10 +2124,11 @@ int main(int argc, char *argv[]){
}
#ifdef ENABLE_NLS
p=bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
if (p==NULL) perror("bindtextdomain failed");
bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
setlocale(LC_ALL,"");
/*do not use textdomain(): this sets a global default domain. On Mac OS bundle, it breaks gtk translations (obscure bug somewhere)*/
/*textdomain (GETTEXT_PACKAGE);*/
#else
g_message("NLS disabled.\n");
#endif
......@@ -2159,7 +2162,18 @@ int main(int argc, char *argv[]){
g_error("Could not change directory to %s : %s",workingdir,strerror(errno));
}
}
#if defined(__APPLE__) && defined(ENABLE_NLS)
/*workaround for bundles. GTK is unable to find translations in the bundle (obscure bug again).
So we help it:*/
{
if (g_file_test(PACKAGE_LOCALE_DIR, G_FILE_TEST_IS_DIR)){
bindtextdomain("gtk20",PACKAGE_LOCALE_DIR);
bindtextdomain("gdk-pixbuf",PACKAGE_LOCALE_DIR);
bindtextdomain("glib20",PACKAGE_LOCALE_DIR);
}
}
#endif
/* Now, look for the factory configuration file, we do it this late
since we want to have had time to change directory and to parse
the options, in case we needed to access the working directory */
......
oRTP @ b04994f1
Subproject commit aca5bcf65ee64806db02caadb4d4bc1c99a47775
Subproject commit b04994f1d4f00d802fef64a665f0b77db4d98dee
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment