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/conf.c

    r73 r77  
    3737
    3838#include <gtk/gtk.h>
     39#include <glib/gi18n.h>
    3940
    4041#include "conf.h"
     
    7071  if(0 > (fd = open(file, O_RDWR | O_CREAT, 0666))) {
    7172    savederr = errno;
    72     *errstr = g_strdup_printf("Error opening file %s for writing:\n%s",
     73    *errstr = g_strdup_printf(_("Error opening file %s for writing:\n%s"),
    7374                              file, strerror(errno));
    7475    errno = savederr;
     
    8485    savederr = errno;
    8586    if(EAGAIN == errno)
    86       *errstr = g_strdup_printf("Another copy of %s is already running.",
     87      *errstr = g_strdup_printf(_("Another copy of %s is already running."),
    8788                                g_get_application_name());
    8889    else
    89       *errstr = g_strdup_printf("Error obtaining lock on file %s:\n%s",
     90      *errstr = g_strdup_printf(_("Error obtaining lock on file %s:\n%s"),
    9091                                file, strerror(errno));
    9192    close(fd);
     
    106107  if(0 > stat(dir, &sb)) {
    107108    if(ENOENT != errno)
    108       *errstr = g_strdup_printf("Failed to check directory %s:\n%s",
     109      *errstr = g_strdup_printf(_("Failed to check directory %s:\n%s"),
    109110                                dir, strerror(errno));
    110111    else {
     
    112113        return TRUE;
    113114      else
    114         *errstr = g_strdup_printf("Failed to create directory %s:\n%s",
     115        *errstr = g_strdup_printf(_("Failed to create directory %s:\n%s"),
    115116                                  dir, strerror(errno));
    116117    }
     
    121122    return TRUE;
    122123
    123   *errstr = g_strdup_printf("%s is not a directory", dir);
     124  *errstr = g_strdup_printf(_("%s is not a directory"), dir);
    124125  return FALSE;
    125126}
     
    155156  if(NULL != err) {
    156157    if(!g_error_matches(err, G_FILE_ERROR, G_FILE_ERROR_NOENT))
    157       *errstr = g_strdup_printf("Error opening file %s for reading:\n%s",
     158      *errstr = g_strdup_printf(_("Error opening file %s for reading:\n%s"),
    158159                                path, err->message);
    159160    goto done;
     
    166167    switch(g_io_channel_read_line(io, &line, &len, &termpos, &err)) {
    167168      case G_IO_STATUS_ERROR:
    168         *errstr = g_strdup_printf("Error reading file %s:\n%s",
     169        *errstr = g_strdup_printf(_("Error reading file %s:\n%s"),
    169170                                  path, err->message);
    170171        goto done;
     
    230231  if(0 > (fd = lockfile(tmpfile, errstr))) {
    231232    g_free(errstr);
    232     *errstr = g_strdup_printf("Error opening or locking file %s:\n%s",
     233    *errstr = g_strdup_printf(_("Error opening or locking file %s:\n%s"),
    233234                              tmpfile, strerror(errno));
    234235    goto done;
     
    250251  if(NULL != info.err ||
    251252     G_IO_STATUS_ERROR == g_io_channel_shutdown(io, TRUE, &info.err)) {
    252     *errstr = g_strdup_printf("Error writing to file %s:\n%s",
     253    *errstr = g_strdup_printf(_("Error writing to file %s:\n%s"),
    253254                              tmpfile, info.err->message);
    254255    g_error_free(info.err);
     
    257258
    258259  if(0 > rename(tmpfile, file)) {
    259     *errstr = g_strdup_printf("Error renaming %s to %s:\n%s",
     260    *errstr = g_strdup_printf(_("Error renaming %s to %s:\n%s"),
    260261                              tmpfile, file, strerror(errno));
    261262    goto done;
     
    318319  if(NULL != err) {
    319320    if(!g_error_matches(err, G_FILE_ERROR, G_FILE_ERROR_NOENT))
    320       *errstr = g_strdup_printf("Error opening file %s for reading:\n%s",
     321      *errstr = g_strdup_printf(_("Error opening file %s for reading:\n%s"),
    321322                                path, err->message);
    322323    goto done;
     
    329330    switch(g_io_channel_read_line(io, &line, &len, &termpos, &err)) {
    330331      case G_IO_STATUS_ERROR:
    331         *errstr = g_strdup_printf("Error reading file %s:\n%s",
     332        *errstr = g_strdup_printf(_("Error reading file %s:\n%s"),
    332333                                  path, err->message);
    333334        goto done;
     
    428429  if(0 > (fd = lockfile(tmpfile, errstr))) {
    429430    g_free(errstr);
    430     *errstr = g_strdup_printf("Error opening or locking file %s:\n%s",
     431    *errstr = g_strdup_printf(_("Error opening or locking file %s:\n%s"),
    431432                              tmpfile, strerror(errno));
    432433    goto done;
     
    468469  if(NULL != err ||
    469470     G_IO_STATUS_ERROR == g_io_channel_shutdown(io, TRUE, &err)) {
    470     *errstr = g_strdup_printf("Error writing to file %s:\n%s",
     471    *errstr = g_strdup_printf(_("Error writing to file %s:\n%s"),
    471472                              tmpfile, err->message);
    472473    g_error_free(err);
     
    475476
    476477  if(0 > rename(tmpfile, file)) {
    477     *errstr = g_strdup_printf("Error renaming %s to %s:\n%s",
     478    *errstr = g_strdup_printf(_("Error renaming %s to %s:\n%s"),
    478479                              tmpfile, file, strerror(errno));
    479480    goto done;
Note: See TracChangeset for help on using the changeset viewer.