araruna
(Arthur Araruna)
August 30, 2022, 2:38pm
1
The default project created by Gnome Builder calls the function gtk_show_about_dialog
setting the content by using properties.
The application I’m developping is supposed to be in Portuguese, but I can’t seem to find where to override these strings (such as the button labels: “About” and “Credits”, and others).
How can I do this? Is there a file to edit, or a configuration to change, or even some function I should call?
gkarsay
(Gabor Karsay)
September 6, 2022, 6:44pm
2
Actually everything should be already translated.
I get this launching LANGUAGE=pt_PT ./gtkabout
Source code:
/* Compile:
* gcc $(pkg-config --cflags gtk+-3.0) -o gtkabout gtkabout.c $(pkg-config --libs gtk+-3.0) */
#include <gtk/gtk.h>
static void
show_about (GtkWidget *widget,
gpointer data)
{
GtkWindow *parent = GTK_WINDOW (data);
const gchar *authors[] = {"Me and Bobby McGee", NULL};
gtk_show_about_dialog (parent,
"authors", authors,
NULL);
}
static void
activate (GtkApplication *app,
gpointer user_data)
{
GtkWidget *window;
GtkWidget *button;
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
button = gtk_button_new_with_label ("Show About Dialog");
g_signal_connect (button, "clicked", G_CALLBACK (show_about), window);
gtk_container_add (GTK_CONTAINER (window), button);
gtk_widget_show_all (window);
gtk_window_present (GTK_WINDOW (window));
}
int
main (int argc,
char **argv)
{
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
Mejans
(Mejans)
September 6, 2022, 9:51pm
3
Hello!
It should be translated but this is not the case.
I reported the same with Occitan and Amberol here:
https://gitlab.gnome.org/World/amberol/-/issues/217
araruna
(Arthur Araruna)
September 7, 2022, 4:46pm
4
Now that I saw these answers, I believe the difference lies in that your example is made to be compiled and executed as a native executable, but it seems that Gnome Builder does it through flatpak (and I can’t find how to change this ), so maybe from the flatpak it only uses the “en_*” or the “C” locale.
I’ll try to set this env variable from Builder and see if it changes anything.
EDIT : No… nothing has changed. I tried to set both LANGUAGES
and LANG
and none made any difference.
gkarsay
(Gabor Karsay)
September 7, 2022, 4:46pm
5
I could reproduce this with the Flatpak version of @ebassi 's Amberol. Locale is de_AT, the 2 strings “About” and “Credits” are not translated:
However, if built from source, the 2 strings are translated:
So this seems to be Flatpak / runtime related.
1 Like
Mejans
(Mejans)
September 7, 2022, 4:50pm
6
Thanks you, I feel less alone.
ebassi
(Emmanuele Bassi)
September 7, 2022, 5:05pm
7
It’s very odd, because “About” and “Credits” come from the same place that translates the license identifier, and that one gets correctly localised.
gkarsay
(Gabor Karsay)
September 7, 2022, 8:16pm
8
This happens only in runtime 42 and everything is okay with the nightly runtime:
$ flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo
$ flatpak install gnome-nightly org.gnome.Platform
$ flatpak run --runtime-version=master io.bassi.Amberol
Probably fixed with this commit: https://gitlab.gnome.org/GNOME/gtk/-/commit/19fb336c398aaea851d8d991c9c804e89299ad0d
1 Like
system
(system)
Closed
October 7, 2022, 8:17pm
9
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.