From 571b83fd6df48193c05f84d214bdd3196188ffd6 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sat, 10 Aug 2024 08:37:52 +0300 Subject: [PATCH] init gettext/i18n localization support --- .gitignore | 8 +++++++- README.md | 16 ++++++++++++++-- po/.gitignore | 1 + po/POTFILES.in | 4 ++++ src/app/browser.h | 10 ++++++---- src/main.cpp | 2 ++ 6 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 po/.gitignore create mode 100644 po/POTFILES.in diff --git a/.gitignore b/.gitignore index 1530978..dc0179e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ -*.o \ No newline at end of file +*.o +*.cache +*.log +*.status +configure +configure~ +Makefile \ No newline at end of file diff --git a/README.md b/README.md index 29d34fe..ebd6a92 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ GTK 4 / C++ implementation branch ### Linux -* `sudo apt install git libgtkmm-4.0-dev` +* `sudo apt install git libgtkmm-4.0-dev libglibmm-2.68-dev` * `git clone https://github.com/YGGverse/Yoda.git` * `cd Yoda` * `git checkout master` @@ -22,11 +22,23 @@ GTK 4 / C++ implementation branch * `make clean` * `make` +## Localization + +### Official + + * [Crowdin](https://crowdin.com/project/yoda-browser) + +### Personal + +* `sudo apt install intltool` +* `cd po` +* `intltool-update --pot` + ## Development ### Environment -* `pkg-config --cflags --libs gtkmm-4.0` +* `pkg-config --cflags --libs gtkmm-4.0 glibmm-2.68` ### Contribution diff --git a/po/.gitignore b/po/.gitignore new file mode 100644 index 0000000..fc35de9 --- /dev/null +++ b/po/.gitignore @@ -0,0 +1 @@ +*.pot \ No newline at end of file diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..3fbea41 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,4 @@ +src/app/browser.cpp +src/app/browser.h +src/main.cpp +src/main.h \ No newline at end of file diff --git a/src/app/browser.h b/src/app/browser.h index 47c6c94..a73109d 100644 --- a/src/app/browser.h +++ b/src/app/browser.h @@ -1,6 +1,8 @@ #ifndef APP_BROWSER_H #define APP_BROWSER_H +#include + #include #include #include @@ -12,7 +14,7 @@ namespace app { public: - const Glib::ustring TITLE = "Yoda"; + const char* TITLE = _("Yoda"); const int WIDTH = 640; const int HEIGHT = 480; @@ -30,7 +32,7 @@ namespace app { public: - const Glib::ustring TOOLTIP = "Menu"; + const char* TOOLTIP = _("Menu"); Menu(); }; @@ -39,8 +41,8 @@ namespace app { public: - const Glib::ustring ICON = "tab-new-symbolic"; - const Glib::ustring TOOLTIP = "New tab"; + const char* ICON = "tab-new-symbolic"; + const char* TOOLTIP = _("New tab"); Tab(); }; diff --git a/src/main.cpp b/src/main.cpp index 379df40..0650b75 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,10 +4,12 @@ int main( int argc, char* argv[] ) { + // Init app auto app = Gtk::Application::create( APPLICATION_ID ); + // Launch browser component return app->make_window_and_run( argc, argv