support voicechat translations

This commit is contained in:
Chayapak 2023-06-24 17:06:35 +07:00
parent 6b9b4451ba
commit 89e3a62407
2 changed files with 173 additions and 1 deletions

View file

@ -28,7 +28,9 @@ public class ComponentUtilities {
return component1.toString().equals(component2.toString());
}
// component parsing
private static final Map<String, String> language = loadJsonStringMap("language.json");
private static final Map<String, String> voiceChatLanguage = loadJsonStringMap("voiceChatLanguage.json");
private static final Map<String, String> keybinds = loadJsonStringMap("keybinds.json");
public static final Pattern ARG_PATTERN = Pattern.compile("%(?:(\\d+)\\$)?([s%])");
@ -84,7 +86,12 @@ public class ComponentUtilities {
}
private static String getOrReturnKey (String key) {
return ComponentUtilities.language.getOrDefault(key, key);
final String minecraftKey = language.get(key);
final String voiceChatKey = voiceChatLanguage.get(key);
if (minecraftKey != null) return minecraftKey;
else if (voiceChatKey != null) return voiceChatKey;
else return key;
}
public static String stringify (Component message) { return stringify(message, null); }

View file

@ -0,0 +1,165 @@
{
"key.categories.voicechat": "Voice Chat",
"key.push_to_talk": "Push To Talk",
"key.whisper": "Whisper",
"key.mute_microphone": "Mute Microphone",
"key.disable_voice_chat": "Disable Voice Chat",
"key.hide_icons": "Hide Voice Chat Icons",
"key.voice_chat_settings": "Voice Chat Settings",
"key.voice_chat": "Voice Chat GUI",
"key.voice_chat_group": "Voice Chat Group",
"key.voice_chat_toggle_recording": "Toggle Recording",
"key.voice_chat_adjust_volumes": "Adjust Volumes",
"gui.voicechat.voice_chat.title": "Voice Chat",
"gui.voicechat.voice_chat_settings.title": "Voice Chat Settings",
"gui.voicechat.adjust_volume.title": "Adjust Volumes",
"gui.voicechat.select_microphone.title": "Select Microphone",
"gui.voicechat.select_speaker.title": "Select Speaker",
"gui.voicechat.group.title": "Group Chat",
"gui.voicechat.join_create_group.title": "Join or Create Group",
"gui.voicechat.create_group.title": "Create a Group",
"gui.voicechat.enter_password.title": "Enter Group Password",
"message.voicechat.settings": "Settings",
"message.voicechat.group": "Group",
"message.voicechat.voice_chat_volume": "Voice chat volume: %s",
"message.voicechat.microphone_amplification": "Microphone amplification: %s",
"message.voicechat.mic_test_on": "Disable microphone testing",
"message.voicechat.mic_test_off": "Enable microphone testing",
"message.voicechat.mic_test_unavailable": "Microphone testing unavailable",
"message.voicechat.voice_chat_unavailable": "Voice chat unavailable",
"message.voicechat.voice_chat_not_connected": "Voice chat not connected",
"message.voicechat.activation_type": "Activation type: %s",
"message.voicechat.activation_type.ptt": "Push to talk",
"message.voicechat.activation_type.voice": "Voice",
"message.voicechat.voice_activation": "Voice activation threshold: %s dB",
"message.voicechat.voice_activation.disabled": "0 dB deactivates the microphone!",
"message.voicechat.adjust_volumes": "Adjust volumes",
"message.voicechat.volume_amplification": "Amplification: %s",
"message.voicechat.muted": "Muted",
"message.voicechat.adjust_volume_player": "Adjust volume of %s",
"message.voicechat.no_microphone": "No microphone available",
"message.voicechat.no_speaker": "No speaker available",
"message.voicechat.select": "Select",
"message.voicechat.select_microphone": "Select microphone",
"message.voicechat.select_speaker": "Select speaker",
"message.voicechat.back": "Back",
"message.voicechat.client_not_connected": "Client not connected",
"message.voicechat.failed_to_send_ping": "Failed to send ping: %s",
"message.voicechat.sending_ping": "Sending ping...",
"message.voicechat.ping_sent_waiting": "Ping sent. Waiting for response...",
"message.voicechat.ping_received": "Got a response in %sms",
"message.voicechat.ping_received_attempt": "Got a response after %s attempts in %sms",
"message.voicechat.ping_retry": "No response. Retrying...",
"message.voicechat.ping_timed_out": "Request timed out after %s attempts",
"message.voicechat.icons_hidden": "Voice chat icons hidden",
"message.voicechat.icons_visible": "Voice chat icons visible",
"message.voicechat.incompatible_version": "Your voice chat version is not compatible with the servers version.\nPlease install version %s of %s.",
"message.voicechat.incompatible": "Your voice chat version is not compatible with the servers version.",
"message.voicechat.group_members": "Group members",
"message.voicechat.no_group_members": "This group is empty",
"message.voicechat.join_create_group": "Join or Create Group",
"message.voicechat.group_name": "Group name",
"message.voicechat.leave_group": "Leave group",
"message.voicechat.not_in_group": "You are not in a group",
"message.voicechat.invite": "%s invited you to the group %s. %s",
"message.voicechat.accept_invite": "ACCEPT",
"message.voicechat.accept_invite.hover": "Click to accept invitation",
"message.voicechat.join_successful": "Successfully joined %s",
"message.voicechat.leave_successful": "Successfully left the group",
"message.voicechat.groups_disabled": "Groups are disabled on this server",
"message.voicechat.recording_disabled": "Recording is disabled on this server",
"message.voicechat.invite_successful": "Successfully invited %s",
"message.voicechat.processing_recording_session": "Processing recording session...",
"message.voicechat.processing_progress": "Processing %s%%",
"message.voicechat.save_session": "Saved session to '%s'",
"message.voicechat.save_session_failed": "Failed to save recording session: %s",
"message.voicechat.recording_started": "Started Recording",
"message.voicechat.recording_stopped": "Stopped Recording",
"message.voicechat.open_folder": "Open Folder",
"message.voicechat.storage_size": "Expected Storage Size %s",
"message.voicechat.saved_debug_report": "Saved voice chat debug report to %s",
"message.voicechat.open": "Open",
"message.voicechat.saved_debug_report_failed": "Failed to save voice chat debug report: %s",
"message.voicechat.microphone_unavailable": "Microphone unavailable",
"message.voicechat.speaker_unavailable": "Speaker unavailable",
"message.voicechat.playback_unavailable": "Playback unavailable",
"message.voicechat.denoiser": "Noise suppression: %s",
"message.voicechat.enabled": "Enabled",
"message.voicechat.disabled": "Disabled",
"message.voicechat.group_type_title": "%s (%s)",
"message.voicechat.group_title": "%s",
"message.voicechat.group_does_not_exist": "This group does not exist",
"message.voicechat.create": "Create",
"message.voicechat.create_group": "Create a Group",
"message.voicechat.create_group_button": "Create a group",
"message.voicechat.optional_password": "Password (Optional)",
"message.voicechat.group_type": "Group type",
"message.voicechat.group_type.normal": "Normal",
"message.voicechat.group_type.normal.description": "Players that are not in your group can't hear you, but you can hear them",
"message.voicechat.group_type.open": "Open",
"message.voicechat.group_type.open.description": "Players that are not in your group can hear you and you can hear them",
"message.voicechat.group_type.isolated": "Isolated",
"message.voicechat.group_type.isolated.description": "Players that are not in your group can't hear you and you can't hear them",
"message.voicechat.join_group": "Join group",
"message.voicechat.enter_group_password": "Enter Group Password",
"message.voicechat.password": "Password",
"message.voicechat.wrong_password": "Wrong Password",
"message.voicechat.server_port": "Voice chat server hosted on port %s",
"message.voicechat.macos_no_mic_permission": "No microphone permission. Please check Security & Privacy settings",
"message.voicechat.macos_unsupported_launcher": "Your launcher does not support MacOS microphone permissions",
"message.voicechat.player_no_voicechat": "%s does not have %s installed",
"message.voicechat.mute.enabled": "Press to unmute your microphone",
"message.voicechat.mute.disabled": "Press to mute your microphone",
"message.voicechat.mute.disabled_ptt": "You can't mute when using push to talk",
"message.voicechat.disable.enabled": "Press to enable all voice chat sounds",
"message.voicechat.disable.disabled": "Press to disable all voice chat sounds",
"message.voicechat.disable.no_speaker": "No speaker available",
"message.voicechat.hide_icons.enabled": "Press to show all voice chat icons",
"message.voicechat.hide_icons.disabled": "Press to hide all voice chat icons",
"message.voicechat.show_group_hud.enabled": "Press to hide the group chat HUD",
"message.voicechat.show_group_hud.disabled": "Press to show the group chat HUD",
"message.voicechat.recording.disabled": "Press to start recording",
"message.voicechat.recording.enabled": "Press to stop recording",
"message.voicechat.no_speak_permission": "You do not have permission to speak",
"message.voicechat.no_listen_permission": "You do not have permission to hear the voice chat",
"message.voicechat.no_group_permission": "You do not have permission to join groups",
"message.voicechat.search_hint": "Search...",
"message.voicechat.search_empty": "Couldn't find any players with that name",
"message.voicechat.other_volume": "Other",
"message.voicechat.other_volume.description": "The volume of any sound not listed below",
"message.voicechat.more_members": "and %s more...",
"message.voicechat.no_groups": "No existing groups",
"message.voicechat.audio_type": "3D audio: %s",
"message.voicechat.audio_type.normal": "Normal",
"message.voicechat.audio_type.reduced": "Reduced",
"message.voicechat.audio_type.off": "Off",
"message.voicechat.invite_player": "Invite %s to your group",
"resourcepack.voicechat.classic_icons": "Classic Icons",
"resourcepack.voicechat.classic_icons.description": "Classic Voice Chat Icons",
"resourcepack.voicechat.white_icons": "White Icons",
"resourcepack.voicechat.white_icons.description": "White Voice Chat Icons",
"resourcepack.voicechat.black_icons": "Black Icons",
"resourcepack.voicechat.black_icons.description": "Black Voice Chat Icons",
"cloth_config.voicechat.settings": "Voice Chat Settings",
"cloth_config.voicechat.category.general": "General",
"cloth_config.voicechat.category.other": "Other",
"cloth_config.voicechat.category.audio": "Audio",
"cloth_config.voicechat.category.hud_icons": "HUD Icons",
"cloth_config.voicechat.category.group_chat_icons": "Group Chat Icons",
"cloth_config.voicechat.config.recording_destination": "Recording destination",
"cloth_config.voicechat.config.run_local_server": "Run in singleplayer/LAN worlds",
"cloth_config.voicechat.config.offline_player_volume_adjustment": "Offline player volume adjustment",
"cloth_config.voicechat.config.freecam_support": "Freecam support",
"cloth_config.voicechat.config.mute_on_join": "Mute on join",
"cloth_config.voicechat.config.audio_packet_threshold": "Audio packet threshold",
"cloth_config.voicechat.config.deactivation_delay": "Deactivation delay",
"cloth_config.voicechat.config.output_buffer_size": "Output buffer size",
"cloth_config.voicechat.config.hud_icon_scale": "HUD icon scale",
"cloth_config.voicechat.config.hud_icon_x": "HUD icon X pos",
"cloth_config.voicechat.config.hud_icon_y": "HUD icon Y pos",
"cloth_config.voicechat.config.group_player_icon_orientation": "Group HUD icon orientation",
"cloth_config.voicechat.config.group_hud_icon_scale": "Group HUD icon scale",
"cloth_config.voicechat.config.group_player_icon_pos_x": "Group icon X position",
"cloth_config.voicechat.config.group_player_icon_pos_y": "Group icon Y position",
"cloth_config.voicechat.config.show_own_group_icon": "Show own group HUD icon"
}