Ignore:
Timestamp:
Jan 31, 2006, 7:54:07 AM (15 years ago)
Author:
joshe
Message:

Add internationalization support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/joshe/gtk/util.c

    r24 r77  
    3333
    3434#include <gtk/gtk.h>
     35#include <glib/gi18n.h>
    3536
    3637#include "util.h"
     
    5960}
    6061
     62static const char *sizestrs[] = {
     63  N_("B"), N_("KiB"), N_("MiB"), N_("GiB"), N_("TiB"), N_("PiB"), N_("EiB"),
     64};
     65
    6166char *
    6267readablesize(guint64 size, int decimals) {
    63   const char *sizes[] = {"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"};
    6468  unsigned int ii;
    6569  double small = size;
    6670
    67   for(ii = 0; ii + 1 < ALEN(sizes) && 1024.0 <= small / 1024.0; ii++)
     71  for(ii = 0; ii + 1 < ALEN(sizestrs) && 1024.0 <= small / 1024.0; ii++)
    6872    small /= 1024.0;
    6973
     
    7377  }
    7478
    75   return g_strdup_printf("%.*f %s", decimals, small, sizes[ii]);
     79  return g_strdup_printf("%.*f %s", decimals, small, gettext(sizestrs[ii]));
    7680}
    7781
Note: See TracChangeset for help on using the changeset viewer.