Avoid using LC_MESSAGES, and just call g_d[c]gettext directly.
Bug #617004.
N_
NC_
g_dgettext
+g_dcgettext
g_dngettext
g_dpgettext
g_dpgettext2
const gchar *translated;
GError *error = NULL;
const gchar *domain;
- gint lc_category;
domain = g_settings_schema_get_gettext_domain (settings->priv->schema);
if (lc_char == 't')
- lc_category = LC_TIME;
+ translated = g_dcgettext (domain, unparsed, LC_TIME);
else
- lc_category = LC_MESSAGES;
-
- translated = dcgettext (domain, unparsed, lc_category);
+ translated = g_dgettext (domain, unparsed);
if (translated != unparsed)
/* it was translated, so we need to re-parse it */
g_strv_length
g_strip_context G_GNUC_FORMAT(1)
g_dgettext G_GNUC_FORMAT(2)
+g_dcgettext G_GNUC_FORMAT(2)
g_dngettext G_GNUC_FORMAT(3)
g_dpgettext G_GNUC_FORMAT(2)
g_dpgettext2 G_GNUC_FORMAT(3)
}
/**
+ * g_dgettext:
+ * @domain: (allow-none): the translation domain to use, or %NULL to use
+ * the domain set with textdomain()
+ * @msgid: message to translate
+ * @category: a locale category
+ *
+ * This is a variant of g_dgettext() that allows specifying a locale
+ * category instead of always using %LC_MESSAGES. See g_dgettext() for
+ * more information about how this functions differs from calling
+ * dcgettext() directly.
+ *
+ * Returns: the translated string for the given locale category
+ *
+ * Since: 2.26
+ */
+G_CONST_RETURN gchar *
+g_dcgettext (const gchar *domain,
+ const gchar *msgid,
+ int category)
+{
+ if (domain && G_UNLIKELY (!_g_dgettext_should_translate ()))
+ return msgid;
+
+ return dcgettext (domain, msgid, category);
+}
+
+/**
* g_dngettext:
* @domain: the translation domain to use, or %NULL to use
* the domain set with textdomain()
G_CONST_RETURN gchar *g_dgettext (const gchar *domain,
const gchar *msgid) G_GNUC_FORMAT(2);
-
+G_CONST_RETURN gchar *g_dcgettext (const gchar *domain,
+ const gchar *msgid,
+ int category) G_GNUC_FORMAT(2);
G_CONST_RETURN gchar *g_dngettext (const gchar *domain,
const gchar *msgid,
const gchar *msgid_plural,
--add-comments --keyword=_ --keyword=N_ \
--keyword=C_:1c,2 \
--keyword=NC_:1c,2 \
+ --keyword=g_dcgettext:2 \
--keyword=g_dngettext:2,3 \
+ --keyword=g_dpgettext2:2c,3 \
--flag=N_:1:pass-c-format \
--flag=C_:2:pass-c-format \
--flag=NC_:2:pass-c-format \