Commit 91d1d329 authored by Falk Alexander Seidl's avatar Falk Alexander Seidl

Add basic internationalization

*Add POTFILES.in
*Add gettext import
*Add languages list
parent 9f6f9a36
Pipeline #26032 canceled with stage
......@@ -36,6 +36,7 @@
],
"build-options" : {
"env" : {
"LANG" : "de"
}
}
}
......@@ -37,6 +37,7 @@ conf.set('libexecdir', LIBEXEC_DIR)
conf.set('VERSION', meson.project_version())
subdir('data')
subdir('po')
install_subdir(
'passwordsafe',
......
......@@ -3,6 +3,7 @@
import sys
import os
import locale
import gettext
sys.path.insert(1, '@PYTHON_EXEC_DIR@')
sys.path.insert(1, '@PYTHON_DIR@')
......@@ -30,6 +31,11 @@ def install_excepthook():
if __name__ == "__main__":
install_excepthook()
locale.bindtextdomain('passwordsafe', localedir)
locale.textdomain('passwordsafe')
gettext.bindtextdomain('passwordsafe', localedir)
gettext.textdomain('passwordsafe')
resource = Gio.resource_load(os.path.join(pkgdatadir, 'passwordsafe.gresource'))
Gio.Resource._register(resource)
......
......@@ -4,6 +4,7 @@ gi.require_version('Gtk', '3.0')
gi.require_version('Notify', '0.7')
from gi.repository import GLib, Gio, Gtk
from gi.repository import Notify
from gettext import gettext as _
from passwordsafe.main_window import MainWindow
from passwordsafe.settings_dialog import SettingsDialog
......@@ -39,11 +40,11 @@ class Application(Gtk.Application):
def assemble_application_menu(self):
app_menu = Gio.Menu()
app_menu.append("Settings", "app.settings")
app_menu.append("Shortcuts", "app.shortcuts")
app_menu.append(_("Settings"), "app.settings")
app_menu.append(_("Shortcuts"), "app.shortcuts")
app_menu.append("About", "app.about")
app_menu.append("Quit", "app.quit")
app_menu.append(_("About"), "app.about")
app_menu.append(_("Quit"), "app.quit")
settings_action = Gio.SimpleAction.new("settings", None)
settings_action.connect("activate", self.on_settings_menu_clicked)
......
# keep this file sorted alphabetically, one language code per line
de
\ No newline at end of file
data/about_dialog.ui
data/create_database.ui
data/created_database.ui
data/database_settings_dialog.ui
data/entry_page.ui
data/group_page.ui
data/main_window.ui
data/override_dialog.ui
data/quit_dialog.ui
data/save_dialog.ui
data/settings_dialog.ui
data/shortcuts_overview.ui
data/unlock_database.ui
data/unlocked_database.ui
passwordsafe/application.py
\ No newline at end of file
# German translations for PACKAGE package.
# Copyright (C) 2018 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# Falk <fa@terminal.run>, 2018.
# Seidl <fa@terminal.run>, 2018.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-21 19:08+0200\n"
"PO-Revision-Date: 2018-08-21 19:14+0200\n"
"Last-Translator: Seidl <fa@terminal.run>\n"
"Language-Team: German <>\n"
"Language: 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: Gtranslator 2.91.7\n"
#: ../passwordsafe/application.py:44
msgid "Settings"
msgstr "Einstellungen"
#: ../passwordsafe/application.py:45
msgid "Shortcuts"
msgstr "Tastenkombinationen"
#: ../passwordsafe/application.py:47
msgid "About"
msgstr "Über"
#: ../passwordsafe/application.py:48
msgid "Quit"
msgstr "Beenden"
i18n = import('i18n')
message('Update translations')
i18n.gettext('passwordsafe', preset: 'glib')
\ No newline at end of file
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-21 19:08+0200\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"
#: ../passwordsafe/application.py:44
msgid "Settings"
msgstr ""
#: ../passwordsafe/application.py:45
msgid "Shortcuts"
msgstr ""
#: ../passwordsafe/application.py:47
msgid "About"
msgstr ""
#: ../passwordsafe/application.py:48
msgid "Quit"
msgstr ""
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment