- Client Godot 4.7 .NET (Godot.NET.Sdk 4.7.2): menu, collegamento, partita locale con server figlio; mappa con terreno (fasce, ombreggiatura, rive curve con shader, curve di livello), opere, entità, alberi, treni interpolati con fumo; strumenti binari con profilo, stazione, deposito, segnali, demolizione; pannelli treni, linee, mercato, finanze, schede; barra superiore, minimappa, notiziario; italiano e inglese. - Pilota automatico del client e scripts/client-autopilot.sh: partita locale, linea con ponte, treni in moto e schermate (docs/screenshots). - Registro dei comandi del server (--record) e viaferrea-tools replay. - PROTOCOL.md normativo, ADR 0009, ARCHITECTURE, STATE e README aggiornati. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0191R7vXgtbAvSV4V8tj8uzL
44 lines
1.6 KiB
C#
44 lines
1.6 KiB
C#
using Godot;
|
|
|
|
namespace ViaFerrea.Client.App;
|
|
|
|
/// <summary>
|
|
/// Testi dell'interfaccia: la lingua sorgente è l'italiano (le chiavi sono i testi italiani),
|
|
/// le traduzioni stanno in <c>assets/i18n/strings.csv</c> (colonne keys, it, en) e si caricano
|
|
/// all'avvio senza passare dall'importazione dell'editor.
|
|
/// </summary>
|
|
public static class Localization
|
|
{
|
|
public static void Load(string locale)
|
|
{
|
|
const string path = "res://assets/i18n/strings.csv";
|
|
using var file = Godot.FileAccess.Open(path, Godot.FileAccess.ModeFlags.Read);
|
|
if (file is null)
|
|
{
|
|
GD.PushWarning("Traduzioni non trovate");
|
|
return;
|
|
}
|
|
string[] header = file.GetCsvLine();
|
|
var translations = new List<Translation>();
|
|
for (int c = 1; c < header.Length; c++)
|
|
{
|
|
var t = new Translation { Locale = header[c] };
|
|
translations.Add(t);
|
|
}
|
|
while (!file.EofReached())
|
|
{
|
|
string[] row = file.GetCsvLine();
|
|
if (row.Length < 2 || row[0].Length == 0) continue;
|
|
for (int c = 1; c < row.Length && c - 1 < translations.Count; c++)
|
|
{
|
|
if (row[c].Length > 0) translations[c - 1].AddMessage(row[0], row[c]);
|
|
}
|
|
}
|
|
foreach (var t in translations) TranslationServer.AddTranslation(t);
|
|
TranslationServer.SetLocale(locale);
|
|
}
|
|
|
|
/// <summary>Traduce un testo dell'interfaccia (chiave = testo italiano).</summary>
|
|
public static string T(string italian) => TranslationServer.Translate(italian);
|
|
}
|