summaryrefslogtreecommitdiffstats
path: root/macosx/HBUtilities.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2016-12-14 15:15:36 +0100
committerDamiano Galassi <[email protected]>2016-12-14 15:15:36 +0100
commit14c2e61e3a4efe5ec508061b2e6bc702699662cb (patch)
treeefdda1b40038f25b637008b0c10e6be0c205f603 /macosx/HBUtilities.m
parentf5a7f690c83fa18f3ca4d4f4f196f10db76c3480 (diff)
MacGui: use the languages from the audio preferences for built-in presets, this had been broken when the MacGui started to use hb_preset_job_init().
Diffstat (limited to 'macosx/HBUtilities.m')
-rw-r--r--macosx/HBUtilities.m16
1 files changed, 16 insertions, 0 deletions
diff --git a/macosx/HBUtilities.m b/macosx/HBUtilities.m
index de3fa6b95..47cb53060 100644
--- a/macosx/HBUtilities.m
+++ b/macosx/HBUtilities.m
@@ -276,6 +276,22 @@
return [name copy];
}
++ (NSString *)isoCodeForNativeLang:(NSString *)language
+{
+ const iso639_lang_t *lang = lang_get_next(NULL);
+ for (lang = lang_get_next(lang); lang != NULL; lang = lang_get_next(lang))
+ {
+ NSString *nativeLanguage = strlen(lang->native_name) ? @(lang->native_name) : @(lang->eng_name);
+
+ if ([language isEqualToString:nativeLanguage])
+ {
+ return @(lang->iso639_2);
+ }
+ }
+
+ return nil;
+}
+
+ (NSString *)iso6392CodeFor:(NSString *)aLanguage
{
iso639_lang_t *lang = lang_for_english(aLanguage.UTF8String);