50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using Newtonsoft.Json;
|
|
using System.Collections.Generic;
|
|
|
|
namespace UVC.Locale
|
|
{
|
|
/// <summary>
|
|
/// JSON 형식의 다국어 데이터를 담는 클래스입니다.
|
|
/// 이 클래스는 로드된 JSON 파일의 전체 구조에 해당합니다.
|
|
/// </summary>
|
|
/// <example>
|
|
/// JSON 파일 예시 (`locale.json`):
|
|
/// <code>
|
|
/// {
|
|
/// "en-US": {
|
|
/// "welcome_message": "Welcome!",
|
|
/// "greeting": "Hello, {0}!"
|
|
/// },
|
|
/// "ko-KR": {
|
|
/// "welcome_message": "환영합니다!",
|
|
/// "greeting": "안녕하세요, {0}님!"
|
|
/// }
|
|
/// }
|
|
/// </code>
|
|
/// </example>
|
|
public class LocalizationDataSource
|
|
{
|
|
/// <summary>
|
|
/// 다국어 번역 데이터를 저장하는 딕셔너리입니다.
|
|
/// 키는 언어 코드(예: "en-US", "ko-KR")이며,
|
|
/// 값은 해당 언어의 번역 문자열 키와 번역된 텍스트를 담는 또 다른 딕셔너리입니다.
|
|
/// </summary>
|
|
/// <example>
|
|
/// <code>
|
|
/// // "en-US" 언어의 "welcome_message" 키에 해당하는 값은 "Welcome!" 입니다.
|
|
/// // Translations["en-US"]["welcome_message"] -> "Welcome!"
|
|
/// </code>
|
|
/// </example>
|
|
public Dictionary<string, Dictionary<string, string>> Translations { get; set; }
|
|
|
|
/// <summary>
|
|
/// <see cref="LocalizationDataSource"/> 클래스의 새 인스턴스를 초기화합니다.
|
|
/// <see cref="Translations"/> 딕셔너리를 빈 상태로 생성합니다.
|
|
/// </summary>
|
|
public LocalizationDataSource()
|
|
{
|
|
Translations = new Dictionary<string, Dictionary<string, string>>();
|
|
}
|
|
}
|
|
}
|