fontsel: localize common font style names
This commit is contained in:
parent
0f4142b31a
commit
212df8a74e
3 changed files with 95 additions and 2 deletions
|
|
@ -889,7 +889,8 @@ gtk_font_button_update_font_info (GtkFontButton *font_button)
|
|||
if (style == NULL || !g_ascii_strcasecmp (style, "Regular"))
|
||||
family_style = g_strdup (family);
|
||||
else
|
||||
family_style = g_strdup_printf ("%s %s", family, style);
|
||||
family_style = g_strdup_printf ("%s %s", family,
|
||||
_gtk_font_style_name_translate (style));
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (font_button->priv->font_label), family_style);
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,91 @@
|
|||
|
||||
#define DEFAULT_FONT_NAME "Sans 10"
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
/* Pango uses these standard English names for common font faces.
|
||||
* Keep the msgids explicit for gettext, but only translate exact matches:
|
||||
* font-specific face names must remain untouched.
|
||||
*/
|
||||
#define FONT_STYLE_ULTRA_LIGHT N_("Ultra-Light")
|
||||
#define FONT_STYLE_LIGHT N_("Light")
|
||||
#define FONT_STYLE_MEDIUM N_("Medium")
|
||||
#define FONT_STYLE_NORMAL N_("Normal")
|
||||
#define FONT_STYLE_REGULAR N_("Regular")
|
||||
#define FONT_STYLE_ITALIC N_("Italic")
|
||||
#define FONT_STYLE_OBLIQUE N_("Oblique")
|
||||
#define FONT_STYLE_SEMI_BOLD N_("Semi-Bold")
|
||||
#define FONT_STYLE_BOLD N_("Bold")
|
||||
#define FONT_STYLE_ULTRA_BOLD N_("Ultra-Bold")
|
||||
#define FONT_STYLE_HEAVY N_("Heavy")
|
||||
#define FONT_STYLE_BOLD_ITALIC N_("Bold Italic")
|
||||
|
||||
const gchar *
|
||||
_gtk_font_style_name_translate (const gchar *name)
|
||||
{
|
||||
switch (name[0])
|
||||
{
|
||||
case 'B':
|
||||
if (strcmp (name, FONT_STYLE_BOLD) == 0)
|
||||
return _(FONT_STYLE_BOLD);
|
||||
if (strcmp (name, FONT_STYLE_BOLD_ITALIC) == 0)
|
||||
return _(FONT_STYLE_BOLD_ITALIC);
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
if (strcmp (name, FONT_STYLE_HEAVY) == 0)
|
||||
return _(FONT_STYLE_HEAVY);
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
if (strcmp (name, FONT_STYLE_ITALIC) == 0)
|
||||
return _(FONT_STYLE_ITALIC);
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
if (strcmp (name, FONT_STYLE_LIGHT) == 0)
|
||||
return _(FONT_STYLE_LIGHT);
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
if (strcmp (name, FONT_STYLE_MEDIUM) == 0)
|
||||
return _(FONT_STYLE_MEDIUM);
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
if (strcmp (name, FONT_STYLE_NORMAL) == 0)
|
||||
return _(FONT_STYLE_NORMAL);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
if (strcmp (name, FONT_STYLE_OBLIQUE) == 0)
|
||||
return _(FONT_STYLE_OBLIQUE);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
if (strcmp (name, FONT_STYLE_REGULAR) == 0)
|
||||
return _(FONT_STYLE_REGULAR);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
if (strcmp (name, FONT_STYLE_SEMI_BOLD) == 0)
|
||||
return _(FONT_STYLE_SEMI_BOLD);
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
if (strcmp (name, FONT_STYLE_ULTRA_LIGHT) == 0)
|
||||
return _(FONT_STYLE_ULTRA_LIGHT);
|
||||
if (strcmp (name, FONT_STYLE_ULTRA_BOLD) == 0)
|
||||
return _(FONT_STYLE_ULTRA_BOLD);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
#endif /* ENABLE_NLS */
|
||||
|
||||
/* This is the initial and maximum height of the preview entry (it expands
|
||||
when large font sizes are selected). Initial height is also the minimum. */
|
||||
#define INITIAL_PREVIEW_HEIGHT 44
|
||||
|
|
@ -869,7 +954,7 @@ gtk_font_selection_show_available_styles (GtkFontSelection *fontsel)
|
|||
gtk_list_store_append (model, &iter);
|
||||
gtk_list_store_set (model, &iter,
|
||||
FACE_COLUMN, faces[i],
|
||||
FACE_NAME_COLUMN, str,
|
||||
FACE_NAME_COLUMN, _gtk_font_style_name_translate (str),
|
||||
-1);
|
||||
|
||||
if (i == 0)
|
||||
|
|
|
|||
|
|
@ -134,6 +134,13 @@ const gchar *_gtk_get_data_prefix ();
|
|||
|
||||
#endif /* G_OS_WIN32 */
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
G_GNUC_INTERNAL
|
||||
const gchar *_gtk_font_style_name_translate (const gchar *name);
|
||||
#else
|
||||
#define _gtk_font_style_name_translate(name) (name)
|
||||
#endif
|
||||
|
||||
gboolean _gtk_fnmatch (const char *pattern,
|
||||
const char *string,
|
||||
gboolean no_leading_period);
|
||||
|
|
|
|||
Loading…
Reference in a new issue