Skip to content

Commit

Permalink
chore(ui): rename win keys, add fallback to unix
Browse files Browse the repository at this point in the history
  • Loading branch information
Hazer committed May 6, 2024
1 parent 210e98a commit 3aa823c
Show file tree
Hide file tree
Showing 14 changed files with 105 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ const outputNamePlaceholder = (props.platform === 'windows') ? '\\.\DISPLAY1' :

<template>
<div class="mb-3">
<label for="output_name" class="form-label">{{ $tp('config.output_name', $t('config.output_name_linux')) }}</label>
<label for="output_name" class="form-label">{{ $tp('config.output_name') }}</label>
<input type="text" class="form-control" id="output_name" :placeholder="outputNamePlaceholder"
v-model="config.output_name"/>
<div class="form-text">
{{ $tp('config.output_name_desc', $t('config.output_name_desc_linux')) }}<br>
{{ $tp('config.output_name_desc') }}<br>
<PlatformLayout :platform="platform">
<template #windows>
<pre>tools\dxgi-info.exe</pre>
Expand Down
28 changes: 17 additions & 11 deletions src_assets/common/assets/web/platform-i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ class PlatformMessageI18n {

/**
* @param {string} key
* @param {string} platform identifier
* @return {string} key with platform identifier
*/
getPlatformKey(key) {
switch (this.platform) {
case 'windows':
return key + '_win'
default:
return key + '_' + this.platform
}
getPlatformKey(key, platform) {
return key + '_' + platform
}

/**
Expand All @@ -27,11 +23,21 @@ class PlatformMessageI18n {
* @return {string} translated message or defaultMsg if provided
*/
getMessageUsingPlatform(key, defaultMsg) {
const realKey = this.getPlatformKey(key)
const realKey = this.getPlatformKey(key, this.platform)
const i18n = inject('i18n')
const message = i18n.t(realKey)
if (message === realKey && defaultMsg) {
// there's no message for key, return defaultMsg
let message = i18n.t(realKey)

if (message !== realKey) {
// We got a message back, return early
return message
}

// there's no message for key, check for unix version
const unixKey = this.getPlatformKey(key, 'unix')
message = i18n.t(unixKey)

if (message === unixKey && defaultMsg) {
// there's no message for unix key, return defaultMsg
return defaultMsg
}
return message
Expand Down
14 changes: 7 additions & 7 deletions src_assets/common/assets/web/public/assets/locale/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
"adapter_name_desc_linux_1": "Geben Sie eine GPU für die Aufnahme manuell an.",
"adapter_name_desc_linux_2": "um alle Geräte zu finden, die VAAPI nutzen können",
"adapter_name_desc_linux_3": "Ersetze ``renderD129`` durch das Gerät von oben, um den Namen und die Fähigkeiten des Geräts aufzulisten. Um von Sunshine unterstützt zu werden, muss es zumindest über folgende Punkte verfügen:",
"adapter_name_desc_win": "Legen Sie eine GPU für die Aufnahme manuell fest. Falls nicht festgelegt, wird die GPU automatisch ausgewählt. Wir empfehlen dringend, dieses Feld leer zu lassen, um die automatische GPU-Auswahl zu verwenden! Hinweis: Diese GPU muss ein Display angeschlossen und eingeschaltet haben. Die passenden Werte finden Sie mit dem folgenden Befehl:",
"adapter_name_placeholder_win": "Radeon RX 580-Serie",
"adapter_name_desc_windows": "Legen Sie eine GPU für die Aufnahme manuell fest. Falls nicht festgelegt, wird die GPU automatisch ausgewählt. Wir empfehlen dringend, dieses Feld leer zu lassen, um die automatische GPU-Auswahl zu verwenden! Hinweis: Diese GPU muss ein Display angeschlossen und eingeschaltet haben. Die passenden Werte finden Sie mit dem folgenden Befehl:",
"adapter_name_placeholder_windows": "Radeon RX 580-Serie",
"add": "Neu",
"address_family": "Adressfamilie",
"address_family_both": "IPv4+IPv6",
Expand Down Expand Up @@ -123,9 +123,9 @@
"audio_sink": "Audio Sink",
"audio_sink_desc_linux": "Der Name des Audio-Spüls, der für Audio Loopback verwendet wird. Wenn Sie diese Variable nicht angeben, wählt pulseaudio das Standard-Monitorgerät. Sie können den Namen des Audiospülers mit einem Befehl finden:",
"audio_sink_desc_macos": "Der Name des für Audio Loopback verwendeten Audiosenks kann aufgrund von Systembeschränkungen nur auf Mikrofone auf macOS zugreifen. Zum Streamen von System-Audio mit Soundflower oder BlackHole.",
"audio_sink_desc_win": "Geben Sie ein bestimmtes Audiogerät für die Aufnahme manuell an. Wenn nicht gesetzt, wird das Gerät automatisch ausgewählt. Wir empfehlen dringend, dieses Feld leer zu lassen, um die automatische Geräteauswahl zu verwenden! Wenn Sie mehrere Audiogeräte mit identischen Namen haben, können Sie die Geräte-ID mit dem folgenden Befehl erhalten:",
"audio_sink_desc_windows": "Geben Sie ein bestimmtes Audiogerät für die Aufnahme manuell an. Wenn nicht gesetzt, wird das Gerät automatisch ausgewählt. Wir empfehlen dringend, dieses Feld leer zu lassen, um die automatische Geräteauswahl zu verwenden! Wenn Sie mehrere Audiogeräte mit identischen Namen haben, können Sie die Geräte-ID mit dem folgenden Befehl erhalten:",
"audio_sink_placeholder_macos": "BlackHole 2ch",
"audio_sink_placeholder_win": "Lautsprecher (High Definition Audio Device)",
"audio_sink_placeholder_windows": "Lautsprecher (High Definition Audio Device)",
"av1_mode": "AV1 Support",
"av1_mode_0": "Sunshine werbt Unterstützung für AV1 basierend auf Encoder Fähigkeiten (empfohlen)",
"av1_mode_1": "Sunshine werbt keinen Support für AV1",
Expand Down Expand Up @@ -185,7 +185,7 @@
"key_repeat_delay_desc": "Legen Sie fest, wie schnell sich die Tasten wiederholen. Die anfängliche Verzögerung in Millisekunden bevor Sie die Tasten wiederholen.",
"key_repeat_frequency": "Tastendruck-Frequenz",
"key_repeat_frequency_desc": "Wie oft Tasten jede Sekunde wiederholen. Diese konfigurierbare Option unterstützt Dezimalstellen.",
"key_rightalt_to_key_win": "Rechter Alt-Taste auf Windows-Taste zuweisen",
"key_rightalt_to_key_windows": "Rechter Alt-Taste auf Windows-Taste zuweisen",
"key_rightalt_to_key_win_desc": "Möglicherweise können Sie den Windows-Schlüssel nicht direkt von Moonlight senden. In diesen Fällen kann es nützlich sein, Sunshine glauben zu lassen, dass die rechte Alt-Taste die Windows-Taste ist",
"keyboard": "Tastatureingabe aktivieren",
"keyboard_desc": "Erlaubt Gästen das Host-System mit der Tastatur zu steuern",
Expand Down Expand Up @@ -244,9 +244,9 @@
"origin_web_ui_allowed_pc": "Nur localhost kann auf Web-UI zugreifen",
"origin_web_ui_allowed_wan": "Jeder kann auf Web-UI zugreifen",
"output_name_desc_linux": "Beim Start von Sunshine sollten Sie die Liste der erkannten Monitore sehen. Sie müssen den Wert vor dem Doppelpunkt in der Ausgabe verwenden. z.B.:",
"output_name_desc_win": "Legen Sie eine Anzeige für die Aufnahme manuell fest. Wenn diese nicht aktiviert ist, wird die primäre Anzeige aufgenommen. Hinweis: Wenn Sie eine GPU oben angegeben haben, muss diese Anzeige mit dieser GPU verbunden sein. Die entsprechenden Werte finden Sie mit dem folgenden Befehl:",
"output_name_desc_windows": "Legen Sie eine Anzeige für die Aufnahme manuell fest. Wenn diese nicht aktiviert ist, wird die primäre Anzeige aufgenommen. Hinweis: Wenn Sie eine GPU oben angegeben haben, muss diese Anzeige mit dieser GPU verbunden sein. Die entsprechenden Werte finden Sie mit dem folgenden Befehl:",
"output_name_linux": "Nummer überwachen",
"output_name_win": "Ausgabename",
"output_name_windows": "Ausgabename",
"ping_timeout": "Ping-Timeout",
"ping_timeout_desc": "Wie lange warten Sie in Millisekunden auf Daten von Mondlicht bevor Sie den Strom herunterfahren",
"pkey": "Privater Schlüssel",
Expand Down
18 changes: 9 additions & 9 deletions src_assets/common/assets/web/public/assets/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
"adapter_name_desc_linux_1": "Manually specify a GPU to use for capture.",
"adapter_name_desc_linux_2": "to find all devices capable of VAAPI",
"adapter_name_desc_linux_3": "Replace ``renderD129`` with the device from above to lists the name and capabilities of the device. To be supported by Sunshine, it needs to have at the very minimum:",
"adapter_name_desc_win": "Manually specify a GPU to use for capture. If unset, the GPU is chosen automatically. We strongly recommend leaving this field blank to use automatic GPU selection! Note: This GPU must have a display connected and powered on. The appropriate values can be found using the following command:",
"adapter_name_placeholder_win": "Radeon RX 580 Series",
"adapter_name_desc_windows": "Manually specify a GPU to use for capture. If unset, the GPU is chosen automatically. We strongly recommend leaving this field blank to use automatic GPU selection! Note: This GPU must have a display connected and powered on. The appropriate values can be found using the following command:",
"adapter_name_placeholder_windows": "Radeon RX 580 Series",
"add": "Add",
"address_family": "Address Family",
"address_family_both": "IPv4+IPv6",
Expand Down Expand Up @@ -123,9 +123,9 @@
"audio_sink": "Audio Sink",
"audio_sink_desc_linux": "The name of the audio sink used for Audio Loopback. If you do not specify this variable, pulseaudio will select the default monitor device. You can find the name of the audio sink using either command:",
"audio_sink_desc_macos": "The name of the audio sink used for Audio Loopback. Sunshine can only access microphones on macOS due to system limitations. To stream system audio using Soundflower or BlackHole.",
"audio_sink_desc_win": "Manually specify a specific audio device to capture. If unset, the device is chosen automatically. We strongly recommend leaving this field blank to use automatic device selection! If you have multiple audio devices with identical names, you can get the Device ID using the following command:",
"audio_sink_desc_windows": "Manually specify a specific audio device to capture. If unset, the device is chosen automatically. We strongly recommend leaving this field blank to use automatic device selection! If you have multiple audio devices with identical names, you can get the Device ID using the following command:",
"audio_sink_placeholder_macos": "BlackHole 2ch",
"audio_sink_placeholder_win": "Speakers (High Definition Audio Device)",
"audio_sink_placeholder_windows": "Speakers (High Definition Audio Device)",
"av1_mode": "AV1 Support",
"av1_mode_0": "Sunshine will advertise support for AV1 based on encoder capabilities (recommended)",
"av1_mode_1": "Sunshine will not advertise support for AV1",
Expand Down Expand Up @@ -185,7 +185,7 @@
"key_repeat_delay_desc": "Control how fast keys will repeat themselves. The initial delay in milliseconds before repeating keys.",
"key_repeat_frequency": "Key Repeat Frequency",
"key_repeat_frequency_desc": "How often keys repeat every second. This configurable option supports decimals.",
"key_rightalt_to_key_win": "Map Right Alt key to Windows key",
"key_rightalt_to_key_windows": "Map Right Alt key to Windows key",
"key_rightalt_to_key_win_desc": "It may be possible that you cannot send the Windows Key from Moonlight directly. In those cases it may be useful to make Sunshine think the Right Alt key is the Windows key",
"keyboard": "Enable Keyboard Input",
"keyboard_desc": "Allows guests to control the host system with the keyboard",
Expand Down Expand Up @@ -243,10 +243,10 @@
"origin_web_ui_allowed_lan": "Only those in LAN may access Web UI",
"origin_web_ui_allowed_pc": "Only localhost may access Web UI",
"origin_web_ui_allowed_wan": "Anyone may access Web UI",
"output_name_desc_linux": "During Sunshine startup, you should see the list of detected displays. Note: You need to use the id value inside the parenthesis.",
"output_name_desc_win": "Manually specify a display to use for capture. If unset, the primary display is captured. Note: If you specified a GPU above, this display must be connected to that GPU. The appropriate values can be found using the following command:",
"output_name_linux": "Display number",
"output_name_win": "Output Name",
"output_name_desc_unix": "During Sunshine startup, you should see the list of detected displays. Note: You need to use the id value inside the parenthesis.",
"output_name_desc_windows": "Manually specify a display to use for capture. If unset, the primary display is captured. Note: If you specified a GPU above, this display must be connected to that GPU. The appropriate values can be found using the following command:",
"output_name_unix": "Display number",
"output_name_windows": "Output Name",
"ping_timeout": "Ping Timeout",
"ping_timeout_desc": "How long to wait in milliseconds for data from moonlight before shutting down the stream",
"pkey": "Private Key",
Expand Down
14 changes: 7 additions & 7 deletions src_assets/common/assets/web/public/assets/locale/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
"adapter_name_desc_linux_1": "Manually specify a GPU to use for capture.",
"adapter_name_desc_linux_2": "to find all devices capable of VAAPI",
"adapter_name_desc_linux_3": "Replace ``renderD129`` with the device from above to lists the name and capabilities of the device. To be supported by Sunshine, it needs to have at the very minimum:",
"adapter_name_desc_win": "Manually specify a GPU to use for capture. If unset, the GPU is chosen automatically. We strongly recommend leaving this field blank to use automatic GPU selection! Note: This GPU must have a display connected and powered on. The appropriate values can be found using the following command:",
"adapter_name_placeholder_win": "Radeon RX 580 Series",
"adapter_name_desc_windows": "Manually specify a GPU to use for capture. If unset, the GPU is chosen automatically. We strongly recommend leaving this field blank to use automatic GPU selection! Note: This GPU must have a display connected and powered on. The appropriate values can be found using the following command:",
"adapter_name_placeholder_windows": "Radeon RX 580 Series",
"add": "Add",
"address_family": "Address Family",
"address_family_both": "IPv4+IPv6",
Expand Down Expand Up @@ -123,9 +123,9 @@
"audio_sink": "Audio Sink",
"audio_sink_desc_linux": "The name of the audio sink used for Audio Loopback. If you do not specify this variable, pulseaudio will select the default monitor device. You can find the name of the audio sink using either command:",
"audio_sink_desc_macos": "The name of the audio sink used for Audio Loopback. Sunshine can only access microphones on macOS due to system limitations. To stream system audio using Soundflower or BlackHole.",
"audio_sink_desc_win": "Manually specify a specific audio device to capture. If unset, the device is chosen automatically. We strongly recommend leaving this field blank to use automatic device selection! If you have multiple audio devices with identical names, you can get the Device ID using the following command:",
"audio_sink_desc_windows": "Manually specify a specific audio device to capture. If unset, the device is chosen automatically. We strongly recommend leaving this field blank to use automatic device selection! If you have multiple audio devices with identical names, you can get the Device ID using the following command:",
"audio_sink_placeholder_macos": "BlackHole 2ch",
"audio_sink_placeholder_win": "Speakers (High Definition Audio Device)",
"audio_sink_placeholder_windows": "Speakers (High Definition Audio Device)",
"av1_mode": "AV1 Support",
"av1_mode_0": "Sunshine will advertise support for AV1 based on encoder capabilities (recommended)",
"av1_mode_1": "Sunshine will not advertise support for AV1",
Expand Down Expand Up @@ -185,7 +185,7 @@
"key_repeat_delay_desc": "Control how fast keys will repeat themselves. The initial delay in milliseconds before repeating keys.",
"key_repeat_frequency": "Key Repeat Frequency",
"key_repeat_frequency_desc": "How often keys repeat every second. This configurable option supports decimals.",
"key_rightalt_to_key_win": "Map Right Alt key to Windows key",
"key_rightalt_to_key_windows": "Map Right Alt key to Windows key",
"key_rightalt_to_key_win_desc": "It may be possible that you cannot send the Windows Key from Moonlight directly. In those cases it may be useful to make Sunshine think the Right Alt key is the Windows key",
"keyboard": "Enable Keyboard Input",
"keyboard_desc": "Allows guests to control the host system with the keyboard",
Expand Down Expand Up @@ -244,9 +244,9 @@
"origin_web_ui_allowed_pc": "Only localhost may access Web UI",
"origin_web_ui_allowed_wan": "Anyone may access Web UI",
"output_name_desc_linux": "During Sunshine startup, you should see the list of detected monitors. You need to use the value before the colon in the output. e.g.:",
"output_name_desc_win": "Manually specify a display to use for capture. If unset, the primary display is captured. Note: If you specified a GPU above, this display must be connected to that GPU. The appropriate values can be found using the following command:",
"output_name_desc_windows": "Manually specify a display to use for capture. If unset, the primary display is captured. Note: If you specified a GPU above, this display must be connected to that GPU. The appropriate values can be found using the following command:",
"output_name_linux": "Monitor number",
"output_name_win": "Output Name",
"output_name_windows": "Output Name",
"ping_timeout": "Ping Timeout",
"ping_timeout_desc": "How long to wait in milliseconds for data from moonlight before shutting down the stream",
"pkey": "Private Key",
Expand Down
Loading

0 comments on commit 3aa823c

Please sign in to comment.