config: put alerts text to locale data

This commit is contained in:
Stéphane L
2019-04-22 15:43:41 +02:00
parent 1c17eee125
commit 0fb50a3273
2 changed files with 12 additions and 12 deletions

View File

@ -12,3 +12,6 @@ OBSWebsocket.NotifyDisconnect.Title="WebSocket client disconnected"
OBSWebsocket.NotifyDisconnect.Message="Client %1 disconnected" OBSWebsocket.NotifyDisconnect.Message="Client %1 disconnected"
OBSWebsocket.Server.StartFailed.Title="WebSocket Server failure" OBSWebsocket.Server.StartFailed.Title="WebSocket Server failure"
OBSWebsocket.Server.StartFailed.Message="The obs-websocket server failed to start, maybe because:\n - TCP port %1 may currently be in use elsewhere on this system, possibly by another application. Try setting a different TCP port in the WebSocket server settings, or stop any application that could be using this port.\n - An unknown network error happened on your system. Try again by changing settings, restarting OBS or restarting your system." OBSWebsocket.Server.StartFailed.Message="The obs-websocket server failed to start, maybe because:\n - TCP port %1 may currently be in use elsewhere on this system, possibly by another application. Try setting a different TCP port in the WebSocket server settings, or stop any application that could be using this port.\n - An unknown network error happened on your system. Try again by changing settings, restarting OBS or restarting your system."
OBSWebsocket.ProfileChanged.Started="WebSockets server enabled in this profile. Server started."
OBSWebsocket.ProfileChanged.Stopped="WebSockets server disabled in this profile. Server stopped."
OBSWebsocket.ProfileChanged.Restarted="WebSockets server port changed in this profile. Server restarted."

View File

@ -203,6 +203,12 @@ void Config::OnFrontendEvent(enum obs_frontend_event event, void* param)
{ {
auto config = reinterpret_cast<Config*>(param); auto config = reinterpret_cast<Config*>(param);
obs_frontend_push_ui_translation(obs_module_get_string);
QString startMessage = QObject::tr("OBSWebsocket.ProfileChanged.Started");
QString stopMessage = QObject::tr("OBSWebsocket.ProfileChanged.Stopped");
QString restartMessage = QObject::tr("OBSWebsocket.ProfileChanged.Restarted");
obs_frontend_pop_ui_translation();
if (event == OBS_FRONTEND_EVENT_PROFILE_CHANGED) { if (event == OBS_FRONTEND_EVENT_PROFILE_CHANGED) {
auto previousEnabled = config->ServerEnabled; auto previousEnabled = config->ServerEnabled;
auto previousPort = config->ServerPort; auto previousPort = config->ServerPort;
@ -218,21 +224,12 @@ void Config::OnFrontendEvent(enum obs_frontend_event event, void* param)
server->start(config->ServerPort); server->start(config->ServerPort);
if (previousEnabled != config->ServerEnabled) { if (previousEnabled != config->ServerEnabled) {
Utils::SysTrayNotify( Utils::SysTrayNotify(startMessage, QSystemTrayIcon::MessageIcon::Information);
QString("WebSockets server enabled in this profile. Server started."),
QSystemTrayIcon::MessageIcon::Information
);
} else { } else {
Utils::SysTrayNotify( Utils::SysTrayNotify(restartMessage, QSystemTrayIcon::MessageIcon::Information);
QString("WebSockets server port changed in this profile. Server restarted."),
QSystemTrayIcon::MessageIcon::Information
);
} }
} else { } else {
Utils::SysTrayNotify( Utils::SysTrayNotify(stopMessage, QSystemTrayIcon::MessageIcon::Information);
QString("WebSockets server disabled in this profile. Server stopped."),
QSystemTrayIcon::MessageIcon::Information
);
} }
} }
} }