mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-31 07:59:27 +02:00
Internationalize audio and midi device info reports...
... following the substitute, don't concatenate rule in many places. The end users have commands to generate these reports in menus, so they should be translated then; however, they are also part of crash reports meant for developers, so temporarily set English locale for generating those.
This commit is contained in:
parent
6ce24d3cd8
commit
5aa08950a5
@ -1162,6 +1162,10 @@ void AudacityApp::GenerateCrashReport(wxDebugReport::Context ctx)
|
|||||||
|
|
||||||
if (ctx == wxDebugReport::Context_Current)
|
if (ctx == wxDebugReport::Context_Current)
|
||||||
{
|
{
|
||||||
|
auto saveLang = GetLang();
|
||||||
|
InitLang( wxT("en") );
|
||||||
|
auto cleanup = finally( [&]{ InitLang( saveLang ); } );
|
||||||
|
|
||||||
rpt.AddText(wxT("audiodev.txt"), gAudioIO->GetDeviceInfo(), wxT("Audio Device Info"));
|
rpt.AddText(wxT("audiodev.txt"), gAudioIO->GetDeviceInfo(), wxT("Audio Device Info"));
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
rpt.AddText(wxT("mididev.txt"), gAudioIO->GetMidiDeviceInfo(), wxT("MIDI Device Info"));
|
rpt.AddText(wxT("mididev.txt"), gAudioIO->GetMidiDeviceInfo(), wxT("MIDI Device Info"));
|
||||||
|
166
src/AudioIO.cpp
166
src/AudioIO.cpp
@ -3410,10 +3410,9 @@ wxString AudioIO::GetDeviceInfo()
|
|||||||
{
|
{
|
||||||
wxStringOutputStream o;
|
wxStringOutputStream o;
|
||||||
wxTextOutputStream s(o, wxEOL_UNIX);
|
wxTextOutputStream s(o, wxEOL_UNIX);
|
||||||
wxString e(wxT("\n"));
|
|
||||||
|
|
||||||
if (IsStreamActive()) {
|
if (IsStreamActive()) {
|
||||||
return wxT("Stream is active ... unable to gather information.");
|
return _("Stream is active ... unable to gather information.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3422,11 +3421,12 @@ wxString AudioIO::GetDeviceInfo()
|
|||||||
int playDeviceNum = Pa_GetDefaultOutputDevice();
|
int playDeviceNum = Pa_GetDefaultOutputDevice();
|
||||||
int cnt = Pa_GetDeviceCount();
|
int cnt = Pa_GetDeviceCount();
|
||||||
|
|
||||||
|
// PRL: why only into the log?
|
||||||
wxLogDebug(wxT("Portaudio reports %d audio devices"),cnt);
|
wxLogDebug(wxT("Portaudio reports %d audio devices"),cnt);
|
||||||
|
|
||||||
s << wxT("==============================") << e;
|
s << wxT("==============================\n");
|
||||||
s << wxT("Default recording device number: ") << recDeviceNum << e;
|
s << wxString::Format(_("Default recording device number: %d\n"), recDeviceNum);
|
||||||
s << wxT("Default playback device number: ") << playDeviceNum << e;
|
s << wxString::Format(_("Default playback device number: %d\n"), playDeviceNum);
|
||||||
|
|
||||||
wxString recDevice = gPrefs->Read(wxT("/AudioIO/RecordingDevice"), wxT(""));
|
wxString recDevice = gPrefs->Read(wxT("/AudioIO/RecordingDevice"), wxT(""));
|
||||||
wxString playDevice = gPrefs->Read(wxT("/AudioIO/PlaybackDevice"), wxT(""));
|
wxString playDevice = gPrefs->Read(wxT("/AudioIO/PlaybackDevice"), wxT(""));
|
||||||
@ -3434,37 +3434,38 @@ wxString AudioIO::GetDeviceInfo()
|
|||||||
|
|
||||||
// This gets info on all available audio devices (input and output)
|
// This gets info on all available audio devices (input and output)
|
||||||
if (cnt <= 0) {
|
if (cnt <= 0) {
|
||||||
s << wxT("No devices found\n");
|
s << _("No devices found\n");
|
||||||
return o.GetString();
|
return o.GetString();
|
||||||
}
|
}
|
||||||
|
|
||||||
const PaDeviceInfo* info;
|
const PaDeviceInfo* info;
|
||||||
|
|
||||||
for (j = 0; j < cnt; j++) {
|
for (j = 0; j < cnt; j++) {
|
||||||
s << wxT("==============================") << e;
|
s << wxT("==============================\n");
|
||||||
|
|
||||||
info = Pa_GetDeviceInfo(j);
|
info = Pa_GetDeviceInfo(j);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
s << wxT("Device info unavailable for: ") << j << wxT("\n");
|
s << wxString::Format(_("Device info unavailable for: %d\n"), j);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString name = DeviceName(info);
|
wxString name = DeviceName(info);
|
||||||
s << wxT("Device ID: ") << j << e;
|
s << wxString::Format(_("Device ID: %d\n"), j);
|
||||||
s << wxT("Device name: ") << name << e;
|
s << wxString::Format(_("Device name: %s\n"), name);
|
||||||
s << wxT("Host name: ") << HostName(info) << e;
|
s << wxString::Format(_("Host name: %s\n"), HostName(info));
|
||||||
s << wxT("Recording channels: ") << info->maxInputChannels << e;
|
s << wxString::Format(_("Recording channels: %d\n"), info->maxInputChannels);
|
||||||
s << wxT("Playback channels: ") << info->maxOutputChannels << e;
|
s << wxString::Format(_("Playback channels: %d\n"), info->maxOutputChannels);
|
||||||
s << wxT("Low Recording Latency: ") << info->defaultLowInputLatency << e;
|
s << wxString::Format(_("Low Recording Latency: %g\n"), info->defaultLowInputLatency);
|
||||||
s << wxT("Low Playback Latency: ") << info->defaultLowOutputLatency << e;
|
s << wxString::Format(_("Low Playback Latency: %g\n"), info->defaultLowOutputLatency);
|
||||||
s << wxT("High Recording Latency: ") << info->defaultHighInputLatency << e;
|
s << wxString::Format(_("High Recording Latency: %g\n"), info->defaultHighInputLatency);
|
||||||
s << wxT("High Playback Latency: ") << info->defaultHighOutputLatency << e;
|
s << wxString::Format(_("High Playback Latency: %g\n"), info->defaultHighOutputLatency);
|
||||||
|
|
||||||
auto rates = GetSupportedPlaybackRates(j, 0.0);
|
auto rates = GetSupportedPlaybackRates(j, 0.0);
|
||||||
|
|
||||||
s << wxT("Supported Rates:") << e;
|
/* i18n-hint: Supported, meaning made available by the system */
|
||||||
|
s << _("Supported Rates:\n");
|
||||||
for (int k = 0; k < (int) rates.size(); k++) {
|
for (int k = 0; k < (int) rates.size(); k++) {
|
||||||
s << wxT(" ") << (int)rates[k] << e;
|
s << wxT(" ") << (int)rates[k] << wxT("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == playDevice && info->maxOutputChannels > 0)
|
if (name == playDevice && info->maxOutputChannels > 0)
|
||||||
@ -3486,29 +3487,29 @@ wxString AudioIO::GetDeviceInfo()
|
|||||||
bool haveRecDevice = (recDeviceNum >= 0);
|
bool haveRecDevice = (recDeviceNum >= 0);
|
||||||
bool havePlayDevice = (playDeviceNum >= 0);
|
bool havePlayDevice = (playDeviceNum >= 0);
|
||||||
|
|
||||||
s << wxT("==============================") << e;
|
s << wxT("==============================\n");
|
||||||
if(haveRecDevice){
|
if (haveRecDevice)
|
||||||
s << wxT("Selected recording device: ") << recDeviceNum << wxT(" - ") << recDevice << e;
|
s << wxString::Format(_("Selected recording device: %d - %s\n"), recDeviceNum, recDevice);
|
||||||
}else{
|
else
|
||||||
s << wxT("No recording device found for '") << recDevice << wxT("'.") << e;
|
s << wxString::Format(_("No recording device found for '%s'.\n"), recDevice);
|
||||||
}
|
|
||||||
if(havePlayDevice){
|
if (havePlayDevice)
|
||||||
s << wxT("Selected playback device: ") << playDeviceNum << wxT(" - ") << playDevice << e;
|
s << wxString::Format(_("Selected playback device: %d - %s\n"), playDeviceNum, playDevice);
|
||||||
}else{
|
else
|
||||||
s << wxT("No playback device found for '") << playDevice << wxT("'.") << e;
|
s << wxString::Format(_("No playback device found for '%s'.\n"), playDevice);
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<long> supportedSampleRates;
|
std::vector<long> supportedSampleRates;
|
||||||
|
|
||||||
if(havePlayDevice && haveRecDevice){
|
if (havePlayDevice && haveRecDevice) {
|
||||||
supportedSampleRates = GetSupportedSampleRates(playDeviceNum, recDeviceNum);
|
supportedSampleRates = GetSupportedSampleRates(playDeviceNum, recDeviceNum);
|
||||||
|
|
||||||
s << wxT("Supported Rates:") << e;
|
s << _("Supported Rates:\n");
|
||||||
for (int k = 0; k < (int) supportedSampleRates.size(); k++) {
|
for (int k = 0; k < (int) supportedSampleRates.size(); k++) {
|
||||||
s << wxT(" ") << (int)supportedSampleRates[k] << e;
|
s << wxT(" ") << (int)supportedSampleRates[k] << wxT("\n");
|
||||||
}
|
}
|
||||||
}else{
|
}
|
||||||
s << wxT("Cannot check mutual sample rates without both devices.") << e;
|
else {
|
||||||
|
s << _("Cannot check mutual sample rates without both devices.\n");
|
||||||
return o.GetString();
|
return o.GetString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3567,42 +3568,42 @@ wxString AudioIO::GetDeviceInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
s << wxT("Received ") << error << wxT(" while opening devices") << e;
|
s << wxString::Format(_("Received %d while opening devices\n"), error);
|
||||||
return o.GetString();
|
return o.GetString();
|
||||||
}
|
}
|
||||||
|
|
||||||
PxMixer *PortMixer = Px_OpenMixer(stream, 0);
|
PxMixer *PortMixer = Px_OpenMixer(stream, 0);
|
||||||
|
|
||||||
if (!PortMixer) {
|
if (!PortMixer) {
|
||||||
s << wxT("Unable to open Portmixer") << e;
|
s << _("Unable to open Portmixer\n");
|
||||||
Pa_CloseStream(stream);
|
Pa_CloseStream(stream);
|
||||||
return o.GetString();
|
return o.GetString();
|
||||||
}
|
}
|
||||||
|
|
||||||
s << wxT("==============================") << e;
|
s << wxT("==============================\n");
|
||||||
s << wxT("Available mixers:") << e;
|
s << _("Available mixers:\n");
|
||||||
|
|
||||||
// FIXME: ? PortMixer errors on query not reported in GetDeviceInfo
|
// FIXME: ? PortMixer errors on query not reported in GetDeviceInfo
|
||||||
cnt = Px_GetNumMixers(stream);
|
cnt = Px_GetNumMixers(stream);
|
||||||
for (int i = 0; i < cnt; i++) {
|
for (int i = 0; i < cnt; i++) {
|
||||||
wxString name = wxSafeConvertMB2WX(Px_GetMixerName(stream, i));
|
wxString name = wxSafeConvertMB2WX(Px_GetMixerName(stream, i));
|
||||||
s << i << wxT(" - ") << name << e;
|
s << wxString::Format(_("%d - %s\n"), i, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
s << wxT("==============================") << e;
|
s << wxT("==============================\n");
|
||||||
s << wxT("Available recording sources:") << e;
|
s << _("Available recording sources:\n");
|
||||||
cnt = Px_GetNumInputSources(PortMixer);
|
cnt = Px_GetNumInputSources(PortMixer);
|
||||||
for (int i = 0; i < cnt; i++) {
|
for (int i = 0; i < cnt; i++) {
|
||||||
wxString name = wxSafeConvertMB2WX(Px_GetInputSourceName(PortMixer, i));
|
wxString name = wxSafeConvertMB2WX(Px_GetInputSourceName(PortMixer, i));
|
||||||
s << i << wxT(" - ") << name << e;
|
s << wxString::Format(_("%d - %s\n"), i, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
s << wxT("==============================") << e;
|
s << wxT("==============================\n");
|
||||||
s << wxT("Available playback volumes:") << e;
|
s << _("Available playback volumes:\n");
|
||||||
cnt = Px_GetNumOutputVolumes(PortMixer);
|
cnt = Px_GetNumOutputVolumes(PortMixer);
|
||||||
for (int i = 0; i < cnt; i++) {
|
for (int i = 0; i < cnt; i++) {
|
||||||
wxString name = wxSafeConvertMB2WX(Px_GetOutputVolumeName(PortMixer, i));
|
wxString name = wxSafeConvertMB2WX(Px_GetOutputVolumeName(PortMixer, i));
|
||||||
s << i << wxT(" - ") << name << e;
|
s << wxString::Format(_("%d - %s\n"), i, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine mixer capabilities - it it doesn't support either
|
// Determine mixer capabilities - it it doesn't support either
|
||||||
@ -3633,9 +3634,13 @@ wxString AudioIO::GetDeviceInfo()
|
|||||||
|
|
||||||
Pa_CloseStream(stream);
|
Pa_CloseStream(stream);
|
||||||
|
|
||||||
s << wxT("==============================") << e;
|
s << wxT("==============================\n");
|
||||||
s << wxT("Recording volume is ") << (EmulateMixerInputVol? wxT("emulated"): wxT("native")) << e;
|
s << ( EmulateMixerInputVol
|
||||||
s << wxT("Playback volume is ") << (EmulateMixerOutputVol? wxT("emulated"): wxT("native")) << e;
|
? _("Recording volume is emulated\n")
|
||||||
|
: _("Recording volume is native\n") );
|
||||||
|
s << ( EmulateMixerOutputVol
|
||||||
|
? _("Playback volume is emulated\n")
|
||||||
|
: _("Playback volume is native\n") );
|
||||||
|
|
||||||
Px_CloseMixer(PortMixer);
|
Px_CloseMixer(PortMixer);
|
||||||
|
|
||||||
@ -3650,10 +3655,9 @@ wxString AudioIO::GetMidiDeviceInfo()
|
|||||||
{
|
{
|
||||||
wxStringOutputStream o;
|
wxStringOutputStream o;
|
||||||
wxTextOutputStream s(o, wxEOL_UNIX);
|
wxTextOutputStream s(o, wxEOL_UNIX);
|
||||||
wxString e(wxT("\n"));
|
|
||||||
|
|
||||||
if (IsStreamActive()) {
|
if (IsStreamActive()) {
|
||||||
return wxT("Stream is active ... unable to gather information.");
|
return _("Stream is active ... unable to gather information.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3662,39 +3666,41 @@ wxString AudioIO::GetMidiDeviceInfo()
|
|||||||
int playDeviceNum = Pm_GetDefaultOutputDeviceID();
|
int playDeviceNum = Pm_GetDefaultOutputDeviceID();
|
||||||
int cnt = Pm_CountDevices();
|
int cnt = Pm_CountDevices();
|
||||||
|
|
||||||
|
// PRL: why only into the log?
|
||||||
wxLogDebug(wxT("PortMidi reports %d MIDI devices"), cnt);
|
wxLogDebug(wxT("PortMidi reports %d MIDI devices"), cnt);
|
||||||
|
|
||||||
s << wxT("==============================") << e;
|
s << wxT("==============================\n");
|
||||||
s << wxT("Default recording device number: ") << recDeviceNum << e;
|
s << wxString::Format(_("Default recording device number: %d\n"), recDeviceNum);
|
||||||
s << wxT("Default playback device number: ") << playDeviceNum << e;
|
s << wxString::Format(_("Default playback device number: %d\n"), playDeviceNum);
|
||||||
|
|
||||||
wxString recDevice = gPrefs->Read(wxT("/MidiIO/RecordingDevice"), wxT(""));
|
wxString recDevice = gPrefs->Read(wxT("/MidiIO/RecordingDevice"), wxT(""));
|
||||||
wxString playDevice = gPrefs->Read(wxT("/MidiIO/PlaybackDevice"), wxT(""));
|
wxString playDevice = gPrefs->Read(wxT("/MidiIO/PlaybackDevice"), wxT(""));
|
||||||
|
|
||||||
// This gets info on all available audio devices (input and output)
|
// This gets info on all available audio devices (input and output)
|
||||||
if (cnt <= 0) {
|
if (cnt <= 0) {
|
||||||
s << wxT("No devices found\n");
|
s << _("No devices found\n");
|
||||||
return o.GetString();
|
return o.GetString();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < cnt; i++) {
|
for (int i = 0; i < cnt; i++) {
|
||||||
s << wxT("==============================") << e;
|
s << wxT("==============================\n");
|
||||||
|
|
||||||
const PmDeviceInfo* info = Pm_GetDeviceInfo(i);
|
const PmDeviceInfo* info = Pm_GetDeviceInfo(i);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
s << wxT("Device info unavailable for: ") << i << e;
|
s << wxString::Format(_("Device info unavailable for: %d\n"), i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString name = wxSafeConvertMB2WX(info->name);
|
wxString name = wxSafeConvertMB2WX(info->name);
|
||||||
wxString hostName = wxSafeConvertMB2WX(info->interf);
|
wxString hostName = wxSafeConvertMB2WX(info->interf);
|
||||||
|
|
||||||
s << wxT("Device ID: ") << i << e;
|
s << wxString::Format(_("Device ID: %d\n"), i);
|
||||||
s << wxT("Device name: ") << name << e;
|
s << wxString::Format(_("Device name: %s\n"), name);
|
||||||
s << wxT("Host name: ") << hostName << e;
|
s << wxString::Format(_("Host name: %s\n"), hostName);
|
||||||
s << wxT("Supports output: ") << info->output << e;
|
/* i18n-hint: Supported, meaning made available by the system */
|
||||||
s << wxT("Supports input: ") << info->input << e;
|
s << wxString::Format(_("Supports output: %d\n"), info->output);
|
||||||
s << wxT("Opened: ") << info->opened << e;
|
s << wxString::Format(_("Supports input: %d\n"), info->input);
|
||||||
|
s << wxString::Format(_("Opened: %d\n"), info->opened);
|
||||||
|
|
||||||
if (name == playDevice && info->output)
|
if (name == playDevice && info->output)
|
||||||
playDeviceNum = i;
|
playDeviceNum = i;
|
||||||
@ -3715,31 +3721,31 @@ wxString AudioIO::GetMidiDeviceInfo()
|
|||||||
bool haveRecDevice = (recDeviceNum >= 0);
|
bool haveRecDevice = (recDeviceNum >= 0);
|
||||||
bool havePlayDevice = (playDeviceNum >= 0);
|
bool havePlayDevice = (playDeviceNum >= 0);
|
||||||
|
|
||||||
s << wxT("==============================") << e;
|
s << wxT("==============================\n");
|
||||||
if (haveRecDevice) {
|
if (haveRecDevice)
|
||||||
s << wxT("Selected MIDI recording device: ") << recDeviceNum << wxT(" - ") << recDevice << e;
|
s << wxString::Format(_("Selected MIDI recording device: %d - %s\n"), recDeviceNum, recDevice);
|
||||||
} else {
|
else
|
||||||
s << wxT("No MIDI recording device found for '") << recDevice << wxT("'.") << e;
|
s << wxString::Format(_("No MIDI recording device found for '%s'.\n"), recDevice);
|
||||||
}
|
|
||||||
if (havePlayDevice) {
|
if (havePlayDevice)
|
||||||
s << wxT("Selected MIDI playback device: ") << playDeviceNum << wxT(" - ") << playDevice << e;
|
s << wxString::Format(_("Selected MIDI playback device: %d - %s\n"), playDeviceNum, playDevice);
|
||||||
} else {
|
else
|
||||||
s << wxT("No MIDI playback device found for '") << playDevice << wxT("'.") << e;
|
s << wxString::Format(_("No MIDI playback device found for '%s'.\n"), playDevice);
|
||||||
}
|
|
||||||
|
|
||||||
// Mention our conditional compilation flags for Alpha only
|
// Mention our conditional compilation flags for Alpha only
|
||||||
#ifdef IS_ALPHA
|
#ifdef IS_ALPHA
|
||||||
|
|
||||||
s << wxT("==============================") << e;
|
// Not internationalizing these alpha-only messages
|
||||||
|
s << wxT("==============================\n");
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
s << wxT("EXPERIMENTAL_MIDI_OUT is enabled") << e;
|
s << wxT("EXPERIMENTAL_MIDI_OUT is enabled\n");
|
||||||
#else
|
#else
|
||||||
s << wxT("EXPERIMENTAL_MIDI_OUT is NOT enabled") << e;
|
s << wxT("EXPERIMENTAL_MIDI_OUT is NOT enabled\n");
|
||||||
#endif
|
#endif
|
||||||
#ifdef EXPERIMENTAL_MIDI_IN
|
#ifdef EXPERIMENTAL_MIDI_IN
|
||||||
s << wxT("EXPERIMENTAL_MIDI_IN is enabled") << e;
|
s << wxT("EXPERIMENTAL_MIDI_IN is enabled\n");
|
||||||
#else
|
#else
|
||||||
s << wxT("EXPERIMENTAL_MIDI_IN is NOT enabled") << e;
|
s << wxT("EXPERIMENTAL_MIDI_IN is NOT enabled\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user