aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorTrung Lê <8@tle.id.au>2026-06-10 17:32:15 +1000
committerTrung Lê <8@tle.id.au>2026-06-10 23:21:58 +1000
commite845db5dc4f482f88d1562c0356cd1c65d5f538b (patch)
tree0b1d9ca46ec459667e0a8f2b698e3708e06d84b2 /src
parentfbd27b7ba04c12eb080ccabec63938c2f05c75ec (diff)
feat: add gettext i18n with translations (vi, de, fr, it, es, pt)
Wire up internationalization for the app and ship six translations. Infrastructure: - meson: import i18n, define GETTEXT_PACKAGE/GSR_LOCALEDIR, add po/ subdir, and translate the .desktop and AppStream metainfo via i18n.merge_file (renamed to .desktop.in / .metainfo.xml.in). - main.c: setlocale + bindtextdomain/textdomain so the catalog is loaded. - po/: LINGUAS, POTFILES.in, meson.build (glib preset). String marking: - Wrap every user-visible string with _() across main.c, gsr-window.c, the four pages and the shortcut dialog (titles, subtitles, labels, buttons, combo display names, notifications, toasts, dialogs, menu items). - Leave ids/keys untranslated: codec/container/service ids, GAction/icon/CSS names, GVariant/format strings, accelerators, etc. Linting: - Re-enable gobject-linter's untranslated_string rule (now that i18n exists) as an error so new user-visible strings must be wrapped. Translations (141 messages each, %s/%d/markup placeholders preserved): - Vietnamese (vi), German (de), French (fr), Italian (it), Spanish (es), Portuguese (pt). Codec names, "OK", proper nouns and the product name are intentionally left in English. Verified: msgfmt --check-format passes and the compiled catalogs resolve (e.g. "Record" -> "Ghi hình" / "Aufnahme" / "Enregistrement").
Diffstat (limited to 'src')
-rw-r--r--src/gsr-config-page.c142
-rw-r--r--src/gsr-record-page.c54
-rw-r--r--src/gsr-replay-page.c50
-rw-r--r--src/gsr-shortcut-accel-dialog.c17
-rw-r--r--src/gsr-stream-page.c45
-rw-r--r--src/gsr-window.c96
-rw-r--r--src/main.c27
7 files changed, 225 insertions, 206 deletions
diff --git a/src/gsr-config-page.c b/src/gsr-config-page.c
index cd17219..7a72871 100644
--- a/src/gsr-config-page.c
+++ b/src/gsr-config-page.c
@@ -3,6 +3,8 @@
#include "gsr-x11-window-picker.h"
#endif
+#include <glib/gi18n.h>
+
/* ═══════════════════════════════════════════════════════════════════
* GsrConfigPage — "Config" tab
*
@@ -157,7 +159,7 @@ on_window_picked(const GsrX11WindowPickResult *result, void *userdata)
/* Update the row subtitle */
g_autofree char *subtitle = g_strdup_printf("%s (0x%lx)",
- result->name ? result->name : "(no name)",
+ result->name ? result->name : _("(no name)"),
(unsigned long)result->window);
adw_action_row_set_subtitle(self->select_window_row, subtitle);
}
@@ -180,7 +182,7 @@ on_select_window_activated(AdwActionRow *row G_GNUC_UNUSED, gpointer user_data)
self->active_picker = gsr_x11_window_picker_new(on_window_picked, self);
if (!self->active_picker) {
adw_action_row_set_subtitle(self->select_window_row,
- "Failed to grab pointer");
+ _("Failed to grab pointer"));
}
}
#endif /* HAVE_X11 */
@@ -189,7 +191,7 @@ static void
build_capture_group(GsrConfigPage *self)
{
self->capture_group = ADW_PREFERENCES_GROUP(adw_preferences_group_new());
- adw_preferences_group_set_title(self->capture_group, "Capture Target");
+ adw_preferences_group_set_title(self->capture_group, _("Capture Target"));
/* Record area combo */
self->record_area_model = gtk_string_list_new(NULL);
@@ -202,13 +204,13 @@ build_capture_group(GsrConfigPage *self)
#ifdef HAVE_X11
/* "Window" — X11 only */
if (info->system_info.display_server == GSR_DISPLAY_SERVER_X11) {
- gtk_string_list_append(self->record_area_model, "Window");
+ gtk_string_list_append(self->record_area_model, _("Window"));
ids_array_append(&self->record_area_ids, &self->n_record_area_ids, &cap, "window");
}
/* "Follow focused window" — X11 only */
if (info->system_info.display_server == GSR_DISPLAY_SERVER_X11) {
- gtk_string_list_append(self->record_area_model, "Focused window");
+ gtk_string_list_append(self->record_area_model, _("Focused window"));
ids_array_append(&self->record_area_ids, &self->n_record_area_ids, &cap, "focused");
}
#endif
@@ -219,9 +221,9 @@ build_capture_group(GsrConfigPage *self)
const GsrMonitor *m = &info->supported_capture_options.monitors[i];
g_autofree char *label = NULL;
if (m->width > 0 && m->height > 0)
- label = g_strdup_printf("Monitor %s (%dx%d)", m->name, m->width, m->height);
+ label = g_strdup_printf(_("Monitor %s (%dx%d)"), m->name, m->width, m->height);
else
- label = g_strdup_printf("Monitor %s", m->name);
+ label = g_strdup_printf(_("Monitor %s"), m->name);
gtk_string_list_append(self->record_area_model, label);
ids_array_append(&self->record_area_ids, &self->n_record_area_ids, &cap, m->name);
}
@@ -229,12 +231,12 @@ build_capture_group(GsrConfigPage *self)
/* Desktop portal — only on Wayland with portal support */
if (info->system_info.display_server == GSR_DISPLAY_SERVER_WAYLAND
&& info->supported_capture_options.portal) {
- gtk_string_list_append(self->record_area_model, "Desktop portal (no HDR)");
+ gtk_string_list_append(self->record_area_model, _("Desktop portal (no HDR)"));
ids_array_append(&self->record_area_ids, &self->n_record_area_ids, &cap, "portal");
}
self->record_area_row = ADW_COMBO_ROW(adw_combo_row_new());
- adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->record_area_row), "Record area");
+ adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->record_area_row), _("Record area"));
/* Default selection: first monitor if available, else first entry */
guint default_idx = (info->supported_capture_options.n_monitors > 0)
@@ -254,8 +256,8 @@ build_capture_group(GsrConfigPage *self)
#ifdef HAVE_X11
self->select_window_row = ADW_ACTION_ROW(adw_action_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->select_window_row),
- "Select window...");
- adw_action_row_set_subtitle(self->select_window_row, "Click to pick a window");
+ _("Select window..."));
+ adw_action_row_set_subtitle(self->select_window_row, _("Click to pick a window"));
gtk_list_box_row_set_activatable(GTK_LIST_BOX_ROW(self->select_window_row), TRUE);
GtkImage *pick_icon = GTK_IMAGE(gtk_image_new_from_icon_name("find-location-symbolic"));
adw_action_row_add_suffix(self->select_window_row, GTK_WIDGET(pick_icon));
@@ -271,7 +273,7 @@ build_capture_group(GsrConfigPage *self)
/* Change video resolution */
self->change_resolution_row = ADW_SWITCH_ROW(adw_switch_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->change_resolution_row),
- "Change video resolution");
+ _("Change video resolution"));
adw_switch_row_set_active(self->change_resolution_row, FALSE);
g_signal_connect(self->change_resolution_row, "notify::active",
G_CALLBACK(on_change_resolution_toggled), self);
@@ -279,26 +281,26 @@ build_capture_group(GsrConfigPage *self)
/* Video resolution W×H */
self->video_width_row = ADW_SPIN_ROW(adw_spin_row_new_with_range(5, 10000, 1));
- adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->video_width_row), "Video width");
+ adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->video_width_row), _("Video width"));
adw_spin_row_set_value(self->video_width_row, 1920);
gtk_widget_set_visible(GTK_WIDGET(self->video_width_row), FALSE);
adw_preferences_group_add(self->capture_group, GTK_WIDGET(self->video_width_row));
self->video_height_row = ADW_SPIN_ROW(adw_spin_row_new_with_range(5, 10000, 1));
- adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->video_height_row), "Video height");
+ adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->video_height_row), _("Video height"));
adw_spin_row_set_value(self->video_height_row, 1080);
gtk_widget_set_visible(GTK_WIDGET(self->video_height_row), FALSE);
adw_preferences_group_add(self->capture_group, GTK_WIDGET(self->video_height_row));
/* Area size W×H (focused mode) */
self->area_width_row = ADW_SPIN_ROW(adw_spin_row_new_with_range(5, 10000, 1));
- adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->area_width_row), "Area width");
+ adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->area_width_row), _("Area width"));
adw_spin_row_set_value(self->area_width_row, 1920);
gtk_widget_set_visible(GTK_WIDGET(self->area_width_row), FALSE);
adw_preferences_group_add(self->capture_group, GTK_WIDGET(self->area_width_row));
self->area_height_row = ADW_SPIN_ROW(adw_spin_row_new_with_range(5, 10000, 1));
- adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->area_height_row), "Area height");
+ adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->area_height_row), _("Area height"));
adw_spin_row_set_value(self->area_height_row, 1080);
gtk_widget_set_visible(GTK_WIDGET(self->area_height_row), FALSE);
adw_preferences_group_add(self->capture_group, GTK_WIDGET(self->area_height_row));
@@ -306,7 +308,7 @@ build_capture_group(GsrConfigPage *self)
/* Restore portal session */
self->restore_portal_row = ADW_SWITCH_ROW(adw_switch_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->restore_portal_row),
- "Restore portal session");
+ _("Restore portal session"));
adw_switch_row_set_active(self->restore_portal_row, TRUE);
gtk_widget_set_visible(GTK_WIDGET(self->restore_portal_row), FALSE);
adw_preferences_group_add(self->capture_group, GTK_WIDGET(self->restore_portal_row));
@@ -324,7 +326,7 @@ static void
build_audio_group(GsrConfigPage *self)
{
self->audio_group = ADW_PREFERENCES_GROUP(adw_preferences_group_new());
- adw_preferences_group_set_title(self->audio_group, "Audio");
+ adw_preferences_group_set_title(self->audio_group, _("Audio"));
/* Button row for adding audio tracks */
GtkBox *btn_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6));
@@ -334,7 +336,7 @@ build_audio_group(GsrConfigPage *self)
self->add_device_btn = GTK_BUTTON(gtk_button_new());
AdwButtonContent *dev_bc = ADW_BUTTON_CONTENT(adw_button_content_new());
adw_button_content_set_icon_name(dev_bc, "list-add-symbolic");
- adw_button_content_set_label(dev_bc, "Audio device");
+ adw_button_content_set_label(dev_bc, _("Audio device"));
gtk_button_set_child(self->add_device_btn, GTK_WIDGET(dev_bc));
gtk_widget_add_css_class(GTK_WIDGET(self->add_device_btn), "flat");
g_signal_connect(self->add_device_btn, "clicked",
@@ -344,7 +346,7 @@ build_audio_group(GsrConfigPage *self)
self->add_app_btn = GTK_BUTTON(gtk_button_new());
AdwButtonContent *app_bc = ADW_BUTTON_CONTENT(adw_button_content_new());
adw_button_content_set_icon_name(app_bc, "list-add-symbolic");
- adw_button_content_set_label(app_bc, "App audio");
+ adw_button_content_set_label(app_bc, _("App audio"));
gtk_button_set_child(self->add_app_btn, GTK_WIDGET(app_bc));
gtk_widget_add_css_class(GTK_WIDGET(self->add_app_btn), "flat");
g_signal_connect(self->add_app_btn, "clicked",
@@ -354,7 +356,7 @@ build_audio_group(GsrConfigPage *self)
self->add_custom_app_btn = GTK_BUTTON(gtk_button_new());
AdwButtonContent *custom_bc = ADW_BUTTON_CONTENT(adw_button_content_new());
adw_button_content_set_icon_name(custom_bc, "list-add-symbolic");
- adw_button_content_set_label(custom_bc, "Custom app");
+ adw_button_content_set_label(custom_bc, _("Custom app"));
gtk_button_set_child(self->add_custom_app_btn, GTK_WIDGET(custom_bc));
gtk_widget_add_css_class(GTK_WIDGET(self->add_custom_app_btn), "flat");
g_signal_connect(self->add_custom_app_btn, "clicked",
@@ -379,7 +381,7 @@ build_audio_group(GsrConfigPage *self)
/* Split audio */
self->split_audio_row = ADW_SWITCH_ROW(adw_switch_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->split_audio_row),
- "Split audio tracks");
+ _("Split audio tracks"));
adw_switch_row_set_active(self->split_audio_row, FALSE);
gtk_widget_set_visible(GTK_WIDGET(self->split_audio_row), FALSE); /* advanced only */
adw_preferences_group_add(self->audio_group, GTK_WIDGET(self->split_audio_row));
@@ -387,7 +389,7 @@ build_audio_group(GsrConfigPage *self)
/* Record app audio inverted */
self->app_audio_inverted_row = ADW_SWITCH_ROW(adw_switch_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->app_audio_inverted_row),
- "Record all apps except selected");
+ _("Record all apps except selected"));
adw_switch_row_set_active(self->app_audio_inverted_row, FALSE);
if (!self->info->system_info.supports_app_audio)
gtk_widget_set_visible(GTK_WIDGET(self->app_audio_inverted_row), FALSE);
@@ -395,9 +397,9 @@ build_audio_group(GsrConfigPage *self)
/* Audio codec */
self->audio_codec_row = ADW_COMBO_ROW(adw_combo_row_new());
- adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->audio_codec_row), "Audio codec");
+ adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->audio_codec_row), _("Audio codec"));
GtkStringList *ac_model = gtk_string_list_new(
- (const char *const[]){ "Opus (Recommended)", "AAC", NULL });
+ (const char *const[]){ _("Opus (Recommended)"), _("AAC"), NULL });
adw_combo_row_set_model(self->audio_codec_row, G_LIST_MODEL(ac_model));
adw_combo_row_set_selected(self->audio_codec_row, 0);
gtk_widget_set_visible(GTK_WIDGET(self->audio_codec_row), FALSE); /* advanced only */
@@ -491,7 +493,7 @@ on_add_audio_device_clicked(GtkButton *btn G_GNUC_UNUSED, gpointer user_data)
for (int i = 0; i < n_devs; i++)
labels[i] = devs[i].description;
- GtkWidget *row = create_audio_row("device", "Device", labels, n_devs,
+ GtkWidget *row = create_audio_row("device", _("Device"), labels, n_devs,
NULL, self);
gtk_list_box_append(self->audio_rows_box, row);
update_audio_rows_visibility(self);
@@ -514,7 +516,7 @@ on_add_app_audio_clicked(GtkButton *btn G_GNUC_UNUSED, gpointer user_data)
int n_apps = 0;
char **apps = gsr_application_audio_get(&n_apps);
- GtkWidget *row = create_audio_row("app", "Application",
+ GtkWidget *row = create_audio_row("app", _("Application"),
(const char *const *)apps, n_apps,
NULL, self);
gtk_list_box_append(self->audio_rows_box, row);
@@ -526,7 +528,7 @@ static void
on_add_custom_app_clicked(GtkButton *btn G_GNUC_UNUSED, gpointer user_data)
{
GsrConfigPage *self = GSR_CONFIG_PAGE(user_data);
- GtkWidget *row = create_audio_row("app-custom", "Application",
+ GtkWidget *row = create_audio_row("app-custom", _("Application"),
NULL, 0, "", self);
gtk_list_box_append(self->audio_rows_box, row);
update_audio_rows_visibility(self);
@@ -547,18 +549,18 @@ static void
build_video_group(GsrConfigPage *self)
{
self->video_group = ADW_PREFERENCES_GROUP(adw_preferences_group_new());
- adw_preferences_group_set_title(self->video_group, "Video");
+ adw_preferences_group_set_title(self->video_group, _("Video"));
const GsrInfo *info = self->info;
/* Quality */
self->quality_row = ADW_COMBO_ROW(adw_combo_row_new());
- adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->quality_row), "Video quality");
+ adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->quality_row), _("Video quality"));
GtkStringList *q_model = gtk_string_list_new((const char *const[]){
- "Constant bitrate",
- "Medium", "High",
- "Very High",
- "Ultra", NULL });
+ _("Constant bitrate"),
+ _("Medium"), _("High"),
+ _("Very High"),
+ _("Ultra"), NULL });
adw_combo_row_set_model(self->quality_row, G_LIST_MODEL(q_model));
adw_combo_row_set_selected(self->quality_row, 0);
g_signal_connect(self->quality_row, "notify::selected",
@@ -567,7 +569,7 @@ build_video_group(GsrConfigPage *self)
/* Bitrate */
self->bitrate_row = ADW_SPIN_ROW(adw_spin_row_new_with_range(1, 500000, 1));
- adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->bitrate_row), "Video bitrate (kbps)");
+ adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->bitrate_row), _("Video bitrate (kbps)"));
adw_spin_row_set_value(self->bitrate_row, 15000);
adw_preferences_group_add(self->video_group, GTK_WIDGET(self->bitrate_row));
@@ -578,29 +580,29 @@ build_video_group(GsrConfigPage *self)
int vc_cap = 0;
struct { const char *id; const char *label_ok; const char *label_na; } codecs[] = {
- { "auto", "Auto", NULL },
- { "h264", "H.264",
- "H.264 (N/A)" },
- { "hevc", "HEVC",
- "HEVC (N/A)" },
- { "hevc_10bit", "HEVC 10-bit",
- "HEVC 10-bit (N/A)" },
+ { "auto", _("Auto"), NULL },
+ { "h264", _("H.264"),
+ _("H.264 (N/A)") },
+ { "hevc", _("HEVC"),
+ _("HEVC (N/A)") },
+ { "hevc_10bit", _("HEVC 10-bit"),
+ _("HEVC 10-bit (N/A)") },
{ "hevc_hdr",
info->system_info.display_server == GSR_DISPLAY_SERVER_WAYLAND
- ? "HEVC HDR" : "HEVC HDR (X11 N/A)",
- "HEVC HDR (N/A)" },
- { "av1", "AV1",
- "AV1 (N/A)" },
- { "av1_10bit", "AV1 10-bit",
- "AV1 10-bit (N/A)" },
+ ? _("HEVC HDR") : _("HEVC HDR (X11 N/A)"),
+ _("HEVC HDR (N/A)") },
+ { "av1", _("AV1"),
+ _("AV1 (N/A)") },
+ { "av1_10bit", _("AV1 10-bit"),
+ _("AV1 10-bit (N/A)") },
{ "av1_hdr",
info->system_info.display_server == GSR_DISPLAY_SERVER_WAYLAND
- ? "AV1 HDR" : "AV1 HDR (X11 N/A)",
- "AV1 HDR (N/A)" },
- { "vp8", "VP8", "VP8 (N/A)" },
- { "vp9", "VP9", "VP9 (N/A)" },
- { "h264_software", "H.264 Software (slow)",
- "H.264 Software (N/A)" },
+ ? _("AV1 HDR") : _("AV1 HDR (X11 N/A)"),
+ _("AV1 HDR (N/A)") },
+ { "vp8", _("VP8"), _("VP8 (N/A)") },
+ { "vp9", _("VP9"), _("VP9 (N/A)") },
+ { "h264_software", _("H.264 Software (slow)"),
+ _("H.264 Software (N/A)") },
};
for (size_t i = 0; i < G_N_ELEMENTS(codecs); i++) {
@@ -611,7 +613,7 @@ build_video_group(GsrConfigPage *self)
}
self->video_codec_row = ADW_COMBO_ROW(adw_combo_row_new());
- adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->video_codec_row), "Video codec");
+ adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->video_codec_row), _("Video codec"));
adw_combo_row_set_model(self->video_codec_row, G_LIST_MODEL(self->video_codec_model));
adw_combo_row_set_selected(self->video_codec_row, 0);
gtk_widget_set_visible(GTK_WIDGET(self->video_codec_row), FALSE); /* advanced only */
@@ -619,9 +621,9 @@ build_video_group(GsrConfigPage *self)
/* Color range */
self->color_range_row = ADW_COMBO_ROW(adw_combo_row_new());
- adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->color_range_row), "Color range");
+ adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->color_range_row), _("Color range"));
GtkStringList *cr_model = gtk_string_list_new(
- (const char *const[]){ "Limited", "Full", NULL });
+ (const char *const[]){ _("Limited"), _("Full"), NULL });
adw_combo_row_set_model(self->color_range_row, G_LIST_MODEL(cr_model));
adw_combo_row_set_selected(self->color_range_row, 0);
gtk_widget_set_visible(GTK_WIDGET(self->color_range_row), FALSE); /* advanced only */
@@ -629,15 +631,15 @@ build_video_group(GsrConfigPage *self)
/* FPS */
self->fps_row = ADW_SPIN_ROW(adw_spin_row_new_with_range(1, 500, 1));
- adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->fps_row), "Frame rate");
+ adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->fps_row), _("Frame rate"));
adw_spin_row_set_value(self->fps_row, 60);
adw_preferences_group_add(self->video_group, GTK_WIDGET(self->fps_row));
/* Framerate mode */
self->framerate_mode_row = ADW_COMBO_ROW(adw_combo_row_new());
- adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->framerate_mode_row), "Frame rate mode");
+ adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->framerate_mode_row), _("Frame rate mode"));
GtkStringList *fm_model = gtk_string_list_new(
- (const char *const[]){ "Auto (Recommended)", "Constant", "Variable", NULL });
+ (const char *const[]){ _("Auto (Recommended)"), _("Constant"), _("Variable"), NULL });
adw_combo_row_set_model(self->framerate_mode_row, G_LIST_MODEL(fm_model));
adw_combo_row_set_selected(self->framerate_mode_row, 0);
gtk_widget_set_visible(GTK_WIDGET(self->framerate_mode_row), FALSE); /* advanced only */
@@ -646,7 +648,7 @@ build_video_group(GsrConfigPage *self)
/* Overclock (NVIDIA + X11 only) */
self->overclock_row = ADW_SWITCH_ROW(adw_switch_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->overclock_row),
- "Overclock memory transfer rate");
+ _("Overclock memory transfer rate"));
adw_switch_row_set_active(self->overclock_row, FALSE);
/* Only visible in advanced mode AND nvidia AND not wayland */
gtk_widget_set_visible(GTK_WIDGET(self->overclock_row), FALSE);
@@ -654,7 +656,7 @@ build_video_group(GsrConfigPage *self)
/* Record cursor */
self->record_cursor_row = ADW_SWITCH_ROW(adw_switch_row_new());
- adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->record_cursor_row), "Record cursor");
+ adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->record_cursor_row), _("Record cursor"));
adw_switch_row_set_active(self->record_cursor_row, TRUE);
adw_preferences_group_add(self->video_group, GTK_WIDGET(self->record_cursor_row));
@@ -667,24 +669,24 @@ static void
build_notifications_group(GsrConfigPage *self)
{
self->notifications_group = ADW_PREFERENCES_GROUP(adw_preferences_group_new());
- adw_preferences_group_set_title(self->notifications_group, "Notifications");
+ adw_preferences_group_set_title(self->notifications_group, _("Notifications"));
gtk_widget_set_visible(GTK_WIDGET(self->notifications_group), FALSE); /* advanced only */
self->notify_started_row = ADW_SWITCH_ROW(adw_switch_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->notify_started_row),
- "Show started notification");
+ _("Show started notification"));
adw_switch_row_set_active(self->notify_started_row, FALSE);
adw_preferences_group_add(self->notifications_group, GTK_WIDGET(self->notify_started_row));
self->notify_stopped_row = ADW_SWITCH_ROW(adw_switch_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->notify_stopped_row),
- "Show stopped notification");
+ _("Show stopped notification"));
adw_switch_row_set_active(self->notify_stopped_row, FALSE);
adw_preferences_group_add(self->notifications_group, GTK_WIDGET(self->notify_stopped_row));
self->notify_saved_row = ADW_SWITCH_ROW(adw_switch_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->notify_saved_row),
- "Show video saved notification");
+ _("Show video saved notification"));
adw_switch_row_set_active(self->notify_saved_row, TRUE);
adw_preferences_group_add(self->notifications_group, GTK_WIDGET(self->notify_saved_row));
@@ -735,7 +737,7 @@ gsr_config_page_new(const GsrInfo *info)
GsrConfigPage *self = g_object_new(GSR_TYPE_CONFIG_PAGE, NULL);
self->info = info;
- adw_preferences_page_set_title(ADW_PREFERENCES_PAGE(self), "Config");
+ adw_preferences_page_set_title(ADW_PREFERENCES_PAGE(self), _("Config"));
adw_preferences_page_set_icon_name(ADW_PREFERENCES_PAGE(self),
"preferences-system-symbolic");
@@ -924,11 +926,11 @@ gsr_config_page_apply_config(GsrConfigPage *self, const GsrConfig *config)
}
if (found) {
- GtkWidget *row = create_audio_row("app", "Application",
+ GtkWidget *row = create_audio_row("app", _("Application"),
(const char *const *)apps, n_apps, app_name, self);
gtk_list_box_append(self->audio_rows_box, row);
} else {
- GtkWidget *row = create_audio_row("app-custom", "Application",
+ GtkWidget *row = create_audio_row("app-custom", _("Application"),
NULL, 0, app_name, self);
gtk_list_box_append(self->audio_rows_box, row);
}
@@ -949,7 +951,7 @@ gsr_config_page_apply_config(GsrConfigPage *self, const GsrConfig *config)
for (int j = 0; j < n_devs; j++)
labels[j] = devs[j].description;
- GtkWidget *row = create_audio_row("device", "Device",
+ GtkWidget *row = create_audio_row("device", _("Device"),
labels, n_devs, desc, self);
gtk_list_box_append(self->audio_rows_box, row);
diff --git a/src/gsr-record-page.c b/src/gsr-record-page.c
index 745bdcf..40b28bb 100644
--- a/src/gsr-record-page.c
+++ b/src/gsr-record-page.c
@@ -3,6 +3,8 @@
#include <signal.h>
#include <time.h>
+#include <glib/gi18n.h>
+
#include "gsr-window.h"
#ifdef HAVE_X11
@@ -131,7 +133,7 @@ on_save_dir_activated(AdwActionRow *row G_GNUC_UNUSED,
{
GsrRecordPage *self = GSR_RECORD_PAGE(user_data);
g_autoptr(GtkFileDialog) dialog = gtk_file_dialog_new();
- gtk_file_dialog_set_title(dialog, "Select save directory");
+ gtk_file_dialog_set_title(dialog, _("Select save directory"));
if (self->save_directory) {
g_autoptr(GFile) initial = g_file_new_for_path(self->save_directory);
@@ -247,7 +249,7 @@ on_x11_start_stop_activated(AdwActionRow *row G_GNUC_UNUSED,
{
GsrRecordPage *self = GSR_RECORD_PAGE(user_data);
GsrShortcutAccelDialog *dialog = gsr_shortcut_accel_dialog_new(
- "Start/Stop recording", self->x11_start_stop_accel);
+ _("Start/Stop recording"), self->x11_start_stop_accel);
g_signal_connect(dialog, "shortcut-set",
G_CALLBACK(on_x11_start_stop_shortcut_set), self);
adw_dialog_present(ADW_DIALOG(dialog), GTK_WIDGET(self));
@@ -278,7 +280,7 @@ on_x11_pause_activated(AdwActionRow *row G_GNUC_UNUSED,
{
GsrRecordPage *self = GSR_RECORD_PAGE(user_data);
GsrShortcutAccelDialog *dialog = gsr_shortcut_accel_dialog_new(
- "Pause/Unpause recording", self->x11_pause_accel);
+ _("Pause/Unpause recording"), self->x11_pause_accel);
g_signal_connect(dialog, "shortcut-set",
G_CALLBACK(on_x11_pause_shortcut_set), self);
adw_dialog_present(ADW_DIALOG(dialog), GTK_WIDGET(self));
@@ -289,7 +291,7 @@ static void
build_hotkey_group(GsrRecordPage *self)
{
self->hotkey_group = ADW_PREFERENCES_GROUP(adw_preferences_group_new());
- adw_preferences_group_set_title(self->hotkey_group, "Hotkeys");
+ adw_preferences_group_set_title(self->hotkey_group, _("Hotkeys"));
GsrDisplayServer ds = self->info->system_info.display_server;
@@ -297,8 +299,8 @@ build_hotkey_group(GsrRecordPage *self)
if (ds == GSR_DISPLAY_SERVER_WAYLAND) {
/* "Not supported" label — initially hidden, shown if portal fails */
self->hotkey_not_supported_label = gtk_label_new(
- "Your Wayland compositor doesn't support global hotkeys.\n"
- "Use X11 or KDE Plasma on Wayland if you want to use hotkeys.");
+ _("Your Wayland compositor doesn't support global hotkeys.\n"
+ "Use X11 or KDE Plasma on Wayland if you want to use hotkeys."));
gtk_label_set_wrap(GTK_LABEL(self->hotkey_not_supported_label), TRUE);
gtk_widget_add_css_class(self->hotkey_not_supported_label, "dim-label");
gtk_widget_set_margin_top(self->hotkey_not_supported_label, 6);
@@ -312,32 +314,32 @@ build_hotkey_group(GsrRecordPage *self)
self->hotkey_info_row = GTK_WIDGET(info_row);
if (is_kde_wayland()) {
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(info_row),
- "Hotkeys are managed by KDE Plasma");
+ _("Hotkeys are managed by KDE Plasma"));
adw_action_row_set_subtitle(info_row,
- "Click to configure hotkeys in system settings");
+ _("Click to configure hotkeys in system settings"));
GtkButton *change_btn = GTK_BUTTON(
- gtk_button_new_with_label("Change hotkeys"));
+ gtk_button_new_with_label(_("Change hotkeys")));
gtk_widget_set_valign(GTK_WIDGET(change_btn), GTK_ALIGN_CENTER);
g_object_set_data(G_OBJECT(info_row), "change-button", change_btn);
adw_action_row_add_suffix(info_row, GTK_WIDGET(change_btn));
} else {
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(info_row),
- "Hotkeys are managed by your compositor");
+ _("Hotkeys are managed by your compositor"));
adw_action_row_set_subtitle(info_row,
- "Go to system settings to change hotkeys");
+ _("Go to system settings to change hotkeys"));
}
adw_preferences_group_add(self->hotkey_group, GTK_WIDGET(info_row));
/* Hotkey labels (shown after portal succeeds) */
AdwActionRow *start_row = ADW_ACTION_ROW(adw_action_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(start_row),
- "Start/Stop recording");
+ _("Start/Stop recording"));
adw_action_row_set_subtitle(start_row, "");
adw_preferences_group_add(self->hotkey_group, GTK_WIDGET(start_row));
AdwActionRow *pause_row = ADW_ACTION_ROW(adw_action_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(pause_row),
- "Pause/Unpause recording");
+ _("Pause/Unpause recording"));
adw_action_row_set_subtitle(pause_row, "");
adw_preferences_group_add(self->hotkey_group, GTK_WIDGET(pause_row));
@@ -353,7 +355,7 @@ build_hotkey_group(GsrRecordPage *self)
/* X11: interactive shortcut rows */
self->x11_start_stop_row = ADW_ACTION_ROW(adw_action_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->x11_start_stop_row),
- "Start/Stop recording");
+ _("Start/Stop recording"));
gtk_list_box_row_set_activatable(GTK_LIST_BOX_ROW(self->x11_start_stop_row), TRUE);
self->x11_start_stop_label = GTK_SHORTCUT_LABEL(
@@ -372,7 +374,7 @@ build_hotkey_group(GsrRecordPage *self)
/* Pause/Unpause row */
self->x11_pause_row = ADW_ACTION_ROW(adw_action_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->x11_pause_row),
- "Pause/Unpause recording");
+ _("Pause/Unpause recording"));
gtk_list_box_row_set_activatable(GTK_LIST_BOX_ROW(self->x11_pause_row), TRUE);
self->x11_pause_label = GTK_SHORTCUT_LABEL(
@@ -399,13 +401,13 @@ static void
build_output_group(GsrRecordPage *self)
{
self->output_group = ADW_PREFERENCES_GROUP(adw_preferences_group_new());
- adw_preferences_group_set_title(self->output_group, "Output");
+ adw_preferences_group_set_title(self->output_group, _("Output"));
/* Save directory */
self->save_directory = get_default_videos_dir();
self->save_dir_row = ADW_ACTION_ROW(adw_action_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->save_dir_row),
- "Save directory");
+ _("Save directory"));
adw_action_row_set_subtitle(self->save_dir_row, self->save_directory);
gtk_list_box_row_set_activatable(GTK_LIST_BOX_ROW(self->save_dir_row), TRUE);
@@ -421,7 +423,7 @@ build_output_group(GsrRecordPage *self)
/* Container format */
self->container_row = ADW_COMBO_ROW(adw_combo_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->container_row),
- "Container");
+ _("Container"));
GtkStringList *ct_model = gtk_string_list_new(NULL);
const char *containers[] = {
@@ -453,7 +455,7 @@ build_action_group(GsrRecordPage *self)
gtk_widget_set_margin_bottom(GTK_WIDGET(box), 6);
self->start_button = GTK_BUTTON(
- gtk_button_new_with_label("Start recording"));
+ gtk_button_new_with_label(_("Start recording")));
gtk_widget_set_hexpand(GTK_WIDGET(self->start_button), TRUE);
gtk_widget_add_css_class(GTK_WIDGET(self->start_button), "suggested-action");
g_signal_connect(self->start_button, "clicked",
@@ -461,7 +463,7 @@ build_action_group(GsrRecordPage *self)
gtk_box_append(box, GTK_WIDGET(self->start_button));
self->pause_button = GTK_BUTTON(
- gtk_button_new_with_label("Pause recording"));
+ gtk_button_new_with_label(_("Pause recording")));
gtk_widget_set_hexpand(GTK_WIDGET(self->pause_button), TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(self->pause_button), FALSE);
g_signal_connect(self->pause_button, "clicked",
@@ -628,7 +630,7 @@ void
gsr_record_page_set_active(GsrRecordPage *self, gboolean active)
{
if (active) {
- gtk_button_set_label(self->start_button, "Stop recording");
+ gtk_button_set_label(self->start_button, _("Stop recording"));
gtk_widget_remove_css_class(GTK_WIDGET(self->start_button), "suggested-action");
gtk_widget_add_css_class(GTK_WIDGET(self->start_button), "destructive-action");
gtk_widget_set_sensitive(GTK_WIDGET(self->pause_button), TRUE);
@@ -636,11 +638,11 @@ gsr_record_page_set_active(GsrRecordPage *self, gboolean active)
gtk_widget_add_css_class(GTK_WIDGET(self->record_icon), "recording-active");
gtk_widget_remove_css_class(GTK_WIDGET(self->record_icon), "recording-paused");
} else {
- gtk_button_set_label(self->start_button, "Start recording");
+ gtk_button_set_label(self->start_button, _("Start recording"));
gtk_widget_remove_css_class(GTK_WIDGET(self->start_button), "destructive-action");
gtk_widget_add_css_class(GTK_WIDGET(self->start_button), "suggested-action");
gtk_widget_set_sensitive(GTK_WIDGET(self->pause_button), FALSE);
- gtk_button_set_label(self->pause_button, "Pause recording");
+ gtk_button_set_label(self->pause_button, _("Pause recording"));
gtk_widget_set_opacity(GTK_WIDGET(self->status_box), 0.5);
gtk_label_set_text(self->timer_label, "00:00:00");
gtk_image_set_from_icon_name(self->record_icon, "media-record-symbolic");
@@ -658,12 +660,12 @@ void
gsr_record_page_set_paused(GsrRecordPage *self, gboolean paused)
{
if (paused) {
- gtk_button_set_label(self->pause_button, "Unpause recording");
+ gtk_button_set_label(self->pause_button, _("Unpause recording"));
gtk_image_set_from_icon_name(self->record_icon, "media-playback-pause-symbolic");
gtk_widget_remove_css_class(GTK_WIDGET(self->record_icon), "recording-active");
gtk_widget_add_css_class(GTK_WIDGET(self->record_icon), "recording-paused");
} else {
- gtk_button_set_label(self->pause_button, "Pause recording");
+ gtk_button_set_label(self->pause_button, _("Pause recording"));
gtk_image_set_from_icon_name(self->record_icon, "media-record-symbolic");
gtk_widget_remove_css_class(GTK_WIDGET(self->record_icon), "recording-paused");
gtk_widget_add_css_class(GTK_WIDGET(self->record_icon), "recording-active");
@@ -697,7 +699,7 @@ gsr_record_page_new(const GsrInfo *info)
GsrRecordPage *self = g_object_new(GSR_TYPE_RECORD_PAGE, NULL);
self->info = info;
- adw_preferences_page_set_title(ADW_PREFERENCES_PAGE(self), "Record");
+ adw_preferences_page_set_title(ADW_PREFERENCES_PAGE(self), _("Record"));
adw_preferences_page_set_icon_name(ADW_PREFERENCES_PAGE(self),
"media-record-symbolic");
diff --git a/src/gsr-replay-page.c b/src/gsr-replay-page.c
index ea11ba2..08b4b9d 100644
--- a/src/gsr-replay-page.c
+++ b/src/gsr-replay-page.c
@@ -3,6 +3,8 @@
#include <signal.h>
#include <time.h>
+#include <glib/gi18n.h>
+
#include "gsr-window.h"
#ifdef HAVE_X11
@@ -125,7 +127,7 @@ on_save_dir_activated(AdwActionRow *row G_GNUC_UNUSED,
{
GsrReplayPage *self = GSR_REPLAY_PAGE(user_data);
g_autoptr(GtkFileDialog) dialog = gtk_file_dialog_new();
- gtk_file_dialog_set_title(dialog, "Select save directory");
+ gtk_file_dialog_set_title(dialog, _("Select save directory"));
if (self->save_directory) {
g_autoptr(GFile) initial = g_file_new_for_path(self->save_directory);
@@ -227,7 +229,7 @@ on_x11_start_stop_activated(AdwActionRow *row G_GNUC_UNUSED,
{
GsrReplayPage *self = GSR_REPLAY_PAGE(user_data);
GsrShortcutAccelDialog *dialog = gsr_shortcut_accel_dialog_new(
- "Start/Stop replay", self->x11_start_stop_accel);
+ _("Start/Stop replay"), self->x11_start_stop_accel);
g_signal_connect(dialog, "shortcut-set",
G_CALLBACK(on_x11_start_stop_shortcut_set), self);
adw_dialog_present(ADW_DIALOG(dialog), GTK_WIDGET(self));
@@ -257,7 +259,7 @@ on_x11_save_activated(AdwActionRow *row G_GNUC_UNUSED,
{
GsrReplayPage *self = GSR_REPLAY_PAGE(user_data);
GsrShortcutAccelDialog *dialog = gsr_shortcut_accel_dialog_new(
- "Save replay", self->x11_save_accel);
+ _("Save replay"), self->x11_save_accel);
g_signal_connect(dialog, "shortcut-set",
G_CALLBACK(on_x11_save_shortcut_set), self);
adw_dialog_present(ADW_DIALOG(dialog), GTK_WIDGET(self));
@@ -268,7 +270,7 @@ static void
build_hotkey_group(GsrReplayPage *self)
{
self->hotkey_group = ADW_PREFERENCES_GROUP(adw_preferences_group_new());
- adw_preferences_group_set_title(self->hotkey_group, "Hotkeys");
+ adw_preferences_group_set_title(self->hotkey_group, _("Hotkeys"));
GsrDisplayServer ds = self->info->system_info.display_server;
@@ -276,8 +278,8 @@ build_hotkey_group(GsrReplayPage *self)
if (ds == GSR_DISPLAY_SERVER_WAYLAND) {
/* "Not supported" label — initially hidden, shown if portal fails */
self->hotkey_not_supported_label = gtk_label_new(
- "Your Wayland compositor doesn't support global hotkeys.\n"
- "Use X11 or KDE Plasma on Wayland if you want to use hotkeys.");
+ _("Your Wayland compositor doesn't support global hotkeys.\n"
+ "Use X11 or KDE Plasma on Wayland if you want to use hotkeys."));
gtk_label_set_wrap(GTK_LABEL(self->hotkey_not_supported_label), TRUE);
gtk_widget_add_css_class(self->hotkey_not_supported_label, "dim-label");
gtk_widget_set_margin_top(self->hotkey_not_supported_label, 6);
@@ -291,32 +293,32 @@ build_hotkey_group(GsrReplayPage *self)
self->hotkey_info_row = GTK_WIDGET(info_row);
if (is_kde_wayland()) {
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(info_row),
- "Hotkeys are managed by KDE Plasma");
+ _("Hotkeys are managed by KDE Plasma"));
adw_action_row_set_subtitle(info_row,
- "Click to configure hotkeys in system settings");
+ _("Click to configure hotkeys in system settings"));
GtkButton *change_btn = GTK_BUTTON(
- gtk_button_new_with_label("Change hotkeys"));
+ gtk_button_new_with_label(_("Change hotkeys")));
gtk_widget_set_valign(GTK_WIDGET(change_btn), GTK_ALIGN_CENTER);
g_object_set_data(G_OBJECT(info_row), "change-button", change_btn);
adw_action_row_add_suffix(info_row, GTK_WIDGET(change_btn));
} else {
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(info_row),
- "Hotkeys are managed by your compositor");
+ _("Hotkeys are managed by your compositor"));
adw_action_row_set_subtitle(info_row,
- "Go to system settings to change hotkeys");
+ _("Go to system settings to change hotkeys"));
}
adw_preferences_group_add(self->hotkey_group, GTK_WIDGET(info_row));
/* Hotkey labels (shown after portal succeeds) */
AdwActionRow *start_row = ADW_ACTION_ROW(adw_action_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(start_row),
- "Start/Stop replay");
+ _("Start/Stop replay"));
adw_action_row_set_subtitle(start_row, "");
adw_preferences_group_add(self->hotkey_group, GTK_WIDGET(start_row));
AdwActionRow *save_row = ADW_ACTION_ROW(adw_action_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(save_row),
- "Save replay");
+ _("Save replay"));
adw_action_row_set_subtitle(save_row, "");
adw_preferences_group_add(self->hotkey_group, GTK_WIDGET(save_row));
@@ -332,7 +334,7 @@ build_hotkey_group(GsrReplayPage *self)
/* X11: interactive shortcut rows */
self->x11_start_stop_row = ADW_ACTION_ROW(adw_action_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->x11_start_stop_row),
- "Start/Stop replay");
+ _("Start/Stop replay"));
gtk_list_box_row_set_activatable(GTK_LIST_BOX_ROW(self->x11_start_stop_row), TRUE);
self->x11_start_stop_label = GTK_SHORTCUT_LABEL(
@@ -351,7 +353,7 @@ build_hotkey_group(GsrReplayPage *self)
/* Save replay row */
self->x11_save_row = ADW_ACTION_ROW(adw_action_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->x11_save_row),
- "Save replay");
+ _("Save replay"));
gtk_list_box_row_set_activatable(GTK_LIST_BOX_ROW(self->x11_save_row), TRUE);
self->x11_save_label = GTK_SHORTCUT_LABEL(
@@ -378,13 +380,13 @@ static void
build_output_group(GsrReplayPage *self)
{
self->output_group = ADW_PREFERENCES_GROUP(adw_preferences_group_new());
- adw_preferences_group_set_title(self->output_group, "Output");
+ adw_preferences_group_set_title(self->output_group, _("Output"));
/* Save directory */
self->save_directory = get_default_videos_dir();
self->save_dir_row = ADW_ACTION_ROW(adw_action_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->save_dir_row),
- "Save directory");
+ _("Save directory"));
adw_action_row_set_subtitle(self->save_dir_row, self->save_directory);
gtk_list_box_row_set_activatable(GTK_LIST_BOX_ROW(self->save_dir_row), TRUE);
@@ -400,7 +402,7 @@ build_output_group(GsrReplayPage *self)
/* Container format */
self->container_row = ADW_COMBO_ROW(adw_combo_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->container_row),
- "Container");
+ _("Container"));
GtkStringList *ct_model = gtk_string_list_new(NULL);
const char *containers[] = {
@@ -422,7 +424,7 @@ build_output_group(GsrReplayPage *self)
self->replay_time_row = ADW_SPIN_ROW(
adw_spin_row_new_with_range(5, 1200, 1));
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->replay_time_row),
- "Replay time (seconds)");
+ _("Replay time (seconds)"));
adw_spin_row_set_value(self->replay_time_row, 30);
adw_preferences_group_add(self->output_group,
GTK_WIDGET(self->replay_time_row));
@@ -441,7 +443,7 @@ build_action_group(GsrReplayPage *self)
gtk_widget_set_margin_bottom(GTK_WIDGET(box), 6);
self->start_button = GTK_BUTTON(
- gtk_button_new_with_label("Start replay"));
+ gtk_button_new_with_label(_("Start replay")));
gtk_widget_set_hexpand(GTK_WIDGET(self->start_button), TRUE);
gtk_widget_add_css_class(GTK_WIDGET(self->start_button), "suggested-action");
g_signal_connect(self->start_button, "clicked",
@@ -449,7 +451,7 @@ build_action_group(GsrReplayPage *self)
gtk_box_append(box, GTK_WIDGET(self->start_button));
self->save_button = GTK_BUTTON(
- gtk_button_new_with_label("Save replay"));
+ gtk_button_new_with_label(_("Save replay")));
gtk_widget_set_hexpand(GTK_WIDGET(self->save_button), TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(self->save_button), FALSE);
g_signal_connect(self->save_button, "clicked",
@@ -623,14 +625,14 @@ void
gsr_replay_page_set_active(GsrReplayPage *self, gboolean active)
{
if (active) {
- gtk_button_set_label(self->start_button, "Stop replay");
+ gtk_button_set_label(self->start_button, _("Stop replay"));
gtk_widget_remove_css_class(GTK_WIDGET(self->start_button), "suggested-action");
gtk_widget_add_css_class(GTK_WIDGET(self->start_button), "destructive-action");
gtk_widget_set_sensitive(GTK_WIDGET(self->save_button), TRUE);
gtk_widget_set_opacity(GTK_WIDGET(self->status_box), 1.0);
gtk_widget_add_css_class(GTK_WIDGET(self->record_icon), "recording-active");
} else {
- gtk_button_set_label(self->start_button, "Start replay");
+ gtk_button_set_label(self->start_button, _("Start replay"));
gtk_widget_remove_css_class(GTK_WIDGET(self->start_button), "destructive-action");
gtk_widget_add_css_class(GTK_WIDGET(self->start_button), "suggested-action");
gtk_widget_set_sensitive(GTK_WIDGET(self->save_button), FALSE);
@@ -677,7 +679,7 @@ gsr_replay_page_new(const GsrInfo *info)
GsrReplayPage *self = g_object_new(GSR_TYPE_REPLAY_PAGE, NULL);
self->info = info;
- adw_preferences_page_set_title(ADW_PREFERENCES_PAGE(self), "Replay");
+ adw_preferences_page_set_title(ADW_PREFERENCES_PAGE(self), _("Replay"));
adw_preferences_page_set_icon_name(ADW_PREFERENCES_PAGE(self),
"media-playlist-repeat-symbolic");
diff --git a/src/gsr-shortcut-accel-dialog.c b/src/gsr-shortcut-accel-dialog.c
index 038c141..cadc763 100644
--- a/src/gsr-shortcut-accel-dialog.c
+++ b/src/gsr-shortcut-accel-dialog.c
@@ -1,6 +1,7 @@
#include "gsr-shortcut-accel-dialog.h"
#include <gdk/gdk.h>
+#include <glib/gi18n.h>
/* ═══════════════════════════════════════════════════════════════════
* GsrShortcutAccelDialog — Ptyxis-style key capture dialog
@@ -241,19 +242,19 @@ gsr_shortcut_accel_dialog_class_init(GsrShortcutAccelDialogClass *klass)
static void
build_dialog_ui(GsrShortcutAccelDialog *self)
{
- adw_dialog_set_title(ADW_DIALOG(self), "Set Shortcut");
+ adw_dialog_set_title(ADW_DIALOG(self), _("Set Shortcut"));
adw_dialog_set_content_width(ADW_DIALOG(self), 400);
adw_dialog_set_content_height(ADW_DIALOG(self), 260);
/* ── Header bar ─── */
AdwHeaderBar *header = ADW_HEADER_BAR(adw_header_bar_new());
- self->cancel_button = GTK_BUTTON(gtk_button_new_with_label("Cancel"));
+ self->cancel_button = GTK_BUTTON(gtk_button_new_with_label(_("Cancel")));
g_signal_connect(self->cancel_button, "clicked",
G_CALLBACK(on_cancel_clicked), self);
adw_header_bar_pack_start(header, GTK_WIDGET(self->cancel_button));
- self->set_button = GTK_BUTTON(gtk_button_new_with_label("Set"));
+ self->set_button = GTK_BUTTON(gtk_button_new_with_label(_("Set")));
gtk_widget_add_css_class(GTK_WIDGET(self->set_button), "suggested-action");
gtk_widget_set_sensitive(GTK_WIDGET(self->set_button), FALSE);
g_signal_connect(self->set_button, "clicked",
@@ -280,9 +281,9 @@ build_dialog_ui(GsrShortcutAccelDialog *self)
gtk_box_append(capture_box, GTK_WIDGET(keyboard_icon));
g_autofree char *escaped_title = g_markup_escape_text(
- self->shortcut_title ? self->shortcut_title : "Shortcut", -1);
+ self->shortcut_title ? self->shortcut_title : _("Shortcut"), -1);
g_autofree char *label_text = g_strdup_printf(
- "Enter new shortcut for\n<b>%s</b>", escaped_title);
+ _("Enter new shortcut for\n<b>%s</b>"), escaped_title);
self->capture_label = GTK_LABEL(gtk_label_new(NULL));
gtk_label_set_markup(self->capture_label, label_text);
gtk_label_set_justify(self->capture_label, GTK_JUSTIFY_CENTER);
@@ -290,7 +291,7 @@ build_dialog_ui(GsrShortcutAccelDialog *self)
gtk_box_append(capture_box, GTK_WIDGET(self->capture_label));
self->capture_hint = GTK_LABEL(gtk_label_new(
- "Press Escape to cancel or Backspace to disable the shortcut."));
+ _("Press Escape to cancel or Backspace to disable the shortcut.")));
gtk_widget_add_css_class(GTK_WIDGET(self->capture_hint), "dim-label");
gtk_label_set_wrap(self->capture_hint, TRUE);
gtk_label_set_justify(self->capture_hint, GTK_JUSTIFY_CENTER);
@@ -309,9 +310,9 @@ build_dialog_ui(GsrShortcutAccelDialog *self)
GtkLabel *display_title = GTK_LABEL(gtk_label_new(NULL));
g_autofree char *escaped_display_title = g_markup_escape_text(
- self->shortcut_title ? self->shortcut_title : "Shortcut", -1);
+ self->shortcut_title ? self->shortcut_title : _("Shortcut"), -1);
g_autofree char *display_text = g_strdup_printf(
- "Shortcut for <b>%s</b>", escaped_display_title);
+ _("Shortcut for <b>%s</b>"), escaped_display_title);
gtk_label_set_markup(display_title, display_text);
gtk_label_set_justify(display_title, GTK_JUSTIFY_CENTER);
gtk_label_set_wrap(display_title, TRUE);
diff --git a/src/gsr-stream-page.c b/src/gsr-stream-page.c
index 989927b..1bd4a71 100644
--- a/src/gsr-stream-page.c
+++ b/src/gsr-stream-page.c
@@ -1,6 +1,7 @@
#include "gsr-stream-page.h"
#include <time.h>
+#include <glib/gi18n.h>
#include "gsr-window.h"
@@ -207,7 +208,7 @@ on_x11_start_stop_activated(AdwActionRow *row G_GNUC_UNUSED,
{
GsrStreamPage *self = GSR_STREAM_PAGE(user_data);
GsrShortcutAccelDialog *dialog = gsr_shortcut_accel_dialog_new(
- "Start/Stop streaming", self->x11_start_stop_accel);
+ _("Start/Stop streaming"), self->x11_start_stop_accel);
g_signal_connect(dialog, "shortcut-set",
G_CALLBACK(on_x11_start_stop_shortcut_set), self);
adw_dialog_present(ADW_DIALOG(dialog), GTK_WIDGET(self));
@@ -218,7 +219,7 @@ static void
build_hotkey_group(GsrStreamPage *self)
{
self->hotkey_group = ADW_PREFERENCES_GROUP(adw_preferences_group_new());
- adw_preferences_group_set_title(self->hotkey_group, "Hotkeys");
+ adw_preferences_group_set_title(self->hotkey_group, _("Hotkeys"));
GsrDisplayServer ds = self->info->system_info.display_server;
@@ -226,8 +227,8 @@ build_hotkey_group(GsrStreamPage *self)
if (ds == GSR_DISPLAY_SERVER_WAYLAND) {
/* "Not supported" label — initially hidden, shown if portal fails */
self->hotkey_not_supported_label = gtk_label_new(
- "Your Wayland compositor doesn't support global hotkeys.\n"
- "Use X11 or KDE Plasma on Wayland if you want to use hotkeys.");
+ _("Your Wayland compositor doesn't support global hotkeys.\n"
+ "Use X11 or KDE Plasma on Wayland if you want to use hotkeys."));
gtk_label_set_wrap(GTK_LABEL(self->hotkey_not_supported_label), TRUE);
gtk_widget_add_css_class(self->hotkey_not_supported_label, "dim-label");
gtk_widget_set_margin_top(self->hotkey_not_supported_label, 6);
@@ -241,27 +242,27 @@ build_hotkey_group(GsrStreamPage *self)
self->hotkey_info_row = GTK_WIDGET(info_row);
if (is_kde_wayland()) {
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(info_row),
- "Hotkeys are managed by KDE Plasma");
+ _("Hotkeys are managed by KDE Plasma"));
adw_action_row_set_subtitle(info_row,
- "Click to configure hotkeys in system settings");
+ _("Click to configure hotkeys in system settings"));
GtkButton *change_btn = GTK_BUTTON(
- gtk_button_new_with_label("Change hotkeys"));
+ gtk_button_new_with_label(_("Change hotkeys")));
gtk_widget_set_valign(GTK_WIDGET(change_btn), GTK_ALIGN_CENTER);
/* The button will be wired to gsr_hotkeys from the window */
g_object_set_data(G_OBJECT(info_row), "change-button", change_btn);
adw_action_row_add_suffix(info_row, GTK_WIDGET(change_btn));
} else {
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(info_row),
- "Hotkeys are managed by your compositor");
+ _("Hotkeys are managed by your compositor"));
adw_action_row_set_subtitle(info_row,
- "Go to system settings to change hotkeys");
+ _("Go to system settings to change hotkeys"));
}
adw_preferences_group_add(self->hotkey_group, GTK_WIDGET(info_row));
/* Hotkey labels (shown after portal succeeds) */
AdwActionRow *start_row = ADW_ACTION_ROW(adw_action_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(start_row),
- "Start/Stop streaming");
+ _("Start/Stop streaming"));
adw_action_row_set_subtitle(start_row, "");
adw_preferences_group_add(self->hotkey_group, GTK_WIDGET(start_row));
@@ -276,7 +277,7 @@ build_hotkey_group(GsrStreamPage *self)
/* X11: interactive shortcut rows */
self->x11_start_stop_row = ADW_ACTION_ROW(adw_action_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->x11_start_stop_row),
- "Start/Stop streaming");
+ _("Start/Stop streaming"));
gtk_list_box_row_set_activatable(GTK_LIST_BOX_ROW(self->x11_start_stop_row), TRUE);
self->x11_start_stop_label = GTK_SHORTCUT_LABEL(
@@ -304,14 +305,14 @@ static void
build_service_group(GsrStreamPage *self)
{
self->service_group = ADW_PREFERENCES_GROUP(adw_preferences_group_new());
- adw_preferences_group_set_title(self->service_group, "Streaming Service");
+ adw_preferences_group_set_title(self->service_group, _("Streaming Service"));
/* Service selector */
self->service_row = ADW_COMBO_ROW(adw_combo_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->service_row),
- "Service");
+ _("Service"));
GtkStringList *svc_model = gtk_string_list_new(
- (const char *const[]){ "Twitch", "YouTube", "Custom", NULL });
+ (const char *const[]){ _("Twitch"), _("YouTube"), _("Custom"), NULL });
adw_combo_row_set_model(self->service_row, G_LIST_MODEL(svc_model));
adw_combo_row_set_selected(self->service_row, 0);
g_signal_connect(self->service_row, "notify::selected",
@@ -322,14 +323,14 @@ build_service_group(GsrStreamPage *self)
/* Twitch stream key */
self->twitch_key_row = ADW_PASSWORD_ENTRY_ROW(adw_password_entry_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->twitch_key_row),
- "Stream key");
+ _("Stream key"));
adw_preferences_group_add(self->service_group,
GTK_WIDGET(self->twitch_key_row));
/* YouTube stream key */
self->youtube_key_row = ADW_PASSWORD_ENTRY_ROW(adw_password_entry_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->youtube_key_row),
- "Stream key");
+ _("Stream key"));
gtk_widget_set_visible(GTK_WIDGET(self->youtube_key_row), FALSE);
adw_preferences_group_add(self->service_group,
GTK_WIDGET(self->youtube_key_row));
@@ -337,7 +338,7 @@ build_service_group(GsrStreamPage *self)
/* Custom URL */
self->custom_url_row = ADW_PASSWORD_ENTRY_ROW(adw_password_entry_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->custom_url_row),
- "URL");
+ _("URL"));
gtk_widget_set_visible(GTK_WIDGET(self->custom_url_row), FALSE);
adw_preferences_group_add(self->service_group,
GTK_WIDGET(self->custom_url_row));
@@ -345,7 +346,7 @@ build_service_group(GsrStreamPage *self)
/* Container (custom service only) */
self->container_row = ADW_COMBO_ROW(adw_combo_row_new());
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(self->container_row),
- "Container");
+ _("Container"));
GtkStringList *ct_model = gtk_string_list_new(NULL);
const char *containers[] = {
@@ -379,7 +380,7 @@ build_action_group(GsrStreamPage *self)
gtk_widget_set_margin_top(GTK_WIDGET(box), 6);
gtk_widget_set_margin_bottom(GTK_WIDGET(box), 6);
- self->start_button = GTK_BUTTON(gtk_button_new_with_label("Start streaming"));
+ self->start_button = GTK_BUTTON(gtk_button_new_with_label(_("Start streaming")));
gtk_widget_set_hexpand(GTK_WIDGET(self->start_button), TRUE);
gtk_widget_add_css_class(GTK_WIDGET(self->start_button), "suggested-action");
g_signal_connect(self->start_button, "clicked",
@@ -446,7 +447,7 @@ gsr_stream_page_new(const GsrInfo *info)
GsrStreamPage *self = g_object_new(GSR_TYPE_STREAM_PAGE, NULL);
self->info = info;
- adw_preferences_page_set_title(ADW_PREFERENCES_PAGE(self), "Stream");
+ adw_preferences_page_set_title(ADW_PREFERENCES_PAGE(self), _("Stream"));
adw_preferences_page_set_icon_name(ADW_PREFERENCES_PAGE(self),
"network-transmit-symbolic");
@@ -594,13 +595,13 @@ void
gsr_stream_page_set_active(GsrStreamPage *self, gboolean active)
{
if (active) {
- gtk_button_set_label(self->start_button, "Stop streaming");
+ gtk_button_set_label(self->start_button, _("Stop streaming"));
gtk_widget_remove_css_class(GTK_WIDGET(self->start_button), "suggested-action");
gtk_widget_add_css_class(GTK_WIDGET(self->start_button), "destructive-action");
gtk_widget_set_opacity(GTK_WIDGET(self->status_box), 1.0);
gtk_widget_add_css_class(GTK_WIDGET(self->record_icon), "recording-active");
} else {
- gtk_button_set_label(self->start_button, "Start streaming");
+ gtk_button_set_label(self->start_button, _("Start streaming"));
gtk_widget_remove_css_class(GTK_WIDGET(self->start_button), "destructive-action");
gtk_widget_add_css_class(GTK_WIDGET(self->start_button), "suggested-action");
gtk_widget_set_opacity(GTK_WIDGET(self->status_box), 0.5);
diff --git a/src/gsr-window.c b/src/gsr-window.c
index 76a8a76..e6602ff 100644
--- a/src/gsr-window.c
+++ b/src/gsr-window.c
@@ -6,6 +6,8 @@
#include <time.h>
#include <unistd.h>
+#include <glib/gi18n.h>
+
#include "gsr-config-page.h"
#include "gsr-config.h"
#include "gsr-hotkeys.h"
@@ -89,10 +91,10 @@ static const char *
active_mode_to_string(GsrActiveMode mode)
{
switch (mode) {
- case GSR_ACTIVE_MODE_STREAM: return "streaming";
- case GSR_ACTIVE_MODE_RECORD: return "recording";
- case GSR_ACTIVE_MODE_REPLAY: return "replay";
- default: return "unknown";
+ case GSR_ACTIVE_MODE_STREAM: return _("streaming");
+ case GSR_ACTIVE_MODE_RECORD: return _("recording");
+ case GSR_ACTIVE_MODE_REPLAY: return _("replay");
+ default: return _("unknown");
}
}
@@ -177,7 +179,7 @@ send_notification_full(GsrWindow *self, const char *title,
AdwToast *toast = adw_toast_new(body);
adw_toast_set_timeout(toast, (effective >= G_NOTIFICATION_PRIORITY_URGENT) ? 10 : 3);
if (open_file_path && *open_file_path) {
- adw_toast_set_button_label(toast, "Open Folder");
+ adw_toast_set_button_label(toast, _("Open Folder"));
adw_toast_set_action_name(toast, "app.open-folder");
adw_toast_set_action_target_value(toast,
g_variant_new_string(open_file_path));
@@ -569,14 +571,14 @@ handle_child_death(GsrWindow *self, int exit_status)
/* Success */
if (mode == GSR_ACTIVE_MODE_RECORD && self->record_filename) {
if (gsr_config_page_get_notify_saved(self->config_page)) {
- g_autofree char *msg = g_strdup_printf("Recording saved to %s",
+ g_autofree char *msg = g_strdup_printf(_("Recording saved to %s"),
self->record_filename);
send_notification_full(self, "GPU Screen Recorder", msg,
G_NOTIFICATION_PRIORITY_NORMAL, self->record_filename);
}
} else if (gsr_config_page_get_notify_stopped(self->config_page)) {
const char *mode_str = active_mode_to_string(mode);
- g_autofree char *msg = g_strdup_printf("Stopped %s", mode_str);
+ g_autofree char *msg = g_strdup_printf(_("Stopped %s"), mode_str);
send_notification(self, "GPU Screen Recorder", msg,
G_NOTIFICATION_PRIORITY_NORMAL);
}
@@ -584,18 +586,18 @@ handle_child_death(GsrWindow *self, int exit_status)
/* Error — always notify regardless of user prefs */
g_autofree char *msg = NULL;
if (exit_status == 10)
- msg = g_strdup_printf("You need to have pkexec installed and have "
- "a polkit agent running to record your monitor");
+ msg = g_strdup(_("You need to have pkexec installed and have "
+ "a polkit agent running to record your monitor"));
else if (exit_status == 50)
- msg = g_strdup_printf("Desktop portal capture failed. Either you "
+ msg = g_strdup(_("Desktop portal capture failed. Either you "
"canceled the desktop portal or your Wayland compositor "
"doesn't support desktop portal capture or it's incorrectly "
- "setup on your system");
+ "setup on your system"));
else
- msg = g_strdup_printf("Failed to save video. Either your graphics "
+ msg = g_strdup(_("Failed to save video. Either your graphics "
"card doesn't support GPU Screen Recorder with the settings "
"you used or you don't have enough disk space. "
- "Start GPU Screen Recorder from the terminal for more info");
+ "Start GPU Screen Recorder from the terminal for more info"));
send_notification(self, "GPU Screen Recorder", msg,
G_NOTIFICATION_PRIORITY_URGENT);
}
@@ -692,12 +694,12 @@ create_primary_menu(GsrWindow *self)
/* View mode section (with "View" header label) — kept separate for
dynamic insertion/removal based on the active tab. */
self->view_section = g_menu_new();
- g_autoptr(GMenuItem) simple_item = g_menu_item_new("Simple", NULL);
+ g_autoptr(GMenuItem) simple_item = g_menu_item_new(_("Simple"), NULL);
g_menu_item_set_action_and_target_value(simple_item,
"win.view-mode", g_variant_new_string("simple"));
g_menu_append_item(self->view_section, simple_item);
- g_autoptr(GMenuItem) advanced_item = g_menu_item_new("Advanced", NULL);
+ g_autoptr(GMenuItem) advanced_item = g_menu_item_new(_("Advanced"), NULL);
g_menu_item_set_action_and_target_value(advanced_item,
"win.view-mode", g_variant_new_string("advanced"));
g_menu_append_item(self->view_section, advanced_item);
@@ -708,8 +710,8 @@ create_primary_menu(GsrWindow *self)
/* About section (always present) */
g_autoptr(GMenu) about_section = g_menu_new();
- g_menu_append(about_section, "Keyboard Shortcuts", "app.shortcuts");
- g_menu_append(about_section, "About", "app.about");
+ g_menu_append(about_section, _("Keyboard Shortcuts"), "app.shortcuts");
+ g_menu_append(about_section, _("About"), "app.about");
g_menu_append_section(self->primary_menu, NULL,
G_MENU_MODEL(about_section));
}
@@ -721,7 +723,7 @@ update_view_section_visibility(GsrWindow *self, gboolean show)
{
if (show && !self->view_section_visible) {
g_menu_insert_section(self->primary_menu, 0,
- "View", G_MENU_MODEL(self->view_section));
+ _("View"), G_MENU_MODEL(self->view_section));
self->view_section_visible = TRUE;
} else if (!show && self->view_section_visible) {
g_menu_remove(self->primary_menu, 0);
@@ -776,7 +778,7 @@ static void
show_fatal_error(GsrWindow *self, const char *heading, const char *body)
{
AdwAlertDialog *dlg = ADW_ALERT_DIALOG(adw_alert_dialog_new(heading, body));
- adw_alert_dialog_add_response(dlg, "ok", "OK");
+ adw_alert_dialog_add_response(dlg, "ok", _("OK"));
adw_alert_dialog_set_default_response(dlg, "ok");
adw_alert_dialog_set_close_response(dlg, "ok");
adw_alert_dialog_set_body_use_markup(dlg, TRUE);
@@ -794,26 +796,26 @@ check_startup_errors_idle(gpointer user_data)
switch (self->info_status) {
case GSR_INFO_EXIT_FAILED_TO_RUN:
show_fatal_error(self,
- "Failed to run gpu-screen-recorder",
- "Failed to run the <tt>gpu-screen-recorder</tt> command.\n\n"
+ _("Failed to run gpu-screen-recorder"),
+ _("Failed to run the <tt>gpu-screen-recorder</tt> command.\n\n"
"Make sure <tt>gpu-screen-recorder</tt> is installed and "
- "accessible in your PATH.");
+ "accessible in your PATH."));
return;
case GSR_INFO_EXIT_OPENGL_FAILED:
show_fatal_error(self,
- "OpenGL initialization failed",
- "Failed to get OpenGL information.\n\n"
+ _("OpenGL initialization failed"),
+ _("Failed to get OpenGL information.\n\n"
"Make sure your GPU drivers are properly installed. "
- "You may need to install the Vulkan or Mesa drivers for your GPU.");
+ "You may need to install the Vulkan or Mesa drivers for your GPU."));
return;
case GSR_INFO_EXIT_NO_DRM_CARD:
show_fatal_error(self,
- "No DRM card found",
- "Failed to find a valid DRM card for your GPU.\n\n"
+ _("No DRM card found"),
+ _("Failed to find a valid DRM card for your GPU.\n\n"
"If you are running in a VM, make sure GPU passthrough is "
- "enabled and properly configured.");
+ "enabled and properly configured."));
return;
case GSR_INFO_EXIT_OK:
@@ -823,9 +825,9 @@ check_startup_errors_idle(gpointer user_data)
/* Check display server */
if (self->info.system_info.display_server == GSR_DISPLAY_SERVER_UNKNOWN) {
show_fatal_error(self,
- "No display server detected",
- "Neither X11 nor Wayland is running.\n\n"
- "GPU Screen Recorder requires either X11 or Wayland.");
+ _("No display server detected"),
+ _("Neither X11 nor Wayland is running.\n\n"
+ "GPU Screen Recorder requires either X11 or Wayland."));
return;
}
@@ -835,11 +837,11 @@ check_startup_errors_idle(gpointer user_data)
!self->info.supported_capture_options.portal)
{
show_fatal_error(self,
- "No monitors found",
- "No monitors to record were found.\n\n"
+ _("No monitors found"),
+ _("No monitors to record were found.\n\n"
"Make sure GPU Screen Recorder is running on the same GPU "
"that your monitors are connected to. You can use the "
- "<tt>DRI_PRIME</tt> environment variable to choose a GPU.");
+ "<tt>DRI_PRIME</tt> environment variable to choose a GPU."));
return;
}
}
@@ -862,7 +864,7 @@ gsr_window_init(GsrWindow *self)
self->is_kde = desktop && (g_strstr_len(desktop, -1, "KDE") != NULL);
/* ── Window properties ─── */
- gtk_window_set_title(GTK_WINDOW(self), "GPU Screen Recorder");
+ gtk_window_set_title(GTK_WINDOW(self), _("GPU Screen Recorder"));
gtk_window_set_default_size(GTK_WINDOW(self), 580, 600);
gtk_widget_set_size_request(GTK_WIDGET(self), 430, 300);
@@ -887,20 +889,20 @@ gsr_window_init(GsrWindow *self)
self->replay_page = gsr_replay_page_new(&self->info);
adw_view_stack_add_titled_with_icon(self->view_stack,
- GTK_WIDGET(self->config_page), "config", "Config", "preferences-system-symbolic");
+ GTK_WIDGET(self->config_page), "config", _("Config"), "preferences-system-symbolic");
adw_view_stack_add_titled_with_icon(self->view_stack,
- GTK_WIDGET(self->stream_page), "stream", "Stream", "network-transmit-symbolic");
+ GTK_WIDGET(self->stream_page), "stream", _("Stream"), "network-transmit-symbolic");
adw_view_stack_add_titled_with_icon(self->view_stack,
- GTK_WIDGET(self->record_page), "record", "Record", "media-record-symbolic");
+ GTK_WIDGET(self->record_page), "record", _("Record"), "media-record-symbolic");
adw_view_stack_add_titled_with_icon(self->view_stack,
- GTK_WIDGET(self->replay_page), "replay", "Replay", "media-playlist-repeat-symbolic");
+ GTK_WIDGET(self->replay_page), "replay", _("Replay"), "media-playlist-repeat-symbolic");
/* ── Header bar with view switcher / title stack ─── */
self->header_switcher = ADW_VIEW_SWITCHER(adw_view_switcher_new());
adw_view_switcher_set_stack(self->header_switcher, self->view_stack);
adw_view_switcher_set_policy(self->header_switcher, ADW_VIEW_SWITCHER_POLICY_WIDE);
- self->header_title_label = GTK_LABEL(gtk_label_new("GPU Screen Recorder"));
+ self->header_title_label = GTK_LABEL(gtk_label_new(_("GPU Screen Recorder")));
gtk_widget_add_css_class(GTK_WIDGET(self->header_title_label), "title");
/* Stack to hold both the switcher (wide) and title label (narrow) */
@@ -1055,7 +1057,7 @@ gsr_window_start_process(GsrWindow *self, GsrActiveMode mode)
/* Validate window selection if in "window" mode */
if (!gsr_config_page_has_valid_window_selection(self->config_page)) {
send_notification(self, "GPU Screen Recorder",
- "No window selected! Please select a window first.",
+ _("No window selected! Please select a window first."),
G_NOTIFICATION_PRIORITY_URGENT);
return FALSE;
}
@@ -1064,7 +1066,7 @@ gsr_window_start_process(GsrWindow *self, GsrActiveMode mode)
GPtrArray *args = build_command_args(self, mode);
if (!args) {
send_notification(self, "GPU Screen Recorder",
- "Failed to build command (no window selected)",
+ _("Failed to build command (no window selected)"),
G_NOTIFICATION_PRIORITY_URGENT);
return FALSE;
}
@@ -1075,7 +1077,7 @@ gsr_window_start_process(GsrWindow *self, GsrActiveMode mode)
if (!ok) {
const char *mode_str = active_mode_to_string(mode);
- g_autofree char *msg = g_strdup_printf("Failed to start %s (failed to fork)", mode_str);
+ g_autofree char *msg = g_strdup_printf(_("Failed to start %s (failed to fork)"), mode_str);
send_notification(self, "GPU Screen Recorder", msg,
G_NOTIFICATION_PRIORITY_URGENT);
return FALSE;
@@ -1090,7 +1092,7 @@ gsr_window_start_process(GsrWindow *self, GsrActiveMode mode)
/* Show "started" notification */
if (gsr_config_page_get_notify_started(self->config_page)) {
const char *mode_str = active_mode_to_string(mode);
- g_autofree char *msg = g_strdup_printf("Started %s", mode_str);
+ g_autofree char *msg = g_strdup_printf(_("Started %s"), mode_str);
send_notification(self, "GPU Screen Recorder", msg,
G_NOTIFICATION_PRIORITY_NORMAL);
}
@@ -1122,14 +1124,14 @@ gsr_window_stop_process(GsrWindow *self, gboolean *already_dead)
/* Show stop notification (respecting user prefs) */
if (success && mode == GSR_ACTIVE_MODE_RECORD && self->record_filename) {
if (gsr_config_page_get_notify_saved(self->config_page)) {
- g_autofree char *msg = g_strdup_printf("Recording saved to %s",
+ g_autofree char *msg = g_strdup_printf(_("Recording saved to %s"),
self->record_filename);
send_notification_full(self, "GPU Screen Recorder", msg,
G_NOTIFICATION_PRIORITY_NORMAL, self->record_filename);
}
} else if (gsr_config_page_get_notify_stopped(self->config_page)) {
const char *mode_str = active_mode_to_string(mode);
- g_autofree char *msg = g_strdup_printf("Stopped %s", mode_str);
+ g_autofree char *msg = g_strdup_printf(_("Stopped %s"), mode_str);
send_notification(self, "GPU Screen Recorder", msg,
G_NOTIFICATION_PRIORITY_NORMAL);
}
@@ -1150,7 +1152,7 @@ gsr_window_notify_replay_saved(GsrWindow *self)
{
g_return_if_fail(GSR_IS_WINDOW(self));
if (gsr_config_page_get_notify_saved(self->config_page))
- send_notification(self, "GPU Screen Recorder", "Saved replay",
+ send_notification(self, "GPU Screen Recorder", _("Saved replay"),
G_NOTIFICATION_PRIORITY_NORMAL);
}
diff --git a/src/main.c b/src/main.c
index 16e706b..70343d2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,4 +1,8 @@
+#include <locale.h>
+
#include <adwaita.h>
+#include <glib/gi18n.h>
+
#include "gsr-window.h"
/* ── About dialog ────────────────────────────────────────────────── */
@@ -29,7 +33,7 @@ on_about_action(GSimpleAction *action,
const char *developers[] = { "dec05eba", NULL };
adw_about_dialog_set_developers(about, developers);
- adw_about_dialog_add_credit_section(about, "Adwaita Port",
+ adw_about_dialog_add_credit_section(about, _("Adwaita Port"),
(const char *[]){ "Trung Lê", NULL });
adw_dialog_present(ADW_DIALOG(about), GTK_WIDGET(win));
@@ -52,25 +56,25 @@ on_shortcuts_action(GSimpleAction *action,
adw_shortcuts_dialog_new());
/* ── Stream section ─── */
- AdwShortcutsSection *stream_sec = adw_shortcuts_section_new("Stream");
+ AdwShortcutsSection *stream_sec = adw_shortcuts_section_new(_("Stream"));
adw_shortcuts_section_add(stream_sec,
- adw_shortcuts_item_new("Start / Stop streaming", "<Alt>1"));
+ adw_shortcuts_item_new(_("Start / Stop streaming"), "<Alt>1"));
adw_shortcuts_dialog_add(dialog, stream_sec);
/* ── Record section ─── */
- AdwShortcutsSection *record_sec = adw_shortcuts_section_new("Record");
+ AdwShortcutsSection *record_sec = adw_shortcuts_section_new(_("Record"));
adw_shortcuts_section_add(record_sec,
- adw_shortcuts_item_new("Start / Stop recording", "<Alt>1"));
+ adw_shortcuts_item_new(_("Start / Stop recording"), "<Alt>1"));
adw_shortcuts_section_add(record_sec,
- adw_shortcuts_item_new("Pause / Unpause recording", "<Alt>2"));
+ adw_shortcuts_item_new(_("Pause / Unpause recording"), "<Alt>2"));
adw_shortcuts_dialog_add(dialog, record_sec);
/* ── Replay section ─── */
- AdwShortcutsSection *replay_sec = adw_shortcuts_section_new("Replay");
+ AdwShortcutsSection *replay_sec = adw_shortcuts_section_new(_("Replay"));
adw_shortcuts_section_add(replay_sec,
- adw_shortcuts_item_new("Start / Stop replay", "<Alt>1"));
+ adw_shortcuts_item_new(_("Start / Stop replay"), "<Alt>1"));
adw_shortcuts_section_add(replay_sec,
- adw_shortcuts_item_new("Save replay", "<Alt>2"));
+ adw_shortcuts_item_new(_("Save replay"), "<Alt>2"));
adw_shortcuts_dialog_add(dialog, replay_sec);
adw_dialog_present(ADW_DIALOG(dialog), GTK_WIDGET(win));
@@ -154,6 +158,11 @@ on_activate(GtkApplication *app, gpointer user_data)
int
main(int argc, char *argv[])
{
+ setlocale(LC_ALL, "");
+ bindtextdomain(GETTEXT_PACKAGE, GSR_LOCALEDIR);
+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+ textdomain(GETTEXT_PACKAGE);
+
g_autoptr(AdwApplication) app = adw_application_new(
"com.dec05eba.gpu_screen_recorder",
G_APPLICATION_DEFAULT_FLAGS);