# List of source files which contain translatable strings.
+src/commons.c
src/form.c
src/formelement.c
+src/formelementfilter.c
+src/formelementfilterluc.c
+src/formelementfiltertrim.c
src/formelementvalidator.c
+src/formelementvalidatordate.c
+src/formelementvalidatornotempty.c
+src/formelementvalidatorregex.c
+src/formiprovider.c
src/formvalidator.c
src/formvalidatorcompare.c
src/formvalidatorcomparedate.c
# libzakform italian translation
-# Copyright (C) 2015-2016 Andrea Zagli
+# Copyright (C) 2015-2017 Andrea Zagli
# This file is distributed under the same license as the libzakform package.
-# Andrea Zagli <azagli@libero.it>, 2015-2016.
+# Andrea Zagli <azagli@libero.it>, 2015-2017.
#
msgid ""
msgstr ""
"Project-Id-Version: libzakform 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2016-01-02 17:48+0100\n"
+"POT-Creation-Date: 2017-05-01 09:58+0200\n"
"PO-Revision-Date: 2016-01-02 12:44+0200\n"
"Last-Translator: Andrea Zagli <azagli@libero.it>\n"
"Language-Team: Italian <tp@lists.linux.it>\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-#: ../src/form.c:336
+#: ../src/commons.c:89
+msgid "lesser than"
+msgstr "minore di"
+
+#: ../src/commons.c:93
+msgid "lesser or equal to"
+msgstr "minore o uguale a"
+
+#: ../src/commons.c:97
+msgid "equal to"
+msgstr "uguale a"
+
+#: ../src/commons.c:101
+msgid "different from"
+msgstr "diverso da"
+
+#: ../src/commons.c:105
+msgid "greater than"
+msgstr "maggiore di"
+
+#: ../src/commons.c:109
+msgid "greater or equal to"
+msgstr "maggiore o uguale a"
+
+#: ../src/commons.c:113
+msgid "NOT SUPPORTED"
+msgstr "NON SUPPORTATO"
+
+#: ../src/form.c:383
#, c-format
msgid "Unknown element type «%s»."
msgstr "Tipo elemento «%s» sconosciuto."
-#: ../src/form.c:380
+#: ../src/form.c:428
msgid "The file is not a valid ZakForm definition file."
msgstr "Il file non è un file di definizione valido di ZakForm."
-#: ../src/form.c:832
+#: ../src/form.c:998
msgid "Unable to load module of myself"
msgstr "Impossibile caricare i moduli di me stesso"
-#: ../src/form.c:862
+#: ../src/form.c:1028
#, c-format
msgid "Unable to load %s: %s."
msgstr "Impossibile caricare %s: %s."
-#: ../src/form.c:870
+#: ../src/form.c:1036
#, c-format
msgid "Unable to open modules dir: %s."
msgstr "Impossibile aprire la directory dei moduli: %s."
-#: ../src/form.c:871
+#: ../src/form.c:1037
msgid "no details"
msgstr "nessun dettaglio"
-#: ../src/form.c:876
+#: ../src/form.c:1042
msgid "Modules not supported by this operating system."
msgstr "I moduli non sono supportati in questo sistema operativo"
-#: ../src/formelementvalidator.c:67
+#: ../src/formelementvalidator.c:87 ../src/formvalidator.c:87
msgid "Invalid value"
msgstr "Valore non valido"
-#: ../src/formvalidatorcomparedate.c:107
-msgid "lesser than"
-msgstr "minore di"
-
-#: ../src/formvalidatorcomparedate.c:108
-msgid "lesser or equal to"
-msgstr "minore o uguale a"
-
-#: ../src/formvalidatorcomparedate.c:109
-msgid "equal to"
-msgstr "uguale a"
-
-#: ../src/formvalidatorcomparedate.c:110
-msgid "different from"
-msgstr "diverso da"
-
-#: ../src/formvalidatorcomparedate.c:111
-msgid "greater than"
-msgstr "maggiore di"
-
-#: ../src/formvalidatorcomparedate.c:112
-msgid "greater or equal to"
-msgstr "maggiore o uguale a"
-
-#: ../src/formvalidatorcomparedate.c:318
+#: ../src/formvalidatorcompare.c:253 ../src/formvalidatorcomparedate.c:266
#, c-format
msgid "«%s» must be %s «%s»"
msgstr "«%s» deve essere %s «%s»"
#include "commons.h"
+
+/**
+ * zak_form_get_compare_type_from_string:
+ * @str:
+ *
+ * Returns: the #ZakFormCompareType from @str.
+ */
+ZakFormCompareType
+zak_form_get_compare_type_from_string (const gchar *str)
+{
+ ZakFormCompareType ret;
+
+ if (g_strcmp0 (str, "lt") == 0)
+ {
+ ret = ZAK_FORM_COMPARE_TYPE_LESSER;
+ }
+ else if (g_strcmp0 (str, "let") == 0)
+ {
+ ret = ZAK_FORM_COMPARE_TYPE_LESSER_EQUAL;
+ }
+ else if (g_strcmp0 (str, "e") == 0)
+ {
+ ret = ZAK_FORM_COMPARE_TYPE_EQUAL;
+ }
+ else if (g_strcmp0 (str, "ne") == 0)
+ {
+ ret = ZAK_FORM_COMPARE_TYPE_NOT_EQUAL;
+ }
+ else if (g_strcmp0 (str, "gt") == 0)
+ {
+ ret = ZAK_FORM_COMPARE_TYPE_GREATER;
+ }
+ else if (g_strcmp0 (str, "get") == 0)
+ {
+ ret = ZAK_FORM_COMPARE_TYPE_GREATER_EQUAL;
+ }
+ else
+ {
+ g_warning ("Compare type «%s» not supported.", str);
+ }
+
+ return ret;
+}
+
+/**
+ * zak_form_get_compare_type_stringify:
+ * @type:
+ *
+ * Returns: the stringify version of #ZakFormCompareType.
+ */
+const gchar
+*zak_form_get_compare_type_stringify (ZakFormCompareType type)
+{
+ const gchar *ret;
+
+ switch (type)
+ {
+ case ZAK_FORM_COMPARE_TYPE_LESSER:
+ ret = _("lesser than");
+ break;
+
+ case ZAK_FORM_COMPARE_TYPE_LESSER_EQUAL:
+ ret = _("lesser or equal to");
+ break;
+
+ case ZAK_FORM_COMPARE_TYPE_EQUAL:
+ ret = _("equal to");
+ break;
+
+ case ZAK_FORM_COMPARE_TYPE_NOT_EQUAL:
+ ret = _("different from");
+ break;
+
+ case ZAK_FORM_COMPARE_TYPE_GREATER:
+ ret = _("greater than");
+ break;
+
+ case ZAK_FORM_COMPARE_TYPE_GREATER_EQUAL:
+ ret = _("greater or equal to");
+ break;
+
+ default:
+ ret = _("NOT SUPPORTED");
+ break;
+ }
+
+ return ret;
+}
+
/**
* zak_form_get_element_by_id:
* @ar_elements:
G_BEGIN_DECLS
+typedef enum
+ {
+ ZAK_FORM_COMPARE_TYPE_LESSER,
+ ZAK_FORM_COMPARE_TYPE_LESSER_EQUAL,
+ ZAK_FORM_COMPARE_TYPE_EQUAL,
+ ZAK_FORM_COMPARE_TYPE_NOT_EQUAL,
+ ZAK_FORM_COMPARE_TYPE_GREATER,
+ ZAK_FORM_COMPARE_TYPE_GREATER_EQUAL
+ } ZakFormCompareType;
+
+ZakFormCompareType zak_form_get_compare_type_from_string (const gchar *str);
+const gchar *zak_form_get_compare_type_stringify (ZakFormCompareType type);
ZakFormElement *zak_form_get_element_by_id (GPtrArray *ar_elements, const gchar *id);
static void zak_form_element_validator_date_init (ZakFormElementValidatorDate *zak_form_element);
static void zak_form_element_validator_date_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void zak_form_element_validator_date_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
static void zak_form_element_validator_date_dispose (GObject *gobject);
static void zak_form_element_validator_date_finalize (GObject *gobject);
/* PRIVATE */
static void
zak_form_element_validator_date_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
ZakFormElementValidatorDate *zak_form_element = (ZakFormElementValidatorDate *)object;
ZakFormElementValidatorDatePrivate *priv = ZAK_FORM_ELEMENT_VALIDATOR_DATE_GET_PRIVATE (zak_form_element);
static void
zak_form_element_validator_date_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
ZakFormElementValidatorDate *zak_form_element = (ZakFormElementValidatorDate *)object;
ZakFormElementValidatorDatePrivate *priv = ZAK_FORM_ELEMENT_VALIDATOR_DATE_GET_PRIVATE (zak_form_element);
static gboolean
zak_form_element_validator_date_validate (ZakFormElementValidator *validator_date,
- const gchar *value)
+ const gchar *value)
{
gboolean ret;
gchar *_value;
#define ZAK_FORM_VALIDATOR_COMPARE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_FORM_TYPE_VALIDATOR_COMPARE, ZakFormValidatorComparePrivate))
-enum
- {
- LESSER,
- LESSER_EQUAL,
- EQUAL,
- NOT_EQUAL,
- GREATER,
- GREATER_EQUAL
- };
-
-static gchar *msgs[6];
-
typedef struct _ZakFormValidatorComparePrivate ZakFormValidatorComparePrivate;
struct _ZakFormValidatorComparePrivate
{
priv->v1 = NULL;
priv->v2 = NULL;
-
- msgs[0] = _("lesser than");
- msgs[1] = _("lesser or equal to");
- msgs[2] = _("equal to");
- msgs[3] = _("different from");
- msgs[4] = _("greater than");
- msgs[5] = _("greater or equal to");
}
/**
ZakFormValidatorComparePrivate *priv = ZAK_FORM_VALIDATOR_COMPARE_GET_PRIVATE (validator);
prop = (gchar *)xmlGetProp (xnode, (const xmlChar *)"type_comp");
- if (g_strcmp0 (prop, "lt") == 0)
- {
- priv->type = LESSER;
- }
- else if (g_strcmp0 (prop, "let") == 0)
- {
- priv->type = LESSER_EQUAL;
- }
- else if (g_strcmp0 (prop, "e") == 0)
- {
- priv->type = EQUAL;
- }
- else if (g_strcmp0 (prop, "ne") == 0)
- {
- priv->type = NOT_EQUAL;
- }
- else if (g_strcmp0 (prop, "gt") == 0)
- {
- priv->type = GREATER;
- }
- else if (g_strcmp0 (prop, "get") == 0)
- {
- priv->type = GREATER_EQUAL;
- }
- else
- {
- g_warning ("Validator compare: compare type «%s» not supported.", prop);
- }
+ priv->type = zak_form_get_compare_type_from_string (prop);
g_free (prop);
prop = (gchar *)xmlGetProp (xnode, (const xmlChar *)"element1");
/* PRIVATE */
static void
zak_form_validator_compare_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
ZakFormValidatorCompare *validator = (ZakFormValidatorCompare *)object;
ZakFormValidatorComparePrivate *priv = ZAK_FORM_VALIDATOR_COMPARE_GET_PRIVATE (validator);
static void
zak_form_validator_compare_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
ZakFormValidatorCompare *validator = (ZakFormValidatorCompare *)object;
ZakFormValidatorComparePrivate *priv = ZAK_FORM_VALIDATOR_COMPARE_GET_PRIVATE (validator);
comp = g_strcmp0 (gc1, gc2);
if (comp < 0)
{
- ret = (priv->type == LESSER
- || priv->type == LESSER_EQUAL
- || priv->type == NOT_EQUAL);
+ ret = (priv->type == ZAK_FORM_COMPARE_TYPE_LESSER
+ || priv->type == ZAK_FORM_COMPARE_TYPE_LESSER_EQUAL
+ || priv->type == ZAK_FORM_COMPARE_TYPE_NOT_EQUAL);
}
else if (comp == 0)
{
- ret = (priv->type == LESSER_EQUAL
- || priv->type == EQUAL
- || priv->type == GREATER_EQUAL);
+ ret = (priv->type == ZAK_FORM_COMPARE_TYPE_LESSER_EQUAL
+ || priv->type == ZAK_FORM_COMPARE_TYPE_EQUAL
+ || priv->type == ZAK_FORM_COMPARE_TYPE_GREATER_EQUAL);
}
else if (comp > 0)
{
- ret = (priv->type == GREATER
- || priv->type == GREATER_EQUAL
- || priv->type == NOT_EQUAL);
+ ret = (priv->type == ZAK_FORM_COMPARE_TYPE_GREATER
+ || priv->type == ZAK_FORM_COMPARE_TYPE_GREATER_EQUAL
+ || priv->type == ZAK_FORM_COMPARE_TYPE_NOT_EQUAL);
};
if (!ret)
{
msg = g_strdup_printf (_("«%s» must be %s «%s»"),
zak_form_element_get_long_name (priv->v1),
- msgs[priv->type],
+ zak_form_get_compare_type_stringify (priv->type),
zak_form_element_get_long_name (priv->v2));
zak_form_validator_set_message (validator, msg);
g_free (msg);
#define ZAK_FORM_VALIDATOR_COMPARE_DATE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_FORM_TYPE_VALIDATOR_COMPARE_DATE, ZakFormValidatorCompareDatePrivate))
-enum
- {
- LESSER,
- LESSER_EQUAL,
- EQUAL,
- NOT_EQUAL,
- GREATER,
- GREATER_EQUAL
- };
-
-static gchar *msgs[6];
-
typedef struct _ZakFormValidatorCompareDatePrivate ZakFormValidatorCompareDatePrivate;
struct _ZakFormValidatorCompareDatePrivate
{
priv->v1 = NULL;
priv->v2 = NULL;
-
- msgs[0] = _("lesser than");
- msgs[1] = _("lesser or equal to");
- msgs[2] = _("equal to");
- msgs[3] = _("different from");
- msgs[4] = _("greater than");
- msgs[5] = _("greater or equal to");
}
/**
ZakFormValidatorCompareDatePrivate *priv = ZAK_FORM_VALIDATOR_COMPARE_DATE_GET_PRIVATE (validator);
- prop = xmlGetProp (xnode, (const xmlChar *)"type_comp");
- if (g_strcmp0 (prop, "lt") == 0)
- {
- priv->type = LESSER;
- }
- else if (g_strcmp0 (prop, "let") == 0)
- {
- priv->type = LESSER_EQUAL;
- }
- else if (g_strcmp0 (prop, "e") == 0)
- {
- priv->type = EQUAL;
- }
- else if (g_strcmp0 (prop, "ne") == 0)
- {
- priv->type = NOT_EQUAL;
- }
- else if (g_strcmp0 (prop, "gt") == 0)
- {
- priv->type = GREATER;
- }
- else if (g_strcmp0 (prop, "get") == 0)
- {
- priv->type = GREATER_EQUAL;
- }
+ prop = (gchar *)xmlGetProp (xnode, (const xmlChar *)"type_comp");
+ priv->type = zak_form_get_compare_type_from_string (prop);
+ g_free (prop);
- prop = xmlGetProp (xnode, (const xmlChar *)"element1");
+ prop = (gchar *)xmlGetProp (xnode, (const xmlChar *)"element1");
priv->v1 = zak_form_get_element_by_id (ar_elements, prop);
+ g_free (prop);
- prop = xmlGetProp (xnode, (const xmlChar *)"element2");
+ prop = (gchar *)xmlGetProp (xnode, (const xmlChar *)"element2");
priv->v2 = zak_form_get_element_by_id (ar_elements, prop);
+ g_free (prop);
- prop = xmlGetProp (xnode, (const xmlChar *)"format1");
+ prop = (gchar *)xmlGetProp (xnode, (const xmlChar *)"format1");
priv->format1 = g_strdup (prop);
+ g_free (prop);
- prop = xmlGetProp (xnode, (const xmlChar *)"format2");
+ prop = (gchar *)xmlGetProp (xnode, (const xmlChar *)"format2");
priv->format2 = g_strdup (prop);
+ g_free (prop);
return TRUE;
}
switch (comp)
{
case -1:
- ret = (priv->type == LESSER
- || priv->type == LESSER_EQUAL
- || priv->type == NOT_EQUAL);
+ ret = (priv->type == ZAK_FORM_COMPARE_TYPE_LESSER
+ || priv->type == ZAK_FORM_COMPARE_TYPE_LESSER_EQUAL
+ || priv->type == ZAK_FORM_COMPARE_TYPE_NOT_EQUAL);
break;
case 0:
- ret = (priv->type == LESSER_EQUAL
- || priv->type == EQUAL
- || priv->type == GREATER_EQUAL);
+ ret = (priv->type == ZAK_FORM_COMPARE_TYPE_LESSER_EQUAL
+ || priv->type == ZAK_FORM_COMPARE_TYPE_EQUAL
+ || priv->type == ZAK_FORM_COMPARE_TYPE_GREATER_EQUAL);
break;
case 1:
- ret = (priv->type == GREATER
- || priv->type == GREATER_EQUAL
- || priv->type == NOT_EQUAL);
+ ret = (priv->type == ZAK_FORM_COMPARE_TYPE_GREATER
+ || priv->type == ZAK_FORM_COMPARE_TYPE_GREATER_EQUAL
+ || priv->type == ZAK_FORM_COMPARE_TYPE_NOT_EQUAL);
break;
};
}
{
msg = g_strdup_printf (_("«%s» must be %s «%s»"),
zak_form_element_get_long_name (priv->v1),
- msgs[priv->type],
+ zak_form_get_compare_type_stringify (priv->type),
zak_form_element_get_long_name (priv->v2));
zak_form_validator_set_message (validator, msg);
g_free (msg);