~kennylevinsen/greetd-devel

gtkgreet: fix: get translations to work v1 APPLIED

~lord: 1
 fix: get translations to work

 4 files changed, 13 insertions(+), 1 deletions(-)
#987253 .build.yml success
Yes, both translations worked for me! Just used LANG=ru_RU.UTF-8 and
LANG=es_ES.UTF-8. fuzzy-thing got here after opening poedit probably.
Works with and without.
Sorry, new to mailing lists, I replied to the wrong topic I guess...

Yes, both translations worked for me! Just used LANG=ru_RU.UTF-8 and
LANG=es_ES.UTF-8. fuzzy-thing got here after opening poedit probably.
Works with and without.

В Ср, 10/05/2023 в 14:30 +0200, Kenny Levinsen пишет:
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~kennylevinsen/greetd-devel/patches/40991/mbox | git am -3
Learn more about email & git

[PATCH gtkgreet] fix: get translations to work Export this patch

From: Savely Krasovsky <savely@krasovs.ky>

Current state of project does not work with translations, AFAIK textdomain is necessary for app to read .mo files from localedir. I'm not very good with C and Meson, so it's based on GTK docs (https://docs.gtk.org/glib/i18n.html).
Signed-off-by: Savely Krasovsky <savely@krasovs.ky>
---
 gtkgreet/main.c | 8 ++++++++
 meson.build     | 3 +++
 po/meson.build  | 2 +-
 po/ru.po        | 1 +
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/gtkgreet/main.c b/gtkgreet/main.c
index 0eb0a72..da3664e 100644
--- a/gtkgreet/main.c
+++ b/gtkgreet/main.c
@@ -6,6 +6,9 @@
#include "window.h"
#include "gtkgreet.h"

#include <glib/gi18n.h>
#include <locale.h>

struct GtkGreet *gtkgreet = NULL;

static char* command = NULL;
@@ -119,6 +122,11 @@ static void attach_custom_style(const char* path) {
}

int main (int argc, char **argv) {
    setlocale(LC_ALL, "");
    bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
    textdomain(GETTEXT_PACKAGE);

    GError *error = NULL;
    GOptionContext *option_context = g_option_context_new("- GTK-based greeter for greetd");
    g_option_context_add_main_entries(option_context, entries, NULL);
diff --git a/meson.build b/meson.build
index 6feb26b..0c7dbd8 100644
--- a/meson.build
+++ b/meson.build
@@ -14,6 +14,9 @@ project(
add_project_arguments('-Wno-unused-parameter', language: 'c')
add_project_arguments('-Wno-missing-braces', language: 'c')

prefix = get_option('prefix')
localedir = join_paths(prefix, get_option('localedir'))

subdir('po')
subdir('gtkgreet')

diff --git a/po/meson.build b/po/meson.build
index 407bd69..60d654d 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1,6 +1,6 @@
i18n = import('i18n')
# define GETTEXT_PACKAGE
add_project_arguments('-DGETTEXT_PACKAGE="gtkgreet"', '-DLOCALEDIR="/usr/local/share/locale"', language:'c')
add_project_arguments('-DGETTEXT_PACKAGE="'+meson.project_name()+'"', '-DLOCALEDIR="'+localedir+'"', language:'c')
i18n.gettext(meson.project_name(),
    args: '--directory=' + meson.source_root(),
    preset: 'glib'
diff --git a/po/ru.po b/po/ru.po
index dce7346..0ddc7a0 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -3,6 +3,7 @@
# This file is distributed under the same license as the gtkgreet package.
# Savely Krasovsky <savely@krasovs.ky>, 2023.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: gtkgreet\n"
-- 
2.38.4
Applied, thanks!
gtkgreet/patches/.build.yml: SUCCESS in 36s

[fix: get translations to work][0] from [~lord][1]

[0]: https://lists.sr.ht/~kennylevinsen/greetd-devel/patches/40991
[1]: mailto:savely@krasovs.ky

✓ #987253 SUCCESS gtkgreet/patches/.build.yml https://builds.sr.ht/~kennylevinsen/job/987253