// --------------------------------------------------------------------------------------------------------------------
//
// 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.ApplicationServices.Interop
{
using System.Collections.Generic;
using HandBrake.ApplicationServices.Interop.HbLib;
using HandBrake.ApplicationServices.Interop.Helpers;
using HandBrake.ApplicationServices.Interop.Model;
///
/// Contains utilities for converting language codes.
///
public static class HandBrakeLanguagesHelper
{
///
/// The list of all languages.
///
private static IList allLanguages;
///
/// Gets a list of all languages.
///
public static IList AllLanguages
{
get
{
return allLanguages
?? (allLanguages =
InteropUtilities.ToListFromIterator(HBFunctions.lang_get_next, HandBrakeUnitConversionHelpers.NativeToLanguage));
}
}
///
/// 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.ToStructureFromPtr(HBFunctions.lang_for_code2(code));
return HandBrakeUnitConversionHelpers.NativeToLanguage(language);
}
}
}