Merge branch 'compile-schemas-strings' into 'master'

glib-compile-schemas: Improve translatable strings

See merge request GNOME/glib!678
This commit is contained in:
Sebastian Dröge 2019-06-11 11:34:05 +00:00
commit e85f1ced5f

View File

@ -1833,7 +1833,8 @@ parse_gschema_files (gchar **files,
if (strict)
{
/* Translators: Do not translate "--strict". */
fprintf (stderr, _("--strict was specified; exiting.\n"));
fprintf (stderr, "%s\n", _("--strict was specified; exiting."));
g_hash_table_unref (state.schema_table);
g_hash_table_unref (state.flags_table);
g_hash_table_unref (state.enum_table);
@ -1843,7 +1844,9 @@ parse_gschema_files (gchar **files,
return NULL;
}
else
fprintf (stderr, _("This entire file has been ignored.\n"));
{
fprintf (stderr, "%s\n", _("This entire file has been ignored."));
}
}
/* cleanup */
@ -1905,11 +1908,11 @@ set_overrides (GHashTable *schema_table,
if (!strict)
{
fprintf (stderr, _("Ignoring this file.\n"));
fprintf (stderr, "%s\n", _("Ignoring this file."));
continue;
}
fprintf (stderr, _("--strict was specified; exiting.\n"));
fprintf (stderr, "%s\n", _("--strict was specified; exiting."));
return FALSE;
}
@ -1958,17 +1961,22 @@ set_overrides (GHashTable *schema_table,
if (state == NULL)
{
fprintf (stderr, _("No such key “%s” in schema “%s” as "
"specified in override file “%s”"),
key, group, filename);
if (!strict)
{
fprintf (stderr, _("; ignoring override for this key.\n"));
fprintf (stderr, _("No such key “%s” in schema “%s” as "
"specified in override file “%s”; "
"ignoring override for this key."),
key, group, filename);
fprintf (stderr, "\n");
continue;
}
fprintf (stderr, _(" and --strict was specified; exiting.\n"));
fprintf (stderr, _("No such key “%s” in schema “%s” as "
"specified in override file “%s” and "
"--strict was specified; exiting."),
key, group, filename);
fprintf (stderr, "\n");
g_key_file_free (key_file);
g_strfreev (pieces);
g_strfreev (groups);
@ -1982,18 +1990,24 @@ set_overrides (GHashTable *schema_table,
/* Let's avoid the n*m case of per-desktop localised
* default values, and just forbid it.
*/
fprintf (stderr,
_("cannot provide per-desktop overrides for localised "
"key “%s” in schema “%s” (override file “%s”)"),
key, group, filename);
if (!strict)
{
fprintf (stderr, _("; ignoring override for this key.\n"));
fprintf (stderr,
_("Cannot provide per-desktop overrides for "
"localised key “%s” in schema “%s” (override "
"file “%s”); ignoring override for this key."),
key, group, filename);
fprintf (stderr, "\n");
continue;
}
fprintf (stderr, _(" and --strict was specified; exiting.\n"));
fprintf (stderr,
_("Cannot provide per-desktop overrides for "
"localised key “%s” in schema “%s” (override "
"file “%s”) and --strict was specified; exiting."),
key, group, filename);
fprintf (stderr, "\n");
g_key_file_free (key_file);
g_strfreev (pieces);
g_strfreev (groups);
@ -2010,21 +2024,28 @@ set_overrides (GHashTable *schema_table,
if (value == NULL)
{
fprintf (stderr, _("error parsing key “%s” in schema “%s” "
"as specified in override file “%s”: "
"%s."),
key, group, filename, error->message);
g_clear_error (&error);
g_free (string);
if (!strict)
{
fprintf (stderr, _("Ignoring override for this key.\n"));
fprintf (stderr, _("Error parsing key “%s” in schema “%s” "
"as specified in override file “%s”: "
"%s. Ignoring override for this key."),
key, group, filename, error->message);
fprintf (stderr, "\n");
g_clear_error (&error);
g_free (string);
continue;
}
fprintf (stderr, _("--strict was specified; exiting.\n"));
fprintf (stderr, _("Error parsing key “%s” in schema “%s” "
"as specified in override file “%s”: "
"%s. --strict was specified; exiting."),
key, group, filename, error->message);
fprintf (stderr, "\n");
g_clear_error (&error);
g_free (string);
g_key_file_free (key_file);
g_strfreev (pieces);
g_strfreev (groups);
@ -2038,22 +2059,29 @@ set_overrides (GHashTable *schema_table,
if (g_variant_compare (value, state->minimum) < 0 ||
g_variant_compare (value, state->maximum) > 0)
{
fprintf (stderr,
_("override for key “%s” in schema “%s” in "
"override file “%s” is outside the range "
"given in the schema"),
key, group, filename);
g_variant_unref (value);
g_free (string);
if (!strict)
{
fprintf (stderr, _("; ignoring override for this key.\n"));
fprintf (stderr,
_("Override for key “%s” in schema “%s” in "
"override file “%s” is outside the range "
"given in the schema; ignoring override "
"for this key."),
key, group, filename);
fprintf (stderr, "\n");
continue;
}
fprintf (stderr, _(" and --strict was specified; exiting.\n"));
fprintf (stderr,
_("Override for key “%s” in schema “%s” in "
"override file “%s” is outside the range "
"given in the schema and --strict was "
"specified; exiting."),
key, group, filename);
fprintf (stderr, "\n");
g_key_file_free (key_file);
g_strfreev (pieces);
g_strfreev (groups);
@ -2067,22 +2095,28 @@ set_overrides (GHashTable *schema_table,
{
if (!is_valid_choices (value, state->strinfo))
{
fprintf (stderr,
_("override for key “%s” in schema “%s” in "
"override file “%s” is not in the list "
"of valid choices"),
key, group, filename);
g_variant_unref (value);
g_free (string);
if (!strict)
{
fprintf (stderr, _("; ignoring override for this key.\n"));
fprintf (stderr,
_("Override for key “%s” in schema “%s” in "
"override file “%s” is not in the list "
"of valid choices; ignoring override for "
"this key."),
key, group, filename);
fprintf (stderr, "\n");
continue;
}
fprintf (stderr, _(" and --strict was specified; exiting.\n"));
fprintf (stderr,
_("Override for key “%s” in schema “%s” in "
"override file “%s” is not in the list "
"of valid choices and --strict was specified; "
"exiting."),
key, group, filename);
fprintf (stderr, "\n");
g_key_file_free (key_file);
g_strfreev (pieces);
g_strfreev (groups);
@ -2139,7 +2173,7 @@ main (int argc, char **argv)
gint retval;
GOptionEntry entries[] = {
{ "version", 0, 0, G_OPTION_ARG_NONE, &show_version_and_exit, N_("Show program version and exit"), NULL },
{ "targetdir", 0, 0, G_OPTION_ARG_FILENAME, &targetdir, N_("where to store the gschemas.compiled file"), N_("DIRECTORY") },
{ "targetdir", 0, 0, G_OPTION_ARG_FILENAME, &targetdir, N_("Where to store the gschemas.compiled file"), N_("DIRECTORY") },
{ "strict", 0, 0, G_OPTION_ARG_NONE, &strict, N_("Abort on any errors in schemas"), NULL },
{ "dry-run", 0, 0, G_OPTION_ARG_NONE, &dry_run, N_("Do not write the gschema.compiled file"), NULL },
{ "allow-any-name", 0, 0, G_OPTION_ARG_NONE, &allow_any_name, N_("Do not enforce key name restrictions") },
@ -2192,7 +2226,7 @@ main (int argc, char **argv)
if (!schema_files && argc != 2)
{
fprintf (stderr, _("You should give exactly one directory name\n"));
fprintf (stderr, "%s\n", _("You should give exactly one directory name"));
retval = 1;
goto done;
}
@ -2234,13 +2268,10 @@ main (int argc, char **argv)
if (files->len == 0)
{
fprintf (stdout, _("No schema files found: "));
if (g_unlink (target))
fprintf (stdout, _("doing nothing.\n"));
fprintf (stdout, "%s\n", _("No schema files found: doing nothing."));
else
fprintf (stdout, _("removed existing output file.\n"));
fprintf (stdout, "%s\n", _("No schema files found: removed existing output file."));
g_ptr_array_unref (files);
g_ptr_array_unref (overrides);