forked from AuroraMiddleware/gtk
extract-strings: Deal with multiline strings
When putting out N_(...) macros, we must split multiline strings, otherwise xgettext complains.
This commit is contained in:
parent
4f65f69a60
commit
264b4bf118
@ -68,21 +68,34 @@ end_element_handler (GMarkupParseContext *context,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ParserData *data = user_data;
|
ParserData *data = user_data;
|
||||||
|
gchar **lines;
|
||||||
|
gint i;
|
||||||
|
|
||||||
if (!data->translatable)
|
if (!data->translatable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
lines = g_strsplit (data->text->str, "\n", -1);
|
||||||
|
|
||||||
if (data->comments)
|
if (data->comments)
|
||||||
g_string_append_printf (data->output, "\n/* %s */\n",
|
g_string_append_printf (data->output, "\n/* %s */\n",
|
||||||
data->comments);
|
data->comments);
|
||||||
|
|
||||||
if (data->context)
|
if (data->context)
|
||||||
g_string_append_printf (data->output, "C_(\"%s\", \"%s\")\n",
|
g_string_append_printf (data->output, "C_(\"%s\", ",
|
||||||
data->context,
|
data->context);
|
||||||
data->text->str);
|
|
||||||
else
|
else
|
||||||
g_string_append_printf (data->output, "N_(\"%s\")\n",
|
g_string_append (data->output, "N_(");
|
||||||
data->text->str);
|
|
||||||
|
for (i = 0; lines[i]; i++)
|
||||||
|
g_string_append_printf (data->output, "%s\"%s%s\"%s",
|
||||||
|
i > 0 ? " " : "",
|
||||||
|
lines[i],
|
||||||
|
lines[i+1] ? "\\n" : "",
|
||||||
|
lines[i+1] ? "\n" : "");
|
||||||
|
|
||||||
|
g_string_append (data->output, ");\n");
|
||||||
|
|
||||||
|
g_strfreev (lines);
|
||||||
|
|
||||||
g_free (data->comments);
|
g_free (data->comments);
|
||||||
g_free (data->context);
|
g_free (data->context);
|
||||||
|
Loading…
Reference in New Issue
Block a user