blob: f8d3db6242691567d425d624ceb796ed2053a624 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="LanguageCodes.cs" company="HandBrake Project (http://handbrake.fr)">
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
// </copyright>
// <summary>
// Contains utilities for converting language codes.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrake.Interop
{
using System.Collections.Generic;
using HbLib;
/// <summary>
/// Contains utilities for converting language codes.
/// </summary>
public static class Languages
{
/// <summary>
/// The list of all languages.
/// </summary>
private static IList<Language> allLanguages;
/// <summary>
/// Gets a list of all languages.
/// </summary>
public static IList<Language> AllLanguages
{
get
{
if (allLanguages == null)
{
allLanguages = InteropUtilities.GetListFromIterator<iso639_lang_t, Language>(
HBFunctions.lang_get_next,
Converters.NativeToLanguage);
}
return allLanguages;
}
}
/// <summary>
/// Gets the language object for the given code.
/// </summary>
/// <param name="code">The ISO-639-2 code for the language.</param>
/// <returns>Object that describes the language.</returns>
public static Language Get(string code)
{
iso639_lang_t language = InteropUtilities.ReadStructure<iso639_lang_t>(HBFunctions.lang_for_code2(code));
return Converters.NativeToLanguage(language);
}
}
}
|