Changeset 5291


Ignore:
Timestamp:
Mar 18, 2008, 7:18:22 PM (14 years ago)
Author:
livings124
Message:

Put in function for localization (as suggested on the cocoa dev list) and comment it out because i can't get it working as desired yet.

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/utils.c

    r5286 r5291  
    6161}
    6262
     63/*
     64#if defined(SYS_DARWIN)
     65
     66const char * tr_getMacLocalizedCString(CFStringRef string)
     67{
     68    //if you need to be thread safe, add proper locks around that
     69    static CFMutableDictionaryRef mapping = NULL;
     70    if( mapping == NULL )
     71    {
     72        mapping = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, NULL);
     73    }
     74   
     75    const char * result = (const char *)CFDictionaryGetValue(mapping, string);
     76    if( result == NULL )
     77    {
     78        CFStringRef localizedString = CFCopyLocalizedStringFromTable(string, CFSTR("LibraryLocalizable"), NULL);
     79        result = (const char *)malloc(CFStringGetMaximumSizeForEncoding(CFStringGetLength(localizedString), kCFStringEncodingUTF8));
     80        CFStringGetCString(localizedString, (char *)result, CFStringGetLength(localizedString)+1, kCFStringEncodingUTF8);
     81        CFDictionarySetValue(mapping, string, result);
     82    }
     83   
     84    return result;
     85}
     86
     87#endif
     88*/
     89
    6390FILE*
    6491tr_getLog( void )
  • trunk/libtransmission/utils.h

    r5243 r5291  
    3535#if !defined(_)
    3636#if defined(SYS_DARWIN)
    37   #include <CoreFoundation/CFBundle.h>
    38   #define _(a) CFStringGetCStringPtr(CFCopyLocalizedStringFromTable( \
    39                CFSTR( a ), CFSTR("LibraryLocalizable"), "comment" ), kCFStringEncodingMacRoman)
     37  /*#include <CoreFoundation/CFBundle.h>
     38 
     39  const char * tr_getMacLocalizedCString(CFStringRef string);
     40 
     41  #define _(a) tr_getMacLocalizedCString(CFSTR(a))*/
     42  #define _(a) (a)
    4043#else
    4144  #include <libintl.h>
Note: See TracChangeset for help on using the changeset viewer.