// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // Contains utilities for converting language codes. // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrake.Interop { using System.Collections.Generic; using HbLib; /// /// Contains utilities for converting language codes. /// public static class Languages { /// /// The list of all languages. /// private static IList allLanguages; /// /// Gets a list of all languages. /// public static IList AllLanguages { get { if (allLanguages == null) { allLanguages = InteropUtilities.GetListFromIterator( HBFunctions.lang_get_next, Converters.NativeToLanguage); } return allLanguages; } } /// /// Gets the language object for the given code. /// /// The ISO-639-2 code for the language. /// Object that describes the language. public static Language Get(string code) { iso639_lang_t language = InteropUtilities.ReadStructure(HBFunctions.lang_for_code2(code)); return Converters.NativeToLanguage(language); } } }