1
0
mirror of synced 2024-11-28 09:20:53 +01:00

Base I18N implementation : Implement a structure that will make able to select a language within the settings menu (or config.ini) and the said menu option (Currently contains few texts in Japanese, English and French)

This commit is contained in:
0aubsq 2021-10-24 09:20:14 +02:00
parent 43eedd98f2
commit 637cafd892
8 changed files with 208 additions and 29 deletions

View File

@ -770,7 +770,6 @@ namespace TJAPlayer3
public bool bEndingAnime = false; // 2017.01.27 DD 「また遊んでね」画面の有効/無効オプション追加 public bool bEndingAnime = false; // 2017.01.27 DD 「また遊んでね」画面の有効/無効オプション追加
public STDGBVALUE<E判定文字表示位置> ; public STDGBVALUE<E判定文字表示位置> ;
// public int nハイハット切り捨て下限Velocity; // public int nハイハット切り捨て下限Velocity;
// public int n切り捨て下限Velocity; // #23857 2010.12.12 yyagi VelocityMin // public int n切り捨て下限Velocity; // #23857 2010.12.12 yyagi VelocityMin
@ -875,10 +874,14 @@ namespace TJAPlayer3
public bool ShinuchiMode; // 真打モード public bool ShinuchiMode; // 真打モード
public bool FastRender; // 事前画像描画モード public bool FastRender; // 事前画像描画モード
public int MusicPreTimeMs; // 音源再生前の待機時間ms public int MusicPreTimeMs; // 音源再生前の待機時間ms
/// <summary>
/// DiscordのRitch Presenceに再生中の.tjaファイルの情報を送信するかどうか。 // I18N choosen language
/// </summary> public string sLang = "jp";
public bool SendDiscordPlayingInformation;
/// <summary>
/// DiscordのRitch Presenceに再生中の.tjaファイルの情報を送信するかどうか。
/// </summary>
public bool SendDiscordPlayingInformation;
#if false #if false
[StructLayout( LayoutKind.Sequential )] [StructLayout( LayoutKind.Sequential )]
public struct STAUTOPLAY // C定数のEレーンとindexを一致させること public struct STAUTOPLAY // C定数のEレーンとindexを一致させること
@ -1287,6 +1290,7 @@ namespace TJAPlayer3
this.BoxFontName = "MS UI Gothic"; this.BoxFontName = "MS UI Gothic";
this.ApplyLoudnessMetadata = true; this.ApplyLoudnessMetadata = true;
this.bEnableCountdownTimer = true; this.bEnableCountdownTimer = true;
this.sLang = "jp";
// 2018-08-28 twopointzero: // 2018-08-28 twopointzero:
// There exists a particular large, well-known, well-curated, and // There exists a particular large, well-known, well-curated, and
@ -1530,9 +1534,20 @@ namespace TJAPlayer3
sw.WriteLine("; Use pre-textures render."); sw.WriteLine("; Use pre-textures render.");
sw.WriteLine("{0}={1}", nameof(FastRender), FastRender ? 1 : 0); sw.WriteLine("{0}={1}", nameof(FastRender), FastRender ? 1 : 0);
sw.WriteLine(); sw.WriteLine();
#endregion #endregion
#region [ Window関連 ]
sw.WriteLine( "; 画面モード(0:ウィンドウ, 1:全画面)" );
#region [Language]
sw.WriteLine("; プレイ中やメニューの表示される言語を変更。");
sw.WriteLine("; Change the displayed language ingame and within the menus.");
sw.WriteLine("Lang={0}", this.sLang);
sw.WriteLine();
#endregion
#region [ Window関連 ]
sw.WriteLine( "; 画面モード(0:ウィンドウ, 1:全画面)" );
sw.WriteLine( "; Screen mode. (0:Window, 1:Fullscreen)" ); sw.WriteLine( "; Screen mode. (0:Window, 1:Fullscreen)" );
sw.WriteLine( "FullScreen={0}", this.b全画面モード ? 1 : 0 ); sw.WriteLine( "FullScreen={0}", this.b全画面モード ? 1 : 0 );
sw.WriteLine(); sw.WriteLine();
@ -2163,6 +2178,12 @@ namespace TJAPlayer3
this.str曲データ検索パス = str4; this.str曲データ検索パス = str4;
} }
#endregion #endregion
else if( str3.Equals("Lang"))
{
CLangManager.langAttach(str4);
}
#region [ skin関係 ] #region [ skin関係 ]
else if ( str3.Equals( "SkinPath" ) ) else if ( str3.Equals( "SkinPath" ) )
{ {

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TJAPlayer3
{
internal class CLang_en : ILang
{
string ILang.ConfigChangeLanguage()
{
return "Change the displayed language\ningame and within the menus.";
}
string ILang.ConfigChangeLanguageHead()
{
return "System language";
}
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TJAPlayer3
{
internal class CLang_fr : ILang
{
string ILang.ConfigChangeLanguage()
{
return "Changer la langue affichée\ndans les menus et en jeu.";
}
string ILang.ConfigChangeLanguageHead()
{
return "Langue du système";
}
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TJAPlayer3
{
internal class CLang_jp : ILang
{
string ILang.ConfigChangeLanguage()
{
return "プレイ中やメニューの\n表示される言語を変更。";
}
string ILang.ConfigChangeLanguageHead()
{
return "システム言語";
}
}
}

64
TJAPlayer3/I18N/ILang.cs Normal file
View File

@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TJAPlayer3
{
internal interface ILang
{
string ConfigChangeLanguage();
string ConfigChangeLanguageHead();
}
static internal class CLangManager
{
// Cheap factory-like design pattern
public static void langAttach(string lang)
{
switch (lang) {
case "fr":
CLangManager.LangInstance = new CLang_fr();
break;
case "en":
CLangManager.LangInstance = new CLang_en();
break;
case "jp":
default:
CLangManager.LangInstance = new CLang_jp();
break;
}
}
public static int langToInt(string lang)
{
switch (lang)
{
case "fr":
return 2;
case "en":
return 1;
case "jp":
default:
return 0;
}
}
public static string intToLang(int idx)
{
switch (idx)
{
case 2:
return "fr";
case 1:
return "en";
case 0:
default:
return "jp";
}
}
public static string[] Languages = new string[] { "日本語", "English", "Français" };
public static ILang LangInstance = new CLang_jp();
}
}

View File

@ -62,7 +62,7 @@ namespace TJAPlayer3
// メソッド // メソッド
#region [ t項目リストの設定_System() ] #region [ t項目リストの設定_System() ]
public void t項目リストの設定_System() public void t項目リストの設定_System(bool refresh = true)
{ {
this.tConfigIniへ記録する(); this.tConfigIniへ記録する();
this.list項目リスト.Clear(); this.list項目リスト.Clear();
@ -79,13 +79,19 @@ namespace TJAPlayer3
"Reload song data." ); "Reload song data." );
this.list項目リスト.Add( this.iSystemReloadDTX ); this.list項目リスト.Add( this.iSystemReloadDTX );
//this.iCommonDark = new CItemList( "Dark", CItemBase.Eパネル種別.通常, (int) CDTXMania.ConfigIni.eDark,
// "HALF: 背景、レーン、ゲージが表示\nされなくなります。\nFULL: さらに小節線、拍線、判定ラ\nイン、パッドも表示されなくなります。",
// "OFF: all display parts are shown.\nHALF: wallpaper, lanes and gauge are\n disappeared.\nFULL: additionaly to HALF, bar/beat\n lines, hit bar, pads are disappeared.",
// new string[] { "OFF", "HALF", "FULL" } );
//this.list項目リスト.Add( this.iCommonDark );
this.iTaikoPlayerCount = new CItemInteger( "プレイ人数", 1, 2, TJAPlayer3.ConfigIni.nPlayerCount, this.iSystemLanguage = new CItemList(CLangManager.LangInstance.ConfigChangeLanguageHead(), CItemList.Eパネル種別., CLangManager.langToInt(TJAPlayer3.ConfigIni.sLang),
CLangManager.LangInstance.ConfigChangeLanguage(),
CLangManager.Languages);
this.list項目リスト.Add(this.iSystemLanguage);
//this.iCommonDark = new CItemList( "Dark", CItemBase.Eパネル種別.通常, (int) CDTXMania.ConfigIni.eDark,
// "HALF: 背景、レーン、ゲージが表示\nされなくなります。\nFULL: さらに小節線、拍線、判定ラ\nイン、パッドも表示されなくなります。",
// "OFF: all display parts are shown.\nHALF: wallpaper, lanes and gauge are\n disappeared.\nFULL: additionaly to HALF, bar/beat\n lines, hit bar, pads are disappeared.",
// new string[] { "OFF", "HALF", "FULL" } );
//this.list項目リスト.Add( this.iCommonDark );
this.iTaikoPlayerCount = new CItemInteger( "プレイ人数", 1, 2, TJAPlayer3.ConfigIni.nPlayerCount,
"プレイ人数切り替え:\n2にすると演奏画面が2人プレイ専用のレイアウトになり、2P専用譜面を読み込むようになります。", "プレイ人数切り替え:\n2にすると演奏画面が2人プレイ専用のレイアウトになり、2P専用譜面を読み込むようになります。",
"" ); "" );
this.list項目リスト.Add( this.iTaikoPlayerCount ); this.list項目リスト.Add( this.iTaikoPlayerCount );
@ -489,9 +495,13 @@ namespace TJAPlayer3
"Settings for the system key/pad inputs." ); "Settings for the system key/pad inputs." );
this.list項目リスト.Add( this.iSystemGoToKeyAssign ); this.list項目リスト.Add( this.iSystemGoToKeyAssign );
OnListMenuの初期化(); OnListMenuの初期化();
this.n現在の選択項目 = 0; if (refresh)
this.eメニュー種別 = Eメニュー種別.System; {
this.n現在の選択項目 = 0;
this.eメニュー種別 = Eメニュー種別.System;
}
} }
#endregion #endregion
#region [ t項目リストの設定_Drums() ] #region [ t項目リストの設定_Drums() ]
@ -804,7 +814,14 @@ namespace TJAPlayer3
//else //else
//{ //{
// // 変更許可 // // 変更許可
this.list項目リスト[ this.n現在の選択項目 ].tEnter押下(); this.list項目リスト[ this.n現在の選択項目 ].tEnter押下();
if (this.list項目リスト[this.n現在の選択項目] == this.iSystemLanguage)
{
TJAPlayer3.ConfigIni.sLang = CLangManager.intToLang(this.iSystemLanguage.n現在選択されている項目番号);
CLangManager.langAttach(TJAPlayer3.ConfigIni.sLang);
t項目リストの設定_System(refresh : false);
}
//} //}
@ -1554,7 +1571,10 @@ namespace TJAPlayer3
private CItemToggle SendDiscordPlayingInformation; private CItemToggle SendDiscordPlayingInformation;
private CItemToggle iSystemBufferedInput; private CItemToggle iSystemBufferedInput;
private CItemInteger iSystemRisky; // #23559 2011.7.27 yyagi private CItemInteger iSystemRisky; // #23559 2011.7.27 yyagi
private CItemList iSystemSoundType; // #24820 2013.1.3 yyagi private CItemList iSystemSoundType; // #24820 2013.1.3 yyagi
private CItemList iSystemLanguage;
private CItemInteger iSystemWASAPIBufferSizeMs; // #24820 2013.1.15 yyagi private CItemInteger iSystemWASAPIBufferSizeMs; // #24820 2013.1.15 yyagi
// private CItemInteger iSystemASIOBufferSizeMs; // #24820 2013.1.3 yyagi // private CItemInteger iSystemASIOBufferSizeMs; // #24820 2013.1.3 yyagi
private CItemList iSystemASIODevice; // #24820 2013.1.17 yyagi private CItemList iSystemASIODevice; // #24820 2013.1.17 yyagi
@ -1713,13 +1733,19 @@ namespace TJAPlayer3
TJAPlayer3.ConfigIni.bUseOSTimer = this.iSystemSoundTimerType.bON; // #33689 2014.6.17 yyagi TJAPlayer3.ConfigIni.bUseOSTimer = this.iSystemSoundTimerType.bON; // #33689 2014.6.17 yyagi
TJAPlayer3.ConfigIni.bTimeStretch = this.iSystemTimeStretch.bON; // #23664 2013.2.24 yyagi TJAPlayer3.ConfigIni.bTimeStretch = this.iSystemTimeStretch.bON; // #23664 2013.2.24 yyagi
//Trace.TraceInformation( "saved" );
//Trace.TraceInformation( "Skin現在Current : " + CDTXMania.Skin.GetCurrentSkinSubfolderFullName(true) );
//Trace.TraceInformation( "Skin現在System : " + CSkin.strSystemSkinSubfolderFullName ); TJAPlayer3.ConfigIni.sLang = CLangManager.intToLang(this.iSystemLanguage.n現在選択されている項目番号);
//Trace.TraceInformation( "Skin現在BoxDef : " + CSkin.strBoxDefSkinSubfolderFullName ); CLangManager.langAttach(TJAPlayer3.ConfigIni.sLang);
//Trace.TraceInformation( "saved" );
//Trace.TraceInformation( "Skin現在Current : " + CDTXMania.Skin.GetCurrentSkinSubfolderFullName(true) );
//Trace.TraceInformation( "Skin現在System : " + CSkin.strSystemSkinSubfolderFullName );
//Trace.TraceInformation( "Skin現在BoxDef : " + CSkin.strBoxDefSkinSubfolderFullName );
//CDTXMania.ConfigIni.nMasterVolume = this.iSystemMasterVolume.n現在の値; // #33700 2014.4.26 yyagi //CDTXMania.ConfigIni.nMasterVolume = this.iSystemMasterVolume.n現在の値; // #33700 2014.4.26 yyagi
//CDTXMania.ConfigIni.e判定表示優先度 = (E判定表示優先度) this.iSystemJudgeDispPriority.n現在選択されている項目番号; //CDTXMania.ConfigIni.e判定表示優先度 = (E判定表示優先度) this.iSystemJudgeDispPriority.n現在選択されている項目番号;
TJAPlayer3.ConfigIni.ShowChara = this.ShowChara.bON; TJAPlayer3.ConfigIni.ShowChara = this.ShowChara.bON;
TJAPlayer3.ConfigIni.ShowDancer = this.ShowDancer.bON; TJAPlayer3.ConfigIni.ShowDancer = this.ShowDancer.bON;
TJAPlayer3.ConfigIni.ShowRunner = this.ShowRunner.bON; TJAPlayer3.ConfigIni.ShowRunner = this.ShowRunner.bON;
TJAPlayer3.ConfigIni.ShowMob = this.ShowMob.bON; TJAPlayer3.ConfigIni.ShowMob = this.ShowMob.bON;

View File

@ -358,6 +358,9 @@ namespace TJAPlayer3
case EItemPanelモード.: case EItemPanelモード.:
bool bIsKeyAssignSelectedBeforeHitEnter = this.actList.bIsKeyAssignSelected; // #24525 2011.3.15 yyagi bool bIsKeyAssignSelectedBeforeHitEnter = this.actList.bIsKeyAssignSelected; // #24525 2011.3.15 yyagi
this.actList.tEnter押下(); this.actList.tEnter押下();
this.t説明文パネルに現在選択されている項目の説明を描画する();
if ( this.actList.b現在選択されている項目はReturnToMenuである ) if ( this.actList.b現在選択されている項目はReturnToMenuである )
{ {
this.t説明文パネルに現在選択されているメニューの説明を描画する(); this.t説明文パネルに現在選択されているメニューの説明を描画する();

View File

@ -106,6 +106,9 @@
<Compile Include="Common\Discord.cs" /> <Compile Include="Common\Discord.cs" />
<Compile Include="Common\Easing.cs" /> <Compile Include="Common\Easing.cs" />
<Compile Include="Common\NamePlateConfig.cs" /> <Compile Include="Common\NamePlateConfig.cs" />
<Compile Include="I18N\CLang_fr.cs" />
<Compile Include="I18N\CLang_en.cs" />
<Compile Include="I18N\CLang_jp.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Discord.resx"> <EmbeddedResource Include="Properties\Discord.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
@ -127,6 +130,7 @@
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
</Compile> </Compile>
<None Include="app.config" /> <None Include="app.config" />
<Compile Include="I18N\ILang.cs" />
<None Include="TJAPlayer3.manifest" /> <None Include="TJAPlayer3.manifest" />
<None Include="DTXManiaGR.exe.x86.manifest" /> <None Include="DTXManiaGR.exe.x86.manifest" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
@ -338,6 +342,7 @@
<Version>4.2.0</Version> <Version>4.2.0</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.