mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-03-31 09:17:04 +09:00
Properly use system language when language is set to system language, add missing translations
This commit is contained in:
@@ -31,13 +31,6 @@ namespace gsr {
|
|||||||
return "en";
|
return "en";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Translation::trim(const std::string& str) {
|
|
||||||
size_t start = str.find_first_not_of(" \t\r\n");
|
|
||||||
if (start == std::string::npos) return "";
|
|
||||||
size_t end = str.find_last_not_of(" \t\r\n");
|
|
||||||
return str.substr(start, end - start + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Translation::process_escapes(std::string& str) {
|
void Translation::process_escapes(std::string& str) {
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
while ((pos = str.find("\\n", pos)) != std::string::npos) {
|
while ((pos = str.find("\\n", pos)) != std::string::npos) {
|
||||||
@@ -93,8 +86,6 @@ namespace gsr {
|
|||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
while (std::getline(file, line)) {
|
while (std::getline(file, line)) {
|
||||||
line = trim(line);
|
|
||||||
|
|
||||||
if (line.empty() || line[0] == '#') continue;
|
if (line.empty() || line[0] == '#') continue;
|
||||||
|
|
||||||
size_t eq_pos = line.find('=');
|
size_t eq_pos = line.find('=');
|
||||||
@@ -124,6 +115,9 @@ namespace gsr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Translation::init(const char* translations_directory, const char* initial_language) {
|
void Translation::init(const char* translations_directory, const char* initial_language) {
|
||||||
|
if(initial_language && initial_language[0] == '\0')
|
||||||
|
initial_language = nullptr;
|
||||||
|
|
||||||
this->translations_directory = translations_directory;
|
this->translations_directory = translations_directory;
|
||||||
|
|
||||||
load_language(initial_language == nullptr ? get_system_language().c_str() : initial_language);
|
load_language(initial_language == nullptr ? get_system_language().c_str() : initial_language);
|
||||||
|
|||||||
@@ -528,6 +528,7 @@ namespace gsr {
|
|||||||
language_combo_box_ptr = combo_box.get();
|
language_combo_box_ptr = combo_box.get();
|
||||||
combo_box->add_item(TR("System language"), "");
|
combo_box->add_item(TR("System language"), "");
|
||||||
combo_box->add_item("English", "en");
|
combo_box->add_item("English", "en");
|
||||||
|
combo_box->add_item("Español", "es");
|
||||||
combo_box->add_item("Русский", "ru");
|
combo_box->add_item("Русский", "ru");
|
||||||
combo_box->add_item("Українська", "uk");
|
combo_box->add_item("Українська", "uk");
|
||||||
combo_box->on_selection_changed = [](const std::string&, const std::string &id) {
|
combo_box->on_selection_changed = [](const std::string&, const std::string &id) {
|
||||||
|
|||||||
@@ -1127,7 +1127,7 @@ namespace gsr {
|
|||||||
std::unique_ptr<RadioButton> SettingsPage::create_start_replay_automatically() {
|
std::unique_ptr<RadioButton> SettingsPage::create_start_replay_automatically() {
|
||||||
// TODO: Support kde plasma wayland and hyprland (same ones that support getting window title)
|
// TODO: Support kde plasma wayland and hyprland (same ones that support getting window title)
|
||||||
char fullscreen_text[256];
|
char fullscreen_text[256];
|
||||||
snprintf(fullscreen_text, sizeof(fullscreen_text), TR("Turn on replay when starting a fullscreen application%s"), gsr_info->system_info.display_server == DisplayServer::X11 ? "" : " (X11 applications only)");
|
snprintf(fullscreen_text, sizeof(fullscreen_text), TR("Turn on replay when starting a fullscreen application%s"), gsr_info->system_info.display_server == DisplayServer::X11 ? "" : TR(" (X11 applications only)"));
|
||||||
|
|
||||||
auto radiobutton = std::make_unique<RadioButton>(&get_theme().body_font, RadioButton::Orientation::VERTICAL);
|
auto radiobutton = std::make_unique<RadioButton>(&get_theme().body_font, RadioButton::Orientation::VERTICAL);
|
||||||
radiobutton->add_item(TR("Don't turn on replay automatically"), "dont_turn_on_automatically");
|
radiobutton->add_item(TR("Don't turn on replay automatically"), "dont_turn_on_automatically");
|
||||||
@@ -1140,7 +1140,7 @@ namespace gsr {
|
|||||||
|
|
||||||
std::unique_ptr<CheckBox> SettingsPage::create_save_replay_in_game_folder() {
|
std::unique_ptr<CheckBox> SettingsPage::create_save_replay_in_game_folder() {
|
||||||
char text[256];
|
char text[256];
|
||||||
snprintf(text, sizeof(text), TR("Save video in a folder based on the focused applications name%s"), supports_window_title ? "" : " (X11 applications only)");
|
snprintf(text, sizeof(text), TR("Save video in a folder based on the focused applications name%s"), supports_window_title ? "" : TR(" (X11 applications only)"));
|
||||||
auto checkbox = std::make_unique<CheckBox>(&get_theme().body_font, text);
|
auto checkbox = std::make_unique<CheckBox>(&get_theme().body_font, text);
|
||||||
save_replay_in_game_folder_ptr = checkbox.get();
|
save_replay_in_game_folder_ptr = checkbox.get();
|
||||||
return checkbox;
|
return checkbox;
|
||||||
@@ -1153,7 +1153,7 @@ namespace gsr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Label> SettingsPage::create_estimated_replay_file_size() {
|
std::unique_ptr<Label> SettingsPage::create_estimated_replay_file_size() {
|
||||||
auto label = std::make_unique<Label>(&get_theme().body_font, TR("Estimated video max file size in RAM: 57.60MB"), get_color_theme().text_color);
|
auto label = std::make_unique<Label>(&get_theme().body_font, "Estimated video max file size in RAM: 57.60MB", get_color_theme().text_color);
|
||||||
estimated_file_size_ptr = label.get();
|
estimated_file_size_ptr = label.get();
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
@@ -1272,7 +1272,7 @@ namespace gsr {
|
|||||||
general_list->add_widget(create_low_power_mode());
|
general_list->add_widget(create_low_power_mode());
|
||||||
|
|
||||||
settings_list_ptr->add_widget(std::make_unique<Subsection>(TR("General"), std::move(general_list), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)));
|
settings_list_ptr->add_widget(std::make_unique<Subsection>(TR("General"), std::move(general_list), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)));
|
||||||
settings_list_ptr->add_widget(std::make_unique<Subsection>(TR("Replay indicator"), create_indicator("replay"), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)));
|
settings_list_ptr->add_widget(std::make_unique<Subsection>(TR("Replay indicator"), create_indicator(TR("replay")), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)));
|
||||||
settings_list_ptr->add_widget(std::make_unique<Subsection>(TR("Autostart"), create_start_replay_automatically(), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)));
|
settings_list_ptr->add_widget(std::make_unique<Subsection>(TR("Autostart"), create_start_replay_automatically(), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)));
|
||||||
|
|
||||||
view_radio_button_ptr->on_selection_changed = [this](const std::string&, const std::string &id) {
|
view_radio_button_ptr->on_selection_changed = [this](const std::string&, const std::string &id) {
|
||||||
@@ -1293,14 +1293,14 @@ namespace gsr {
|
|||||||
|
|
||||||
std::unique_ptr<CheckBox> SettingsPage::create_save_recording_in_game_folder() {
|
std::unique_ptr<CheckBox> SettingsPage::create_save_recording_in_game_folder() {
|
||||||
char text[256];
|
char text[256];
|
||||||
snprintf(text, sizeof(text), TR("Save video in a folder based on the focused applications name%s"), supports_window_title ? "" : " (X11 applications only)");
|
snprintf(text, sizeof(text), TR("Save video in a folder based on the focused applications name%s"), supports_window_title ? "" : TR(" (X11 applications only)"));
|
||||||
auto checkbox = std::make_unique<CheckBox>(&get_theme().body_font, text);
|
auto checkbox = std::make_unique<CheckBox>(&get_theme().body_font, text);
|
||||||
save_recording_in_game_folder_ptr = checkbox.get();
|
save_recording_in_game_folder_ptr = checkbox.get();
|
||||||
return checkbox;
|
return checkbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Label> SettingsPage::create_estimated_record_file_size() {
|
std::unique_ptr<Label> SettingsPage::create_estimated_record_file_size() {
|
||||||
auto label = std::make_unique<Label>(&get_theme().body_font, TR("Estimated video file size per minute (excluding audio): 345.60MB"), get_color_theme().text_color);
|
auto label = std::make_unique<Label>(&get_theme().body_font, "Estimated video file size per minute (excluding audio): 345.60MB", get_color_theme().text_color);
|
||||||
estimated_file_size_ptr = label.get();
|
estimated_file_size_ptr = label.get();
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
@@ -1329,7 +1329,7 @@ namespace gsr {
|
|||||||
general_list->add_widget(create_low_power_mode());
|
general_list->add_widget(create_low_power_mode());
|
||||||
|
|
||||||
settings_list_ptr->add_widget(std::make_unique<Subsection>(TR("General"), std::move(general_list), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)));
|
settings_list_ptr->add_widget(std::make_unique<Subsection>(TR("General"), std::move(general_list), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)));
|
||||||
settings_list_ptr->add_widget(std::make_unique<Subsection>(TR("Recording indicator"), create_indicator("recording"), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)));
|
settings_list_ptr->add_widget(std::make_unique<Subsection>(TR("Recording indicator"), create_indicator(TR("recording")), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)));
|
||||||
|
|
||||||
view_radio_button_ptr->on_selection_changed = [this](const std::string&, const std::string &id) {
|
view_radio_button_ptr->on_selection_changed = [this](const std::string&, const std::string &id) {
|
||||||
view_changed(id == "advanced");
|
view_changed(id == "advanced");
|
||||||
@@ -1462,7 +1462,7 @@ namespace gsr {
|
|||||||
general_list->add_widget(create_low_power_mode());
|
general_list->add_widget(create_low_power_mode());
|
||||||
|
|
||||||
settings_list_ptr->add_widget(std::make_unique<Subsection>(TR("General"), std::move(general_list), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)));
|
settings_list_ptr->add_widget(std::make_unique<Subsection>(TR("General"), std::move(general_list), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)));
|
||||||
settings_list_ptr->add_widget(std::make_unique<Subsection>(TR("Streaming indicator"), create_indicator("streaming"), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)));
|
settings_list_ptr->add_widget(std::make_unique<Subsection>(TR("Streaming indicator"), create_indicator(TR("streaming")), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)));
|
||||||
|
|
||||||
streaming_service_box_ptr->on_selection_changed = [this](const std::string&, const std::string &id) {
|
streaming_service_box_ptr->on_selection_changed = [this](const std::string&, const std::string &id) {
|
||||||
const bool twitch_option = id == "twitch";
|
const bool twitch_option = id == "twitch";
|
||||||
|
|||||||
@@ -264,7 +264,6 @@ Directory to save screenshots:=Directorio para guardar capturas de pantalla:
|
|||||||
Image format:=Formato de imagen:
|
Image format:=Formato de imagen:
|
||||||
|
|
||||||
Save screenshot in a folder based on the focused applications name=Guardar captura de pantalla en un directorio basado en el nombre de la aplicación activa
|
Save screenshot in a folder based on the focused applications name=Guardar captura de pantalla en un directorio basado en el nombre de la aplicación activa
|
||||||
Save screenshot in a folder based on the focused applications name (X11 applications only)=Guardar captura de pantalla en un directorio basado en el nombre de la aplicación activa (solo para aplicaciones X11)
|
|
||||||
|
|
||||||
Save screenshot to clipboard=Guardar captura de pantalla en el portapapeles
|
Save screenshot to clipboard=Guardar captura de pantalla en el portapapeles
|
||||||
Save screenshot to clipboard (Not supported properly by Wayland)=Guardar captura de pantalla en el portapapeles (no admitido por Wayland)
|
Save screenshot to clipboard (Not supported properly by Wayland)=Guardar captura de pantalla en el portapapeles (no admitido por Wayland)
|
||||||
@@ -317,6 +316,7 @@ Application: =Aplicación:
|
|||||||
Custom...=Personalizado...
|
Custom...=Personalizado...
|
||||||
|
|
||||||
Save video in a folder based on the focused applications name%s=Guardar el vídeo en un directorio basado en el nombre de la aplicación activa
|
Save video in a folder based on the focused applications name%s=Guardar el vídeo en un directorio basado en el nombre de la aplicación activa
|
||||||
|
(X11 applications only)= (solo para aplicaciones X11)
|
||||||
|
|
||||||
Add audio track=Añadir pista de sonido
|
Add audio track=Añadir pista de sonido
|
||||||
Add input device=Añadir dispositivo de entrada
|
Add input device=Añadir dispositivo de entrada
|
||||||
@@ -373,6 +373,7 @@ Do not force the GPU to go into high performance mode when recording.\nMay affec
|
|||||||
Show %s notifications=Mostrar notificación de %s
|
Show %s notifications=Mostrar notificación de %s
|
||||||
Show %s status with scroll lock led=Mostrar estado de %s con el LED de Bloq Despl
|
Show %s status with scroll lock led=Mostrar estado de %s con el LED de Bloq Despl
|
||||||
Recording indicator=Indicador de grabación
|
Recording indicator=Indicador de grabación
|
||||||
|
recording=grabando
|
||||||
|
|
||||||
Simple=Simple
|
Simple=Simple
|
||||||
Audio track #%d=Pista de sonido #%d
|
Audio track #%d=Pista de sonido #%d
|
||||||
@@ -383,6 +384,7 @@ Estimated video file size per minute (excluding audio): %.2fMB=Tamaño estimado
|
|||||||
# Replay settings
|
# Replay settings
|
||||||
Directory to save replays:=Directorio para guardar las repeticiones:
|
Directory to save replays:=Directorio para guardar las repeticiones:
|
||||||
Replay indicator=Indicador de repetición
|
Replay indicator=Indicador de repetición
|
||||||
|
replay=repetición
|
||||||
Turn on replay when starting a fullscreen application%s=Activar la repetición al iniciar una aplicación a pantalla completa%s
|
Turn on replay when starting a fullscreen application%s=Activar la repetición al iniciar una aplicación a pantalla completa%s
|
||||||
Autostart=Inicio automático
|
Autostart=Inicio automático
|
||||||
in RAM=en RAM
|
in RAM=en RAM
|
||||||
@@ -407,3 +409,4 @@ Stream URL:=URL de la transmisión
|
|||||||
Stream key:=Clave de transmisión
|
Stream key:=Clave de transmisión
|
||||||
Streaming info=Información de transmisión
|
Streaming info=Información de transmisión
|
||||||
Streaming indicator=Indicador de transmisión
|
Streaming indicator=Indicador de transmisión
|
||||||
|
streaming=transmisión
|
||||||
@@ -267,7 +267,6 @@ Directory to save screenshots:=Каталог для сохранения сни
|
|||||||
Image format:=Формат изображения:
|
Image format:=Формат изображения:
|
||||||
|
|
||||||
Save screenshot in a folder based on the focused applications name=Сохранять снимок в папку по имени активного приложения
|
Save screenshot in a folder based on the focused applications name=Сохранять снимок в папку по имени активного приложения
|
||||||
Save screenshot in a folder based on the focused applications name (X11 applications only)=Сохранять снимок в папку по имени активного приложения (только X11-приложения)
|
|
||||||
|
|
||||||
Save screenshot to clipboard=Сохранять снимок в буфер обмена
|
Save screenshot to clipboard=Сохранять снимок в буфер обмена
|
||||||
Save screenshot to clipboard (Not supported properly by Wayland)=Сохранять снимок в буфер обмена (в Wayland поддерживается некорректно)
|
Save screenshot to clipboard (Not supported properly by Wayland)=Сохранять снимок в буфер обмена (в Wayland поддерживается некорректно)
|
||||||
@@ -319,6 +318,7 @@ Application: =Приложение:
|
|||||||
Custom...=Другое...
|
Custom...=Другое...
|
||||||
|
|
||||||
Save video in a folder based on the focused applications name%s=Сохранять видео в папку по имени активного приложения%s
|
Save video in a folder based on the focused applications name%s=Сохранять видео в папку по имени активного приложения%s
|
||||||
|
(X11 applications only)= (только X11-приложения)
|
||||||
|
|
||||||
Add audio track=Добавить аудиодорожку
|
Add audio track=Добавить аудиодорожку
|
||||||
Add input device=Добавить вход
|
Add input device=Добавить вход
|
||||||
|
|||||||
@@ -278,7 +278,6 @@ Directory to save screenshots:=
|
|||||||
Image format:=
|
Image format:=
|
||||||
|
|
||||||
Save screenshot in a folder based on the focused applications name=
|
Save screenshot in a folder based on the focused applications name=
|
||||||
Save screenshot in a folder based on the focused applications name (X11 applications only)=
|
|
||||||
|
|
||||||
Save screenshot to clipboard=
|
Save screenshot to clipboard=
|
||||||
Save screenshot to clipboard (Not supported properly by Wayland)=
|
Save screenshot to clipboard (Not supported properly by Wayland)=
|
||||||
@@ -331,6 +330,7 @@ Application: =
|
|||||||
Custom...=
|
Custom...=
|
||||||
|
|
||||||
Save video in a folder based on the focused applications name%s=
|
Save video in a folder based on the focused applications name%s=
|
||||||
|
(X11 applications only)=
|
||||||
|
|
||||||
Add audio track=
|
Add audio track=
|
||||||
Add input device=
|
Add input device=
|
||||||
@@ -387,6 +387,7 @@ Do not force the GPU to go into high performance mode when recording.\nMay affec
|
|||||||
Show %s notifications=
|
Show %s notifications=
|
||||||
Show %s status with scroll lock led=
|
Show %s status with scroll lock led=
|
||||||
Recording indicator=
|
Recording indicator=
|
||||||
|
recording=
|
||||||
|
|
||||||
Simple=
|
Simple=
|
||||||
Audio track #%d=
|
Audio track #%d=
|
||||||
@@ -397,6 +398,7 @@ Estimated video file size per minute (excluding audio): %.2fMB=
|
|||||||
# Replay settings
|
# Replay settings
|
||||||
Directory to save replays:=
|
Directory to save replays:=
|
||||||
Replay indicator=
|
Replay indicator=
|
||||||
|
replay=
|
||||||
Turn on replay when starting a fullscreen application%s=
|
Turn on replay when starting a fullscreen application%s=
|
||||||
Autostart=
|
Autostart=
|
||||||
in RAM=
|
in RAM=
|
||||||
@@ -421,3 +423,4 @@ Stream URL:=
|
|||||||
Stream key:=
|
Stream key:=
|
||||||
Streaming info=
|
Streaming info=
|
||||||
Streaming indicator=
|
Streaming indicator=
|
||||||
|
streaming=
|
||||||
@@ -266,7 +266,6 @@ Directory to save screenshots:=Каталог для збереження зні
|
|||||||
Image format:=Формат зображення:
|
Image format:=Формат зображення:
|
||||||
|
|
||||||
Save screenshot in a folder based on the focused applications name=Зберігати знімок у папку за ім'ям активної програми
|
Save screenshot in a folder based on the focused applications name=Зберігати знімок у папку за ім'ям активної програми
|
||||||
Save screenshot in a folder based on the focused applications name (X11 applications only)=Зберігати знімок у папку за ім'ям активної програми (лише X11-програми)
|
|
||||||
|
|
||||||
Save screenshot to clipboard=Зберігати знімок до буфера обміну
|
Save screenshot to clipboard=Зберігати знімок до буфера обміну
|
||||||
Save screenshot to clipboard (Not supported properly by Wayland)=Зберігати знімок до буфера обміну (в Wayland підтримується некоректно)
|
Save screenshot to clipboard (Not supported properly by Wayland)=Зберігати знімок до буфера обміну (в Wayland підтримується некоректно)
|
||||||
@@ -317,6 +316,7 @@ Application: =Програма:
|
|||||||
Custom...=Інше...
|
Custom...=Інше...
|
||||||
|
|
||||||
Save video in a folder based on the focused applications name%s=Зберігати відео у папку за ім'ям активної програми%s
|
Save video in a folder based on the focused applications name%s=Зберігати відео у папку за ім'ям активної програми%s
|
||||||
|
(X11 applications only)= (лише X11-програми)
|
||||||
|
|
||||||
Add audio track=Додати аудіодоріжку
|
Add audio track=Додати аудіодоріжку
|
||||||
Add input device=Додати вхід
|
Add input device=Додати вхід
|
||||||
|
|||||||
Reference in New Issue
Block a user