Issue #434: remove broken plural support for GimpUnit.

Rather than trying to implement full i18n plural support, we just remove
this failed attempt from the past. The fact is that to get proper
support, we'd basically need to reimplement a Gettext-like plural
definition syntax within our API, then ask people to write down this
plural definition for their language, then to write every plural form…
all this for custom units which only them will ever see!

Moreover code investigation shows that the singular form was simply
never used, and the plural form was always used (whatever the actual
unit value displayed).

As for the "identifier", this was a text which was never shown anywhere
(except in the unit editor) and for all built-in units, as well as
default unitrc units, it was equivalent to the English plural value.

So we now just have a unique name which is the "long label" to be used
everywhere in the GUI, and abbreviation will be basically the "short
label". That's it. No useless (or worse, not actually usable because it
was not generic internationalization) values anymore!
This commit is contained in:
Jehan 2024-08-05 16:02:47 +02:00
parent a9af5509ab
commit 2a00a9e60a
34 changed files with 196 additions and 412 deletions

View file

@ -484,7 +484,7 @@ gimp_query_size_box (const gchar *title,
if (! query_box)
return NULL;
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 12,
sizeentry = gimp_size_entry_new (1, unit, "%n", TRUE, FALSE, FALSE, 12,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
if (dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), gimp_unit_pixel ());

View file

@ -407,12 +407,7 @@ gimp_size_entry_new (gint number_of_fields,
gchar *short_format = g_strdup (unit_format);
gchar *p;
p = strstr (short_format, "%s");
if (p)
strcpy (p, "%a");
p = strstr (short_format, "%p");
if (p)
while ((p = strstr (short_format, "%n")))
strcpy (p, "%a");
g_object_set (store,

View file

@ -128,8 +128,6 @@ static GType column_types[GIMP_UNIT_STORE_UNIT_COLUMNS] =
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING
};
@ -191,7 +189,7 @@ gimp_unit_store_init (GimpUnitStore *store)
private->has_pixels = TRUE;
private->has_percent = FALSE;
private->short_format = g_strdup ("%a");
private->long_format = g_strdup ("%p");
private->long_format = g_strdup ("%n");
private->synced_ID = 0;
}
@ -442,8 +440,8 @@ gimp_unit_store_tree_model_get_value (GtkTreeModel *tree_model,
case GIMP_UNIT_STORE_UNIT_DIGITS:
g_value_set_int (value, gimp_unit_get_digits (unit));
break;
case GIMP_UNIT_STORE_UNIT_IDENTIFIER:
g_value_set_static_string (value, gimp_unit_get_identifier (unit));
case GIMP_UNIT_STORE_UNIT_NAME:
g_value_set_static_string (value, gimp_unit_get_name (unit));
break;
case GIMP_UNIT_STORE_UNIT_SYMBOL:
g_value_set_static_string (value, gimp_unit_get_symbol (unit));
@ -451,12 +449,6 @@ gimp_unit_store_tree_model_get_value (GtkTreeModel *tree_model,
case GIMP_UNIT_STORE_UNIT_ABBREVIATION:
g_value_set_static_string (value, gimp_unit_get_abbreviation (unit));
break;
case GIMP_UNIT_STORE_UNIT_SINGULAR:
g_value_set_static_string (value, gimp_unit_get_singular (unit));
break;
case GIMP_UNIT_STORE_UNIT_PLURAL:
g_value_set_static_string (value, gimp_unit_get_plural (unit));
break;
case GIMP_UNIT_STORE_UNIT_SHORT_FORMAT:
g_value_take_string (value,
gimp_unit_format_string (private->short_format,

View file

@ -34,11 +34,9 @@ enum
GIMP_UNIT_STORE_UNIT,
GIMP_UNIT_STORE_UNIT_FACTOR,
GIMP_UNIT_STORE_UNIT_DIGITS,
GIMP_UNIT_STORE_UNIT_IDENTIFIER,
GIMP_UNIT_STORE_UNIT_NAME,
GIMP_UNIT_STORE_UNIT_SYMBOL,
GIMP_UNIT_STORE_UNIT_ABBREVIATION,
GIMP_UNIT_STORE_UNIT_SINGULAR,
GIMP_UNIT_STORE_UNIT_PLURAL,
GIMP_UNIT_STORE_UNIT_SHORT_FORMAT,
GIMP_UNIT_STORE_UNIT_LONG_FORMAT,
GIMP_UNIT_STORE_UNIT_COLUMNS,