M gtkgreet/actions.c => gtkgreet/actions.c +7 -5
@@ 3,6 3,8 @@
#include <time.h>
#include <assert.h>
+#include <glib/gi18n.h>
+
#include <gtk/gtk.h>
#include "actions.h"
@@ 30,8 32,8 @@ static void handle_response(struct response resp, int start_req) {
};
roundtrip(req);
- char *error = "Unexpected auth question";
- gtkgreet_setup_question(gtkgreet, QuestionTypeInitial, INITIAL_QUESTION, error);
+ char *error = _("Unexpected auth question");
+ gtkgreet_setup_question(gtkgreet, QuestionTypeInitial, gtkgreet_get_initial_question(), error);
break;
}
@@ 51,11 53,11 @@ static void handle_response(struct response resp, int start_req) {
char* error = NULL;
if (resp.response_type == response_type_error &&
resp.body.response_error.error_type == error_type_auth) {
- error = "Login failed";
+ error = _("Login failed");
} else {
error = resp.body.response_error.description;
}
- gtkgreet_setup_question(gtkgreet, QuestionTypeInitial, INITIAL_QUESTION, error);
+ gtkgreet_setup_question(gtkgreet, QuestionTypeInitial, gtkgreet_get_initial_question(), error);
break;
}
}
@@ 112,5 114,5 @@ void action_cancel_question(GtkWidget *widget, gpointer data) {
exit(1);
}
- gtkgreet_setup_question(gtkgreet, QuestionTypeInitial, INITIAL_QUESTION, NULL);
+ gtkgreet_setup_question(gtkgreet, QuestionTypeInitial, gtkgreet_get_initial_question(), NULL);
}
M gtkgreet/gtkgreet.c => gtkgreet/gtkgreet.c +8 -2
@@ 2,6 2,8 @@
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
#include "window.h"
#include "gtkgreet.h"
@@ 99,7 101,7 @@ struct GtkGreet* create_gtkgreet() {
void gtkgreet_activate(struct GtkGreet *gtkgreet) {
gtkgreet->draw_clock_source = g_timeout_add_seconds(5, gtkgreet_update_clocks_handler, gtkgreet);
- gtkgreet_setup_question(gtkgreet, QuestionTypeInitial, INITIAL_QUESTION, NULL);
+ gtkgreet_setup_question(gtkgreet, QuestionTypeInitial, gtkgreet_get_initial_question(), NULL);
gtkgreet_update_clocks(gtkgreet);
}
@@ 121,4 123,8 @@ void gtkgreet_destroy(struct GtkGreet *gtkgreet) {
gtkgreet->draw_clock_source = 0;
}
free(gtkgreet);
-}>
\ No newline at end of file
+}
+
+char* gtkgreet_get_initial_question() {
+ return _("Username:");
+}
M gtkgreet/gtkgreet.h => gtkgreet/gtkgreet.h +1 -1
@@ 3,7 3,6 @@
#include <gtk/gtk.h>
-#define INITIAL_QUESTION "Username:"
enum QuestionType {
QuestionTypeInitial = 0,
@@ 48,5 47,6 @@ void gtkgreet_update_clocks(struct GtkGreet *gtkgreet);
struct GtkGreet* create_gtkgreet();
void gtkgreet_activate(struct GtkGreet *gtkgreet);
void gtkgreet_destroy(struct GtkGreet *gtkgreet);
+char* gtkgreet_get_initial_question();
#endif
M gtkgreet/proto.c => gtkgreet/proto.c +3 -1
@@ 10,6 10,8 @@
#include <stdio.h>
#include <errno.h>
+#include <glib/gi18n.h>
+
#include "proto.h"
#include "window.h"
@@ 179,7 181,7 @@ struct response roundtrip(struct request req) {
struct json_object* json_resp = roundtrip_json(json_req);
if (json_resp == NULL) {
- snprintf(resp.body.response_error.description, 128, "proto: roundtrip failed");
+ snprintf(resp.body.response_error.description, 128, _("proto: roundtrip failed"));
goto done;
}
M gtkgreet/window.c => gtkgreet/window.c +5 -3
@@ 3,6 3,8 @@
#include <time.h>
#include <assert.h>
+#include <glib/gi18n.h>
+
#include <gtk/gtk.h>
#include "proto.h"
@@ 117,7 119,7 @@ void window_setup_question(struct Window *ctx, enum QuestionType type, char* que
gtk_combo_box_set_active((GtkComboBox*)ctx->command_selector, 0);
GtkWidget *selector_entry = gtk_bin_get_child((GtkBin*)ctx->command_selector);
- gtk_entry_set_placeholder_text((GtkEntry*)selector_entry, "Command to run on login");
+ gtk_entry_set_placeholder_text((GtkEntry*)selector_entry, _("Command to run on login"));
g_signal_connect(selector_entry, "activate", G_CALLBACK(action_answer_question), ctx);
gtk_container_add(GTK_CONTAINER(ctx->input_box), ctx->command_selector);
@@ 143,7 145,7 @@ void window_setup_question(struct Window *ctx, enum QuestionType type, char* que
case QuestionTypeSecret:
case QuestionTypeInfo:
case QuestionTypeError: {
- GtkWidget *cancel_button = gtk_button_new_with_label("Cancel");
+ GtkWidget *cancel_button = gtk_button_new_with_label(_("Cancel"));
gtk_widget_set_halign(cancel_button, GTK_ALIGN_END);
gtk_container_add(GTK_CONTAINER(button_box), cancel_button);
g_signal_connect(cancel_button, "clicked", G_CALLBACK(action_cancel_question), ctx);
@@ 153,7 155,7 @@ void window_setup_question(struct Window *ctx, enum QuestionType type, char* que
break;
}
- GtkWidget *continue_button = gtk_button_new_with_label("Log in");
+ GtkWidget *continue_button = gtk_button_new_with_label(_("Log in"));
g_signal_connect(continue_button, "clicked", G_CALLBACK(action_answer_question), ctx);
GtkStyleContext *continue_button_style = gtk_widget_get_style_context(continue_button);
gtk_style_context_add_class(continue_button_style, "suggested-action");
M meson.build => meson.build +1 -0
@@ 14,6 14,7 @@ project(
add_project_arguments('-Wno-unused-parameter', language: 'c')
add_project_arguments('-Wno-missing-braces', language: 'c')
+subdir('po')
subdir('gtkgreet')
scdoc = dependency('scdoc', required: get_option('man-pages'), version: '>= 1.9.7')
A po/LINGUAS => po/LINGUAS +1 -0
A po/POTFILES.in => po/POTFILES.in +4 -0
@@ 0,0 1,4 @@
+gtkgreet/actions.c
+gtkgreet/gtkgreet.c
+gtkgreet/proto.c
+gtkgreet/window.c
A po/es.po => po/es.po +48 -0
@@ 0,0 1,48 @@
+# Spanish translations for gtkgreet package.
+# Copyright (C) 2021 THE gtkgreet'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the gtkgreet package.
+# Automatically generated, 2021.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: gtkgreet\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-12-14 14:12-0300\n"
+"PO-Revision-Date: 2021-12-14 14:12-0300\n"
+"Last-Translator: Javier Steinaker <jsteinaker@gmail.com>\n"
+"Language-Team: none\n"
+"Language: es\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: gtkgreet/actions.c:35
+msgid "Unexpected auth question"
+msgstr "Pregunta de autenticación inesperada"
+
+#: gtkgreet/actions.c:56
+msgid "Login failed"
+msgstr "Inicio de sesión fallido"
+
+#: gtkgreet/gtkgreet.c:129
+msgid "Username:"
+msgstr "Nombre de usuario"
+
+#: gtkgreet/proto.c:184
+#, c-format
+msgid "proto: roundtrip failed"
+msgstr "Error de protocolo"
+
+#: gtkgreet/window.c:122
+msgid "Command to run on login"
+msgstr "Comando a ejecutar al iniciar sesión"
+
+#: gtkgreet/window.c:148
+msgid "Cancel"
+msgstr "Cancelar"
+
+#: gtkgreet/window.c:158
+msgid "Log in"
+msgstr "Iniciar sesión"
A po/gtkgreet.pot => po/gtkgreet.pot +47 -0
@@ 0,0 1,47 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the gtkgreet package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: gtkgreet\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-12-14 14:12-0300\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: gtkgreet/actions.c:35
+msgid "Unexpected auth question"
+msgstr ""
+
+#: gtkgreet/actions.c:56
+msgid "Login failed"
+msgstr ""
+
+#: gtkgreet/gtkgreet.c:129
+msgid "Username:"
+msgstr ""
+
+#: gtkgreet/proto.c:184
+#, c-format
+msgid "proto: roundtrip failed"
+msgstr ""
+
+#: gtkgreet/window.c:122
+msgid "Command to run on login"
+msgstr ""
+
+#: gtkgreet/window.c:148
+msgid "Cancel"
+msgstr ""
+
+#: gtkgreet/window.c:158
+msgid "Log in"
+msgstr ""
A po/meson.build => po/meson.build +7 -0
@@ 0,0 1,7 @@
+i18n = import('i18n')
+# define GETTEXT_PACKAGE
+add_project_arguments('-DGETTEXT_PACKAGE="gtkgreet"', '-DLOCALEDIR="/usr/local/share/locale"', language:'c')
+i18n.gettext(meson.project_name(),
+ args: '--directory=' + meson.source_root(),
+ preset: 'glib'
+)