Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update localization support #23

Merged
merged 2 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Multiplayer/Components/Networking/PlayerListGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ private void OnGUI()
if (!showPlayerList)
return;

GUILayout.Window(157031520, new Rect(Screen.width / 2.0f - 125, 25, 250, 0), DrawPlayerList, "Online Players");
GUILayout.Window(157031520, new Rect(Screen.width / 2.0f - 125, 25, 250, 0), DrawPlayerList, Locale.PLAYER_LIST__TITLE);
}

private static void DrawPlayerList(int windowId)
Expand Down
19 changes: 19 additions & 0 deletions Multiplayer/Locale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public static class Locale
private const string PREFIX_SERVER_BROWSER = $"{PREFIX}sb";
private const string PREFIX_DISCONN_REASON = $"{PREFIX}dr";
private const string PREFIX_CAREER_MANAGER = $"{PREFIX}carman";
private const string PREFIX_PLAYER_LIST = $"{PREFIX}plist";
private const string PREFIX_LOADING_INFO = $"{PREFIX}linfo";

#region Main Menu

Expand Down Expand Up @@ -69,6 +71,23 @@ public static class Locale

#endregion

#region Player List

public static string PLAYER_LIST__TITLE => Get(PLAYER_LIST__TITLE_KEY);
private const string PLAYER_LIST__TITLE_KEY = $"{PREFIX_PLAYER_LIST}/title";

#endregion

#region Loading Info

public static string LOADING_INFO__WAIT_FOR_SERVER => Get(LOADING_INFO__WAIT_FOR_SERVER_KEY);
private const string LOADING_INFO__WAIT_FOR_SERVER_KEY = $"{PREFIX_LOADING_INFO}/wait_for_server";

public static string LOADING_INFO__SYNC_WORLD_STATE => Get(LOADING_INFO__SYNC_WORLD_STATE_KEY);
private const string LOADING_INFO__SYNC_WORLD_STATE_KEY = $"{PREFIX_LOADING_INFO}/sync_world_state";

#endregion

private static bool initializeAttempted;
private static ReadOnlyDictionary<string, Dictionary<string, string>> csv;

Expand Down
4 changes: 2 additions & 2 deletions Multiplayer/Networking/Managers/Client/NetworkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ private void OnClientboundServerLoadingPacket(ClientboundServerLoadingPacket pac
return;
}

displayLoadingInfo.OnLoadingStatusChanged("Waiting for server to load", false, 100);
displayLoadingInfo.OnLoadingStatusChanged(Locale.LOADING_INFO__WAIT_FOR_SERVER, false, 100);
}

private void OnClientboundGameParamsPacket(ClientboundGameParamsPacket packet)
Expand Down Expand Up @@ -288,7 +288,7 @@ private void OnClientboundBeginWorldSyncPacket(ClientboundBeginWorldSyncPacket p
return;
}

displayLoadingInfo.OnLoadingStatusChanged("Syncing world state", false, 100);
displayLoadingInfo.OnLoadingStatusChanged(Locale.LOADING_INFO__SYNC_WORLD_STATE, false, 100);
}

private void OnClientboundWeatherPacket(ClientboundWeatherPacket packet)
Expand Down
17 changes: 12 additions & 5 deletions locale.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ Key,Description,English,Bulgarian,Chinese (Simplified),Chinese (Traditional),Cze
,"If a translation has a comma, the entire line MUST be wrapped in double quotes! Most editors (Excel, LibreCalc) will do this for you.",,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,
,Main Menu,,,,,,,,,,,,,,,,,,,,,,,,,,
mm/join_server,The 'Join Server' button in the main menu.,Join Server,,,,,,,,,Server beitreten,,,,,,,,,,,,,,,,
mm/join_server__tooltip,The tooltip shown when hovering over the 'Join Server' button.,Join a multiplayer session.,,,,,,,,,Trete einer Mehrspielersitzung bei,,,,,,,,,,,,,,,,
mm/join_server,The 'Join Server' button in the main menu.,Join Server,,,,,,,,,Spiel beitreten,,,,,,,,,,,,,,,,
mm/join_server__tooltip,The tooltip shown when hovering over the 'Join Server' button.,Join a multiplayer session.,,,,,,,,,Trete einer Mehrspielersitzung bei.,,,,,,,,,,,,,,,,
mm/join_server__tooltip_disabled,Unused,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,
,Server Browser,,,,,,,,,,,,,,,,,,,,,,,,,,
sb/title,The title of the Server Browser tab,Server Browser,,,,,,,,,,,,,,,,,,,,,,,,,
sb/ip,IP popup,Enter IP Address,,,,,,,,,Server-IP einfügen,,,,,,,,,,,,,,,,
sb/ip,IP popup,Enter IP Address,,,,,,,,,IP Adresse eingeben,,,,,,,,,,,,,,,,
sb/ip_invalid,Invalid IP popup.,Invalid IP Address!,,,,,,,,,Ungültige IP Adresse!,,,,,,,,,,,,,,,,
sb/port,Port popup.,Enter Port (7777 by default),,,,,,,,,Server-Port (Standard: 7777),,,,,,,,,,,,,,,,
sb/port,Port popup.,Enter Port (7777 by default),,,,,,,,,Port eingeben (Standard: 7777),,,,,,,,,,,,,,,,
sb/port_invalid,Invalid port popup.,Invalid Port!,,,,,,,,,Ungültiger Port!,,,,,,,,,,,,,,,,
sb/password,Password popup.,Enter Password,,,,,,,,,Passwort eingeben,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,
Expand All @@ -22,7 +22,14 @@ dr/game_version,Different game versions.,"Game version mismatch! Server version:
dr/full_server,The server is already full.,The server is full!,,,,,,,,,Der Server ist voll!,,,,,,,,,,,,,,,,
dr/mods,"The client is missing, or has extra mods.",Mod mismatch!,,,,,,,,,Mods stimmen nicht überein!,,,,,,,,,,,,,,,,
dr/mods_missing,The list of missing mods.,Missing Mods:\n- {0},,,,,,,,,Fehlende Mods:\n- {0},,,,,,,,,,,,,,,,
dr/mods_extra,The list of extra mods.,Extra Mods:\n- {0},,,,,,,,,Zusätzliche Modifikationen:\n- {0},,,,,,,,,,,,,,,,
dr/mods_extra,The list of extra mods.,Extra Mods:\n- {0},,,,,,,,,Zusätzliche Mods:\n- {0},,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,
,Career Manager,,,,,,,,,,,,,,,,,,,,,,,,,,
carman/fees_host_only,Text shown when a client tries to manage fees.,Only the host can manage fees!,,,,,,,,,Nur der Host kann Gebühren verwalten!,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,
,Player List,,,,,,,,,,,,,,,,,,,,,,,,,,
plist/title,The title of the player list.,Online Players,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,
,Loading Info,,,,,,,,,,,,,,,,,,,,,,,,,,
linfo/wait_for_server,Text shown in the loading screen.,Waiting for server to load,,,,,,,,,Warte auf das Laden des Servers,,,,,,,,,,,,,,,,
linfo/sync_world_state,Text shown in the loading screen.,Syncing world state,,,,,,,,,Synchronisiere Daten,,,,,,,,,,,,,,,,