summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-01-18 23:21:06 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-01-18 23:21:06 +0000
commitca6732953f5f5470572548e3c8cd08b8e6790372 (patch)
treedf9dc9be4eb340f86c180d0f2e95d677f4a07b81
parentf3c30cc0ad9c33efed76da88003e883c7d86e938 (diff)
(OS X only) grab user's language pref from cocoa and push it as LANGUAGE environment variable
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6516 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/main.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc
index 98f06d18fd..3752a67d35 100644
--- a/gtk2_ardour/main.cc
+++ b/gtk2_ardour/main.cc
@@ -73,6 +73,27 @@ fixup_bundle_environment ()
return;
}
+ /* pull user's language preference from Cocoa and push
+ it into the environment. Thanks to Bjorn Winckler for
+ this code.
+ */
+
+ NSArray *languages = [NSLocale preferredLanguages];
+ if (languages && [languages count] > 0) {
+ int i, count = [languages count];
+ for (i = 0; i < count; ++i) {
+ if ([[languages objectAtIndex:i]
+ isEqualToString:@"en"]) {
+ count = i+1;
+ break;
+ }
+ }
+ NSRange r = { 0, count };
+ NSString *s = [[languages subarrayWithRange:r]
+ componentsJoinedByString:@":"];
+ setenv("LANGUAGE", [s UTF8String], 0);
+ }
+
char execpath[MAXPATHLEN+1];
uint32_t pathsz = sizeof (execpath);