1
0
mirror of synced 2025-01-19 01:24:08 +01:00

Change I18N structure from function overrides to dictionnaries to make it lighter

This commit is contained in:
0aubsq 2021-10-24 13:50:33 +02:00
parent 637cafd892
commit e8b601c763
5 changed files with 49 additions and 25 deletions

View File

@ -7,14 +7,23 @@ namespace TJAPlayer3
{
internal class CLang_en : ILang
{
string ILang.ConfigChangeLanguage()
string ILang.GetString(int idx)
{
return "Change the displayed language\ningame and within the menus.";
if (!dictionnary.ContainsKey(idx))
return "[!] Index not found in dictionnary";
return dictionnary[idx];
}
string ILang.ConfigChangeLanguageHead()
private static readonly Dictionary<int, string> dictionnary = new Dictionary<int, string>
{
return "System language";
}
[0] = "Change the displayed language\ningame and within the menus.",
[1] = "System language",
[2] = "<< Return to Menu",
[3] = "Return to left menu.",
[4] = "Reload song data",
[5] = "Retrieve and update the song list.",
};
}
}

View File

@ -7,14 +7,23 @@ namespace TJAPlayer3
{
internal class CLang_fr : ILang
{
string ILang.ConfigChangeLanguage()
string ILang.GetString(int idx)
{
return "Changer la langue affichée\ndans les menus et en jeu.";
if (!dictionnary.ContainsKey(idx))
return "[!] Index non trouvé dans le dictionnaire";
return dictionnary[idx];
}
string ILang.ConfigChangeLanguageHead()
private static readonly Dictionary<int, string> dictionnary = new Dictionary<int, string>
{
return "Langue du système";
}
[0] = "Changer la langue affichée\ndans les menus et en jeu.",
[1] = "Langue du système",
[2] = "<< Retour au menu",
[3] = "Retour au menu principal.",
[4] = "Recharger les sons",
[5] = "Met à jour et récupère les\nmodifications effectuées sur\nla liste de sons.",
};
}
}

View File

@ -7,14 +7,23 @@ namespace TJAPlayer3
{
internal class CLang_jp : ILang
{
string ILang.ConfigChangeLanguage()
string ILang.GetString(int idx)
{
return "プレイ中やメニューの\n表示される言語を変更。";
if (!dictionnary.ContainsKey(idx))
return "[!] 辞書で求める指数を見つけられませんでした";
return dictionnary[idx];
}
string ILang.ConfigChangeLanguageHead()
private static readonly Dictionary<int, string> dictionnary = new Dictionary<int, string>
{
return "システム言語";
}
[0] = "プレイ中やメニューの\n表示される言語を変更。",
[1] = "システム言語",
[2] = "<< 戻る",
[3] = "左側のメニューに戻ります。",
[4] = "曲データ再読込み",
[5] = "曲データの一覧情報を取得し直します。",
};
}
}

View File

@ -7,8 +7,7 @@ namespace TJAPlayer3
{
internal interface ILang
{
string ConfigChangeLanguage();
string ConfigChangeLanguageHead();
string GetString(int idx);
}
static internal class CLangManager

View File

@ -69,19 +69,17 @@ namespace TJAPlayer3
// #27029 2012.1.5 from: 説明文は最大9行→13行に変更。
this.iSystemReturnToMenu = new CItemBase( "<< ReturnTo Menu", CItemBase.Eパネル種別.,
"左側のメニューに戻ります。",
"Return to left menu." );
this.iSystemReturnToMenu = new CItemBase(CLangManager.LangInstance.GetString(2), CItemBase.Eパネル種別.,
CLangManager.LangInstance.GetString(3));
this.list項目リスト.Add( this.iSystemReturnToMenu );
this.iSystemReloadDTX = new CItemBase( "曲データ再読込み", CItemBase.Eパネル種別.,
"曲データの一覧情報を取得し直します。",
"Reload song data." );
this.iSystemReloadDTX = new CItemBase(CLangManager.LangInstance.GetString(4), CItemBase.Eパネル種別.,
CLangManager.LangInstance.GetString(5));
this.list項目リスト.Add( this.iSystemReloadDTX );
this.iSystemLanguage = new CItemList(CLangManager.LangInstance.ConfigChangeLanguageHead(), CItemList.Eパネル種別., CLangManager.langToInt(TJAPlayer3.ConfigIni.sLang),
CLangManager.LangInstance.ConfigChangeLanguage(),
this.iSystemLanguage = new CItemList(CLangManager.LangInstance.GetString(1), CItemList.Eパネル種別., CLangManager.langToInt(TJAPlayer3.ConfigIni.sLang),
CLangManager.LangInstance.GetString(0),
CLangManager.Languages);
this.list項目リスト.Add(this.iSystemLanguage);