Step 1 of X in getting translations working on the mac.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9835 4a71c877-e1ca-e34f-864e-861f7616d084
master
dak180 2010-02-16 22:49:05 +00:00 committed by Git SVN Gateway
parent e943eb0ff7
commit a3f8200327
1 changed files with 22 additions and 0 deletions

View File

@ -23,6 +23,10 @@
#include "string_ext.h"
#ifdef WZ_OS_MAC
# include <CoreFoundation/CoreFoundation.h>
# include <CoreFoundation/CFURL.h>
#endif
/* Always use fallbacks on Windows */
#if defined(WZ_OS_WIN)
@ -348,7 +352,25 @@ void initI18n(void)
textdomainDirectory = bindtextdomain(PACKAGE, localeDir);
}
#else
#ifdef WZ_OS_MAC
{
char resourcePath[PATH_MAX];
CFURLRef resourceURL = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
if( CFURLGetFileSystemRepresentation( resourceURL, true, (UInt8 *) resourcePath, PATH_MAX) )
{
sstrcat(resourcePath, "/locale");
textdomainDirectory = bindtextdomain(PACKAGE, resourcePath);
}
else
{
debug( LOG_ERROR, "Could not change to resources directory." );
}
debug(LOG_INFO, "resourcePath is %s", resourcePath);
}
#else
textdomainDirectory = bindtextdomain(PACKAGE, LOCALEDIR);
#endif
#endif
if (!textdomainDirectory)
{