Re: [PATCH v3 28/39] i18n: config: unfold error messages marked for translation
Vasco Almeida <vascomalmeida@sapo.pt> writes:
Show 7 quoted lines
> Introduced in 473166b ("config: add 'origin_type' to config_source
> struct", 2016-02-19), Git can inform the user about the origin of a
> config error, but the implementation does not allow translators to
> translate the keywords 'file', 'blob, 'standard input', and
> 'submodule-blob'. Moreover, for the second message, a reason for the
> error is appended to the message, not allowing translators to translate
> that reason either.Show 18 quoted lines
> @@ -417,6 +417,7 @@ static int git_parse_source(config_fn_t fn, void *data)
> int comment = 0;
> int baselen = 0;
> struct strbuf *var = &cf->var;
> + char error_msg[128];
>
> /* U+FEFF Byte Order Mark in UTF8 */
> const char *bomptr = utf8_bom;
> @@ -471,10 +472,38 @@ static int git_parse_source(config_fn_t fn, void *data)
> if (get_value(fn, data, var) < 0)
> break;
> }
> +
> + switch (cf->origin_type) {
> + case CFG_BLOB:
> + xsnprintf(error_msg, sizeof(error_msg),
> + _("bad config line %d in blob %s"),
> + cf->linenr, cf->name);Use xstrfmt() intead, perhaps? That would be cleaner.