forked from Gimly/FluentxApi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLanguageMap.cs
More file actions
30 lines (27 loc) · 1.22 KB
/
LanguageMap.cs
File metadata and controls
30 lines (27 loc) · 1.22 KB
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
using System.Collections.Generic;
namespace Mos.xApi
{
/// <summary>
/// Implements a dictionary where the key is a RFC 5646 Language Tag,
/// and the value is a string in the language specified in the tag.
/// </summary>
public class LanguageMap : Dictionary<string, string>, ILanguageMap
{
/// <summary>
/// Initializes a new instance of the LanguageMap dictionary which is empty.
/// </summary>
public LanguageMap() { }
/// <summary>
/// Initializes a new instance of the LanguageMap dictionary that contains
/// elements that are copied from the passed dictionary.
/// </summary>
/// <param name="dictionary">The dictionary who's values are copied to the LanguageMap</param>
public LanguageMap(IDictionary<string, string> dictionary) : base(dictionary) { }
/// <summary>
/// Returns, given the RFC 5646 language tag, the string in the language specified.
/// </summary>
/// <param name="languageCode">The RFC 5646 language tag</param>
/// <returns>The text translated in the given language</returns>
public string GetTranslation(string languageCode) => this[languageCode];
}
}