File tree Expand file tree Collapse file tree
WindowTranslator.Abstractions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,12 +10,25 @@ public class LanguageOptions
1010 /// <summary>
1111 /// 翻訳元言語を取得または設定します。
1212 /// </summary>
13- public string Source { get ; set ; } = "en-US" ;
13+ public string Source { get ; set ; } = GetDefaultSourceLanguage ( ) ;
1414
1515 /// <summary>
1616 /// 翻訳先言語を取得または設定します。
1717 /// </summary>
1818 public string Target { get ; set ; } = CultureInfo . CurrentUICulture . Name ;
19+
20+ /// <summary>
21+ /// OSの言語設定に基づいてデフォルトのソース言語を取得します。
22+ /// </summary>
23+ /// <returns>
24+ /// OSの言語が英語の場合は日本語(ja-JP)、それ以外の場合は英語(en-US)
25+ /// </returns>
26+ private static string GetDefaultSourceLanguage ( )
27+ {
28+ var currentCulture = CultureInfo . CurrentUICulture . Name ;
29+ // OSの言語が英語の場合は日本語、それ以外は英語
30+ return currentCulture . StartsWith ( "en" , StringComparison . OrdinalIgnoreCase ) ? "ja-JP" : "en-US" ;
31+ }
1932}
2033
2134/// <summary>
You can’t perform that action at this time.
0 commit comments