diff --git a/internal/i18n/i18n.go b/internal/i18n/i18n.go new file mode 100644 index 0000000..40183e1 --- /dev/null +++ b/internal/i18n/i18n.go @@ -0,0 +1,38 @@ +package i18n + +/* +#include +#include +#include + +static void init_i18n(const char* domain, const char* localedir) { + setlocale(LC_ALL, ""); + bindtextdomain(domain, localedir); + bind_textdomain_codeset(domain, "UTF-8"); + textdomain(domain); +} +*/ +import "C" + +import ( + "log" + "unsafe" +) + +func Init(domain, localeDir string) { + cDomain := C.CString(domain) + defer C.free(unsafe.Pointer(cDomain)) + + cDir := C.CString(localeDir) + defer C.free(unsafe.Pointer(cDir)) + + log.Println("initialize localization for domain", domain, "with directory", localeDir) + C.init_i18n(cDomain, cDir) +} + +func T(msgid string) string { + c := C.CString(msgid) + defer C.free(unsafe.Pointer(c)) + + return C.GoString(C.gettext(c)) +} diff --git a/locale/de/LC_MESSAGES/mcg.mo b/locale/de/LC_MESSAGES/mcg.mo new file mode 100644 index 0000000..79cb779 Binary files /dev/null and b/locale/de/LC_MESSAGES/mcg.mo differ diff --git a/locale/de/LC_MESSAGES/mcg.po b/locale/de/LC_MESSAGES/mcg.po new file mode 100644 index 0000000..8819521 --- /dev/null +++ b/locale/de/LC_MESSAGES/mcg.po @@ -0,0 +1,333 @@ +msgid "" +msgstr "" +"Project-Id-Version: CoverGrid (mcg)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-08-09 19:13+0200\n" +"PO-Revision-Date: 2026-08-14 09:34+0200\n" +"Last-Translator: coderkun \n" +"Language-Team: \n" +"Language: de_DE\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" +"X-Generator: Poedit 3.9\n" +"X-Poedit-Basepath: ../../..\n" +"X-Poedit-SourceCharset: UTF-8\n" + +#: internal/common/album.go:93 internal/gui/coverpanel.go:290 +#, go-format +msgid "%d:%d minutes" +msgstr "%d:%d Minuten" + +#: internal/gui/application.go:108 +msgid "" +"CoverGrid is a client for the Music Player Daemon, focusing on albums " +"instead of single tracks." +msgstr "" +"CoverGrid ist ein ein Client für den Music Player Daemon, der sich auf Alben " +"anstellen von einzelnen Songs fokussiert." + +#: internal/gui/coverpanel.go:277 +#, go-format +msgid "%s feat. %s" +msgstr "%s mit %s" + +#: internal/gui/window.go:117 +msgid "Server" +msgstr "Server" + +#: internal/gui/window.go:118 +msgid "Cover" +msgstr "Cover" + +#: internal/gui/window.go:119 +msgid "Playlist" +msgstr "Wiedergabeliste" + +#: internal/gui/window.go:120 +msgid "Library" +msgstr "Bibliothek" + +#: data/ui/connection-panel.ui:26 +msgid "Host" +msgstr "Host" + +#: data/ui/connection-panel.ui:38 +msgid "Port" +msgstr "Port" + +#: data/ui/connection-panel.ui:57 +msgid "Password" +msgstr "Passwort" + +#: data/ui/cover-panel.ui:12 data/ui/shortcuts-dialog.ui:88 +msgid "Show the cover in fullscreen mode" +msgstr "Das Cover im Vollbildmodus anzeigen" + +#: data/ui/library-panel.ui:33 +msgid "update library" +msgstr "Die Bibliothek aktualisieren" + +#: data/ui/library-panel.ui:46 +msgid "Sort" +msgstr "Sortierung" + +#: data/ui/library-panel.ui:51 +msgid "sort by artist" +msgstr "nach Künstler" + +#: data/ui/library-panel.ui:58 +msgid "sort by title" +msgstr "nach Titel" + +#: data/ui/library-panel.ui:65 +msgid "sort by year" +msgstr "nach Jahr" + +#: data/ui/library-panel.ui:71 +msgid "sort by modification" +msgstr "nach Änderungsdatum" + +#: data/ui/library-panel.ui:78 +msgid "sort library descending" +msgstr "absteigend sortieren" + +#: data/ui/library-panel.ui:98 data/ui/shortcuts-dialog.ui:99 +msgid "Search the library" +msgstr "Die Bibliothek durchsuchen" + +#: data/ui/library-panel.ui:111 data/ui/playlist-panel.ui:14 +msgid "Select multiple albums" +msgstr "Mehrere Alben auswählen" + +#: data/ui/library-panel.ui:124 +msgid "Settings and actions" +msgstr "Einstellungen und Aktionen" + +#: data/ui/library-panel.ui:149 +msgid "search library" +msgstr "Bibliothek durchsuchen" + +#: data/ui/library-panel.ui:216 data/ui/playlist-panel.ui:69 +msgid "cancel" +msgstr "abbrechen" + +#: data/ui/library-panel.ui:222 data/ui/library-panel.ui:277 +msgid "queue" +msgstr "einreihen" + +#: data/ui/library-panel.ui:271 data/ui/playlist-panel.ui:123 +msgid "play" +msgstr "abspielen" + +#: data/ui/playlist-panel.ui:27 data/ui/shortcuts-dialog.ui:77 +msgid "Clear the playlist" +msgstr "Die Wiedergabeliste leeren" + +#: data/ui/playlist-panel.ui:75 data/ui/playlist-panel.ui:129 +msgid "remove" +msgstr "entfernen" + +#: data/ui/server-panel.ui:35 +msgid "Status" +msgstr "Status" + +#: data/ui/server-panel.ui:49 +msgid "File:" +msgstr "Datei:" + +#: data/ui/server-panel.ui:60 +msgid "Audio:" +msgstr "Audio:" + +#: data/ui/server-panel.ui:71 +msgid "Bitrate:" +msgstr "Bitrate:" + +#: data/ui/server-panel.ui:82 +msgid "Error:" +msgstr "Fehler:" + +#: data/ui/server-panel.ui:92 data/ui/server-panel.ui:106 +#: data/ui/server-panel.ui:120 data/ui/server-panel.ui:134 +msgid "none" +msgstr "nichts" + +#: data/ui/server-panel.ui:154 +msgid "Statistics" +msgstr "Statistiken" + +#: data/ui/server-panel.ui:178 +msgid "Artists" +msgstr "Künstler" + +#: data/ui/server-panel.ui:198 +msgid "Albums" +msgstr "Alben" + +#: data/ui/server-panel.ui:218 +msgid "Songs" +msgstr "Songs" + +#: data/ui/server-panel.ui:238 +msgid "Seconds" +msgstr "Sekunden" + +#: data/ui/server-panel.ui:267 +msgid "Seconds played" +msgstr "Sekunden gespielt" + +#: data/ui/server-panel.ui:287 +msgid "Seconds running" +msgstr "Sekunden laufend" + +#: data/ui/server-panel.ui:303 +msgid "Audio Devices" +msgstr "Audiogeräte" + +#: data/ui/shortcuts-dialog.ui:14 +msgid "General" +msgstr "Allgemein" + +#: data/ui/shortcuts-dialog.ui:18 +msgid "Switch to the Connection panel" +msgstr "Zum Verbindungspaneel wechseln" + +#: data/ui/shortcuts-dialog.ui:24 +msgid "Switch to the Cover panel" +msgstr "Zum Cover-Paneel wechseln" + +#: data/ui/shortcuts-dialog.ui:30 +msgid "Switch to the Playlist panel" +msgstr "Zum Wiedergabelistenpaneel wechseln" + +#: data/ui/shortcuts-dialog.ui:36 +msgid "Switch to the Library panel" +msgstr "Zum Bibliothekspaneel wechseln" + +#: data/ui/shortcuts-dialog.ui:42 +msgid "Show the keyboard shortcuts" +msgstr "Die Tastenkombinationen anzeigen (dieser Dialog)" + +#: data/ui/shortcuts-dialog.ui:48 +msgid "Open the info dialog" +msgstr "Den Infodialog öffnen" + +#: data/ui/shortcuts-dialog.ui:54 +msgid "Quit the application" +msgstr "Die Anwendung beenden" + +#: data/ui/shortcuts-dialog.ui:61 +msgid "Player" +msgstr "Wiedergabeprogramm" + +#: data/ui/shortcuts-dialog.ui:65 +msgid "Connect or disconnect" +msgstr "Die Verbindung herstellen oder trennen" + +#: data/ui/shortcuts-dialog.ui:71 data/ui/window.ui:26 +msgid "Switch between play and pause" +msgstr "Zwischen Abspielen und Pause wechseln" + +#: data/ui/shortcuts-dialog.ui:84 +msgid "Cover Panel" +msgstr "Cover-Paneel" + +#: data/ui/shortcuts-dialog.ui:95 +msgid "Library Panel" +msgstr "Bibliothekspaneel" + +#~ msgid "No service found" +#~ msgstr "Keine Dienste gefunden" + +#~ msgid "use" +#~ msgstr "verwenden" + +#~ msgid "Loading albums" +#~ msgstr "Alben werden geladen" + +#~ msgid "Loading images" +#~ msgstr "Bilder werden geladen" + +#, fuzzy +#~ msgid "Connection state" +#~ msgstr "Verbindung" + +#~ msgid "Title" +#~ msgstr "Titel" + +#~ msgid "Artist" +#~ msgstr "Künstler" + +#~ msgid "Enter hostname or IP address" +#~ msgstr "Hostnamen oder IP-Adresse eingeben" + +#~ msgid "Enter password or leave blank" +#~ msgstr "Passwort eingeben oder leer lassen" + +#~ msgid "Connect" +#~ msgstr "Verbinden" + +#~ msgid "Play" +#~ msgstr "Abspielen" + +#~ msgid "Clear Playlist" +#~ msgstr "Playlist leeren" + +#~ msgid "Toggle Fullscreen" +#~ msgstr "Vollbild wechseln" + +#~ msgid "Search Library" +#~ msgstr "Bibliothek durchsuchen" + +#~ msgid "Connection" +#~ msgstr "Verbindung" + +#~ msgid "Keyboard Shortcuts" +#~ msgstr "Tastenkombinationen" + +#~ msgid "Info" +#~ msgstr "Info" + +#~ msgid "Quit" +#~ msgstr "Beenden" + +#~ msgid "Connect to MPD" +#~ msgstr "Zu MPD verbinden" + +#~ msgid "Adjust the volume" +#~ msgstr "Die Lautstärke anpassen" + +#~ msgid "Enter URL or local path" +#~ msgstr "URL oder lokalen Pfad eingeben" + +#~ msgid "Image Directory:" +#~ msgstr "Bildordner:" + +#~ msgid "{} of {} images loaded" +#~ msgstr "{} von {} Bildern geladen" + +#~ msgid "Tracklist" +#~ msgstr "Titelliste" + +#~ msgid "large tracklist" +#~ msgstr "große Titelliste" + +#~ msgid "small tracklist" +#~ msgstr "kleine Titelliste" + +#~ msgid "hide tracklist" +#~ msgstr "gar keine Titelliste" + +#~ msgid "_Play" +#~ msgstr "_Abspielen" + +#~ msgid "_Keyboard Shortcuts" +#~ msgstr "Tastenkombinationen" + +#~ msgid "_Quit" +#~ msgstr "_Beenden" + +#~ msgid "Show the keyboard shortcuts (this dialog)" +#~ msgstr "Die Tastenkombinationen anzeigen (dieser Dialog)" diff --git a/main.go b/main.go index da29a2c..b5aa37f 100644 --- a/main.go +++ b/main.go @@ -1,4 +1,9 @@ package main +import ( + "suruatoel.xyz/mcg/internal/i18n" +) + func main() { + i18n.Init("mcg", "locale") } diff --git a/po/LINGUAS b/po/LINGUAS index 3ae2b72..7673daa 100644 --- a/po/LINGUAS +++ b/po/LINGUAS @@ -1 +1 @@ -en de +de diff --git a/po/mcg.pot b/po/mcg.pot index 451e0a8..f813837 100644 --- a/po/mcg.pot +++ b/po/mcg.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: mcg\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-22 14:39+0200\n" +"POT-Creation-Date: 2026-08-09 19:13+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,19 +17,47 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: data/ui/connection-panel.ui:29 -msgid "No service found" +#: internal/common/album.go:93 internal/gui/coverpanel.go:290 +#, go-format +msgid "%d:%d minutes" msgstr "" -#: data/ui/connection-panel.ui:43 +#: internal/gui/application.go:108 +msgid "" +"CoverGrid is a client for the Music Player Daemon, focusing on albums " +"instead of single tracks." +msgstr "" + +#: internal/gui/coverpanel.go:277 +#, go-format +msgid "%s feat. %s" +msgstr "" + +#: internal/gui/window.go:117 +msgid "Server" +msgstr "" + +#: internal/gui/window.go:118 +msgid "Cover" +msgstr "" + +#: internal/gui/window.go:119 +msgid "Playlist" +msgstr "" + +#: internal/gui/window.go:120 +msgid "Library" +msgstr "" + +#: data/ui/connection-panel.ui:26 msgid "Host" msgstr "" -#: data/ui/connection-panel.ui:56 +#: data/ui/connection-panel.ui:38 msgid "Port" msgstr "" -#: data/ui/connection-panel.ui:76 +#: data/ui/connection-panel.ui:57 msgid "Password" msgstr "" @@ -37,67 +65,67 @@ msgstr "" msgid "Show the cover in fullscreen mode" msgstr "" -#: data/ui/library-panel.ui:34 +#: data/ui/library-panel.ui:33 msgid "update library" msgstr "" -#: data/ui/library-panel.ui:48 +#: data/ui/library-panel.ui:46 msgid "Sort" msgstr "" -#: data/ui/library-panel.ui:53 +#: data/ui/library-panel.ui:51 msgid "sort by artist" msgstr "" -#: data/ui/library-panel.ui:61 +#: data/ui/library-panel.ui:58 msgid "sort by title" msgstr "" -#: data/ui/library-panel.ui:69 +#: data/ui/library-panel.ui:65 msgid "sort by year" msgstr "" -#: data/ui/library-panel.ui:76 +#: data/ui/library-panel.ui:71 msgid "sort by modification" msgstr "" -#: data/ui/library-panel.ui:84 +#: data/ui/library-panel.ui:78 msgid "sort library descending" msgstr "" -#: data/ui/library-panel.ui:105 data/ui/shortcuts-dialog.ui:99 +#: data/ui/library-panel.ui:98 data/ui/shortcuts-dialog.ui:99 msgid "Search the library" msgstr "" -#: data/ui/library-panel.ui:121 data/ui/playlist-panel.ui:14 +#: data/ui/library-panel.ui:111 data/ui/playlist-panel.ui:14 msgid "Select multiple albums" msgstr "" -#: data/ui/library-panel.ui:135 +#: data/ui/library-panel.ui:124 msgid "Settings and actions" msgstr "" -#: data/ui/library-panel.ui:160 +#: data/ui/library-panel.ui:149 msgid "search library" msgstr "" -#: data/ui/library-panel.ui:263 data/ui/playlist-panel.ui:107 +#: data/ui/library-panel.ui:216 data/ui/playlist-panel.ui:69 msgid "cancel" msgstr "" -#: data/ui/library-panel.ui:270 data/ui/library-panel.ui:327 +#: data/ui/library-panel.ui:222 data/ui/library-panel.ui:277 msgid "queue" msgstr "" -#: data/ui/library-panel.ui:320 data/ui/playlist-panel.ui:163 +#: data/ui/library-panel.ui:271 data/ui/playlist-panel.ui:123 msgid "play" msgstr "" -#: data/ui/playlist-panel.ui:28 data/ui/shortcuts-dialog.ui:77 +#: data/ui/playlist-panel.ui:27 data/ui/shortcuts-dialog.ui:77 msgid "Clear the playlist" msgstr "" -#: data/ui/playlist-panel.ui:114 data/ui/playlist-panel.ui:170 +#: data/ui/playlist-panel.ui:75 data/ui/playlist-panel.ui:129 msgid "remove" msgstr "" @@ -198,7 +226,7 @@ msgstr "" msgid "Connect or disconnect" msgstr "" -#: data/ui/shortcuts-dialog.ui:71 data/ui/window.ui:25 +#: data/ui/shortcuts-dialog.ui:71 data/ui/window.ui:26 msgid "Switch between play and pause" msgstr "" @@ -209,39 +237,3 @@ msgstr "" #: data/ui/shortcuts-dialog.ui:95 msgid "Library Panel" msgstr "" - -#: src/connectionpanel.py:51 -msgid "use" -msgstr "" - -#: src/librarypanel.py:291 -msgid "Loading albums" -msgstr "" - -#: src/librarypanel.py:379 -msgid "Loading images" -msgstr "" - -#: src/utils.py:50 src/utils.py:67 -msgid "{} feat. {}" -msgstr "" - -#: src/utils.py:61 -msgid "{}:{} minutes" -msgstr "" - -#: src/window.py:114 -msgid "Server" -msgstr "" - -#: src/window.py:115 -msgid "Cover" -msgstr "" - -#: src/window.py:116 -msgid "Playlist" -msgstr "" - -#: src/window.py:117 -msgid "Library" -msgstr ""