mirror of
https://github.com/wizbright/waybox.git
synced 2025-10-29 05:40:20 -04:00
Prepared strings for translation
This commit is contained in:
parent
d8bb6cc1c2
commit
09db837fcd
3 changed files with 24 additions and 12 deletions
|
|
@ -20,6 +20,10 @@
|
||||||
#include <wlr/types/wlr_output_layout.h>
|
#include <wlr/types/wlr_output_layout.h>
|
||||||
#include <wlr/types/wlr_xdg_shell.h>
|
#include <wlr/types/wlr_xdg_shell.h>
|
||||||
|
|
||||||
|
#include <libintl.h>
|
||||||
|
#include <locale.h>
|
||||||
|
#define _ gettext
|
||||||
|
|
||||||
#include "waybox/output.h"
|
#include "waybox/output.h"
|
||||||
#include "waybox/cursor.h"
|
#include "waybox/cursor.h"
|
||||||
#include "waybox/seat.h"
|
#include "waybox/seat.h"
|
||||||
|
|
|
||||||
|
|
@ -6,19 +6,28 @@
|
||||||
#include "waybox/server.h"
|
#include "waybox/server.h"
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
textdomain(GETTEXT_PACKAGE);
|
||||||
|
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
|
||||||
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
char *startup_cmd = NULL;
|
char *startup_cmd = NULL;
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
if (!strcmp("--debug", argv[i]) || !strcmp("-v", argv[i]) || !strcmp("--exit", argv[i])) {
|
if (!strcmp("--debug", argv[i]) || !strcmp("-v", argv[i]) ||
|
||||||
printf("Warning: option %s is currently unimplemented\n", argv[i]);
|
!strcmp("--exit", argv[i])) {
|
||||||
} else if ((!strcmp("--startup", argv[i]) || !strcmp("-s", argv[i])) && i < argc) {
|
fprintf(stderr, _("Warning: option %s is currently unimplemented\n"), argv[i]);
|
||||||
startup_cmd = argv[i + 1];
|
} else if ((!strcmp("--startup", argv[i]) || !strcmp("-s", argv[i]))) {
|
||||||
|
if (i < argc - 1) {
|
||||||
|
startup_cmd = argv[i + 1];
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, _("%s requires an argument\n"), argv[i]);
|
||||||
|
}
|
||||||
} else if (!strcmp("--version", argv[i]) || !strcmp("-V", argv[i])) {
|
} else if (!strcmp("--version", argv[i]) || !strcmp("-V", argv[i])) {
|
||||||
printf(PACKAGE_NAME " " PACKAGE_VERSION "\n");
|
printf(PACKAGE_NAME " " PACKAGE_VERSION "\n");
|
||||||
return 0;
|
return 0;
|
||||||
} else if (argv[i][0] == '-') {
|
} else if (argv[i][0] == '-') {
|
||||||
printf("Usage: %s [--debug] [--exit] [--help] [--startup CMD] [--version]\n", argv[0]);
|
printf(_("Usage: %s [--debug] [--exit] [--help] [--startup CMD] [--version]\n"), argv[0]);
|
||||||
return strcmp("--help", argv[i]) != 0 && strcmp("-h", argv[i]) != 0;
|
return strcmp("--help", argv[i]) != 0 && strcmp("-h", argv[i]) != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -27,12 +36,12 @@ int main(int argc, char **argv) {
|
||||||
struct wb_server server = {0};
|
struct wb_server server = {0};
|
||||||
|
|
||||||
if (!wb_create_backend(&server)) {
|
if (!wb_create_backend(&server)) {
|
||||||
printf("Failed to create backend\n");
|
fprintf(stderr, _("Failed to create backend\n"));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wb_start_server(&server)) {
|
if (!wb_start_server(&server)) {
|
||||||
printf("Failed to start server\n");
|
fprintf(stderr, _("Failed to start server\n"));
|
||||||
wb_terminate(&server);
|
wb_terminate(&server);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,13 @@ bool wb_create_backend(struct wb_server* server) {
|
||||||
// create display
|
// create display
|
||||||
server->wl_display = wl_display_create();
|
server->wl_display = wl_display_create();
|
||||||
if (server->wl_display == NULL) {
|
if (server->wl_display == NULL) {
|
||||||
fprintf(stderr, "Failed to connect to a Wayland display\n");
|
fprintf(stderr, _("Failed to connect to a Wayland display\n"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create backend
|
// create backend
|
||||||
server->backend = wlr_backend_autocreate(server->wl_display, NULL);
|
server->backend = wlr_backend_autocreate(server->wl_display, NULL);
|
||||||
if (server->backend == NULL) {
|
if (server->backend == NULL) {
|
||||||
printf("Failed to create backend\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -41,13 +40,13 @@ bool wb_start_server(struct wb_server* server) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wlr_backend_start(server->backend)) {
|
if (!wlr_backend_start(server->backend)) {
|
||||||
fprintf(stderr, "Failed to start backend\n");
|
fprintf(stderr, _("Failed to start backend\n"));
|
||||||
wlr_backend_destroy(server->backend);
|
wlr_backend_destroy(server->backend);
|
||||||
wl_display_destroy(server->wl_display);
|
wl_display_destroy(server->wl_display);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Running Wayland compositor on Wayland display '%s'\n", socket);
|
printf(_("Running Wayland compositor on Wayland display '%s'\n"), socket);
|
||||||
setenv("WAYLAND_DISPLAY", socket, true);
|
setenv("WAYLAND_DISPLAY", socket, true);
|
||||||
|
|
||||||
wlr_gamma_control_manager_v1_create(server->wl_display);
|
wlr_gamma_control_manager_v1_create(server->wl_display);
|
||||||
|
|
@ -69,7 +68,7 @@ bool wb_terminate(struct wb_server* server) {
|
||||||
wlr_output_layout_destroy(server->layout);
|
wlr_output_layout_destroy(server->layout);
|
||||||
wl_display_destroy(server->wl_display);
|
wl_display_destroy(server->wl_display);
|
||||||
|
|
||||||
printf("Display destroyed.\n");
|
printf(_("Display destroyed.\n"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue