C language CLI option and enable_i18n codes
Builder C language CLI template does not include a translation-related option. However, main-cli.c behaves as if there is one, resulting in untranslated versions.
{{if enable_i18n}}
{ "version", 0, 0, G_OPTION_ARG_NONE, &version, N_("Show program version") },
{{else}}
{ "version", 0, 0, G_OPTION_ARG_NONE, &version, "Show program version" },
{{end}}
{ NULL }
};
{{if enable_i18n}}
context = g_option_context_new (_("- my command line tool"));
g_option_context_add_main_entries (context, main_entries, GETTEXT_PACKAGE);
{{else}}
context = g_option_context_new ("- my command line tool");
g_option_context_add_main_entries (context, main_entries, NULL);
{{end}}
Generated code
GOptionEntry main_entries[] = {
{ "version", 0, 0, G_OPTION_ARG_NONE, &version, "Show program version" },
{ NULL }
};
context = g_option_context_new ("- my command line tool");
Edited by Sabri Ünal