diff options
author | Damiano Galassi <[email protected]> | 2016-03-14 09:50:42 +0100 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2016-03-14 09:50:50 +0100 |
commit | d961c289a20d9e2e84fd8c763baa1c6abdb4b414 (patch) | |
tree | 0a39d5d4208cf3bf9a1e5e6d137d661a2296725d /macosx/HBUtilities.m | |
parent | ee4ae6d3a0aa6d06b7a5aedec7e88570c868b8a8 (diff) |
MacGui: added some enum to HBJob model to make things nicer in swift, plus two methods to convert from iso code to english language.
Diffstat (limited to 'macosx/HBUtilities.m')
-rw-r--r-- | macosx/HBUtilities.m | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/macosx/HBUtilities.m b/macosx/HBUtilities.m index 46f1aae03..de3fa6b95 100644 --- a/macosx/HBUtilities.m +++ b/macosx/HBUtilities.m @@ -11,6 +11,7 @@ #import "HBJob.h" #include "common.h" +#include "lang.h" @implementation HBUtilities @@ -275,5 +276,24 @@ return [name copy]; } ++ (NSString *)iso6392CodeFor:(NSString *)aLanguage +{ + iso639_lang_t *lang = lang_for_english(aLanguage.UTF8String); + if (lang) + { + return @(lang->iso639_2); + } + return @"und"; +} + ++ (NSString *)languageCodeForIso6392Code:(NSString *)aLanguage +{ + iso639_lang_t *lang = lang_for_code2(aLanguage.UTF8String); + if (lang) + { + return @(lang->eng_name); + } + return @"Unknown"; +} @end |