mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 18:30:08 +00:00
gtk4-builder-tool: Localization fixes
Be consistent about marking strings for translation. And make locatization actually work by including gi18n-lib.h instead of gi18n.h.
This commit is contained in:
parent
fda2010a9e
commit
2dc17aeca9
@ -23,7 +23,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <glib/gprintf.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <glib/gprintf.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
@ -125,15 +125,15 @@ preview_file (const char *filename,
|
||||
if (object == NULL)
|
||||
{
|
||||
if (id)
|
||||
g_printerr ("No object with ID '%s' found\n", id);
|
||||
g_printerr (_("No object with ID '%s' found\n"), id);
|
||||
else
|
||||
g_printerr ("No previewable object found\n");
|
||||
g_printerr (_("No previewable object found\n"));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (!GTK_IS_WIDGET (object))
|
||||
{
|
||||
g_printerr ("Objects of type %s can't be previewed\n", G_OBJECT_TYPE_NAME (object));
|
||||
g_printerr (_("Objects of type %s can't be previewed\n"), G_OBJECT_TYPE_NAME (object));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ do_preview (int *argc,
|
||||
|
||||
if (gdk_display_get_default () == NULL)
|
||||
{
|
||||
g_printerr ("Could not initialize windowing system\n");
|
||||
g_printerr (_("Could not initialize windowing system\n"));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@ -205,13 +205,13 @@ do_preview (int *argc,
|
||||
|
||||
if (filenames == NULL)
|
||||
{
|
||||
g_printerr ("No .ui file specified\n");
|
||||
g_printerr (_("No .ui file specified\n"));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (g_strv_length (filenames) > 1)
|
||||
{
|
||||
g_printerr ("Can only preview a single .ui file\n");
|
||||
g_printerr (_("Can only preview a single .ui file\n"));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <glib/gprintf.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
@ -233,15 +233,15 @@ screenshot_file (const char *filename,
|
||||
if (object == NULL)
|
||||
{
|
||||
if (id)
|
||||
g_printerr ("No object with ID '%s' found\n", id);
|
||||
g_printerr (_("No object with ID '%s' found\n"), id);
|
||||
else
|
||||
g_printerr ("No object found\n");
|
||||
g_printerr (_("No object found\n"));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (!GTK_IS_WIDGET (object))
|
||||
{
|
||||
g_printerr ("Objects of type %s can't be screenshot\n", G_OBJECT_TYPE_NAME (object));
|
||||
g_printerr (_("Objects of type %s can't be screenshot\n"), G_OBJECT_TYPE_NAME (object));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ screenshot_file (const char *filename,
|
||||
|
||||
if (texture == NULL)
|
||||
{
|
||||
g_printerr ("Failed to take a screenshot\n");
|
||||
g_printerr (_("Failed to take a screenshot\n"));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@ -306,8 +306,8 @@ screenshot_file (const char *filename,
|
||||
|
||||
if (g_file_test (save_to, G_FILE_TEST_EXISTS) && !force)
|
||||
{
|
||||
g_printerr ("File %s exists.\n"
|
||||
"Use --force to overwrite.\n", save_to);
|
||||
g_printerr (_("File %s exists.\n"
|
||||
"Use --force to overwrite.\n"), save_to);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@ -328,11 +328,11 @@ screenshot_file (const char *filename,
|
||||
g_bytes_get_size (bytes),
|
||||
&error))
|
||||
{
|
||||
g_print ("Output written to %s.\n", save_to);
|
||||
g_print (_("Output written to %s.\n"), save_to);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_printerr ("Failed to save %s: %s\n", save_to, error->message);
|
||||
g_printerr (_("Failed to save %s: %s\n"), save_to, error->message);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@ -366,7 +366,7 @@ do_screenshot (int *argc,
|
||||
|
||||
if (gdk_display_get_default () == NULL)
|
||||
{
|
||||
g_printerr ("Could not initialize windowing system\n");
|
||||
g_printerr (_("Could not initialize windowing system\n"));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@ -387,13 +387,13 @@ do_screenshot (int *argc,
|
||||
|
||||
if (filenames == NULL)
|
||||
{
|
||||
g_printerr ("No .ui file specified\n");
|
||||
g_printerr (_("No .ui file specified\n"));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (g_strv_length (filenames) > 2)
|
||||
{
|
||||
g_printerr ("Can only screenshot a single .ui file and a single output file\n");
|
||||
g_printerr (_("Can only screenshot a single .ui file and a single output file\n"));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <glib/gprintf.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
@ -648,10 +648,31 @@ warn_missing_property (Element *element,
|
||||
const char *property_name,
|
||||
PropKind kind)
|
||||
{
|
||||
const char *kind_str[] = { "", "Packing ", "Cell ", "Layout " };
|
||||
char *name;
|
||||
char *msg;
|
||||
|
||||
g_printerr (_("%s:%d: %sproperty %s::%s not found\n"),
|
||||
data->input_filename, element->line_number, kind_str[kind], class_name, property_name);
|
||||
name = g_strconcat (class_name, "::", property_name, NULL);
|
||||
switch (kind)
|
||||
{
|
||||
case PROP_KIND_OBJECT:
|
||||
msg = g_strdup_printf (_("Property %s not found"), name);
|
||||
break;
|
||||
case PROP_KIND_PACKING:
|
||||
msg = g_strdup_printf (_("Packing property %s not found"), name);
|
||||
break;
|
||||
case PROP_KIND_CELL_PACKING:
|
||||
msg = g_strdup_printf (_("Cell property %s not found"), name);
|
||||
break;
|
||||
case PROP_KIND_LAYOUT:
|
||||
msg = g_strdup_printf (_("Layout property %s not found"), name);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
g_printerr ("%s:%d: %s\n", data->input_filename, element->line_number, msg);
|
||||
g_free (name);
|
||||
g_free (msg);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -1373,7 +1394,7 @@ rewrite_start_center_end_children (Element *element,
|
||||
else if (end_child == NULL)
|
||||
end_child = child;
|
||||
else
|
||||
g_warning ("%s only accepts three children", get_class_name (element));
|
||||
g_warning (_("%s only accepts three children"), get_class_name (element));
|
||||
}
|
||||
|
||||
if (start_child)
|
||||
@ -2454,7 +2475,7 @@ simplify_file (const char *filename,
|
||||
|
||||
if (data.root == NULL)
|
||||
{
|
||||
g_printerr (_("Can’t parse “%s”\n"), filename);
|
||||
g_printerr (_("Can’t parse “%s”: %s\n"), filename, "");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -2486,7 +2507,7 @@ simplify_file (const char *filename,
|
||||
|
||||
if (!g_file_set_contents (data.input_filename, content, length, &error))
|
||||
{
|
||||
g_printerr (_("Failed to write %s: “%s”\n"), data.input_filename, error->message);
|
||||
g_printerr (_("Failed to write “%s”: “%s”\n"), data.input_filename, error->message);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <glib/gprintf.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
@ -42,7 +42,7 @@ make_fake_type (const char *type_name,
|
||||
parent_type = g_type_from_name (parent_name);
|
||||
if (parent_type == G_TYPE_INVALID)
|
||||
{
|
||||
g_printerr ("Failed to lookup template parent type %s\n", parent_name);
|
||||
g_printerr (_("Failed to lookup template parent type %s\n"), parent_name);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ fake_scope_check_deprecations (FakeScope *self,
|
||||
if (is_deprecated (name))
|
||||
{
|
||||
if (s->len == 0)
|
||||
g_string_append (s, "Deprecated types:\n");
|
||||
g_string_append (s, _("Deprecated types:\n"));
|
||||
g_string_append_printf (s, "%s", name);
|
||||
g_string_append (s, "\n");
|
||||
}
|
||||
@ -164,7 +164,7 @@ validate_template (const char *filename,
|
||||
object = g_object_new (template_type, NULL);
|
||||
if (!object)
|
||||
{
|
||||
g_printerr ("Failed to create an instance of the template type %s\n", type_name);
|
||||
g_printerr (_("Failed to create an instance of the template type %s\n"), type_name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -276,6 +276,12 @@ do_validate (int *argc, const char ***argv)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (!filenames)
|
||||
{
|
||||
g_printerr (_("No .ui file specified\n"));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
g_option_context_free (context);
|
||||
|
||||
for (i = 0; filenames[i]; i++)
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <glib/gprintf.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
Loading…
Reference in New Issue
Block a user