Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
include translations
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed Jan 30, 2017
1 parent 37e88be commit 2cf0420
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 17 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log
Expand Down
36 changes: 20 additions & 16 deletions icon-requests.in
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from gi import require_version
require_version("Gtk", "3.0")
from gi.repository import Gtk
import sys
sys.path.insert(1, '@pyexecdir@')
sys.path.insert(1, '@pythondir@')
from gi.repository import Gio
import logging
import signal
import locale
import gettext
_ = gettext.gettext
import argparse
import faulthandler
from os import path, environ as env
import sys
from os import path
from gi import require_version
require_version("Gtk", "3.0")
from gi.repository import Gtk, Gio

sys.path.insert(1, '@pyexecdir@')
sys.path.insert(1, '@pythondir@')

from IconRequests.application import Application

if __name__ == "__main__":
_ = gettext.gettext

locale.bindtextdomain('icon-requests', "@localedir@")
locale.textdomain('icon-requests')
gettext.bindtextdomain('icon-requests', "@localedir@")
gettext.textdomain('icon-requests')

env["DATA_DIR"] = "@pkgdatadir@"
env["LOCALE_DIR"] = "@localedir@"

parser = argparse.ArgumentParser(prog="Icon Requests")
parser.add_argument("--debug", "-d", action="store_true",
help=_("start in debug mode"))
help=_("Start in debug mode"))
parser.add_argument("--version", "-v", action="store_true",
help=_("Icon Requests version number"))
parser.add_argument("--about", action="store_true",
Expand All @@ -55,5 +54,10 @@ if __name__ == "__main__":
sys.exit()
else:
app = Application()
exit_status = app.run(None)
sys.exit(exit_status)
try:
exit_status = app.run(None)
signal.signal(signal.SIGTERM, app.on_quit)
signal.signal(signal.SIGINT, app.on_quit)
sys.exit(exit_status)
except KeyboardInterrupt:
app.on_quit()
69 changes: 69 additions & 0 deletions po/icon-requests.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# SOME DESCRIPTIVE TITLE.
# This file is put in the public domain.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: icon-requests\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-30 23:31+0100\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"

#: IconRequests/application.py:21 data/icon-requests.desktop.in:3
msgid "Icon Requests"
msgstr ""

#: IconRequests/application.py:49
msgid "Night Mode"
msgstr ""

#: IconRequests/application.py:50
msgid "About"
msgstr ""

#: IconRequests/application.py:51
msgid "Quit"
msgstr ""

#: IconRequests/widgets/application_row.py:68
msgid "Report"
msgstr ""

#: IconRequests/widgets/application_row.py:81
msgid "Fix"
msgstr ""

#: IconRequests/widgets/application_row.py:125
msgid "Please check your connexion"
msgstr ""

#: IconRequests/widgets/application_row.py:147
msgid "Theme not supported"
msgstr ""

#: data/icon-requests.desktop.in:4
msgid "Missing Icon Requests"
msgstr ""

#: data/icon-requests.desktop.in:5
msgid "Report Missing icons to your current theme"
msgstr ""

#: data/icon-requests.desktop.in:10
msgid "Gnome;GTK;Verification;"
msgstr ""

#: data/icon-requests.desktop.in:11
msgid "icon-requests"
msgstr ""

#: data/icon-requests.desktop.in:20
msgid "About Icon Requests"
msgstr ""
54 changes: 54 additions & 0 deletions update_pot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/sh
# A modified code from the Terminix project<https://github.com/gnunn1/terminix/>.
DOMAIN=icon-requests
BASEDIR=$(dirname $0)
OUTPUT_FILE=${BASEDIR}/po/${DOMAIN}.pot

echo "Extracting translatable strings... "

find ${BASEDIR}/ -name '*.py' | xgettext \
--output $OUTPUT_FILE \
--files-from=- \
--directory=$BASEDIR \
--language=Python \
--keyword=C_:1c,2 \
--from-code=utf-8

find ${BASEDIR}/ -name '*.ui' | xgettext \
--output $OUTPUT_FILE \
--join-existing \
--files-from=- \
--directory=$BASEDIR \
--language=ui \
--foreign-user \
--keyword=C_:1c,2 \
--from-code=utf-8

xgettext \
--join-existing \
--output $OUTPUT_FILE \
--default-domain=$DOMAIN \
--package-name=$DOMAIN \
--directory=$BASEDIR \
--foreign-user \
--language=Desktop \
${BASEDIR}/data/icon-requests.desktop.in


xgettext \
--join-existing \
--output $OUTPUT_FILE \
--default-domain=$DOMAIN \
--package-name=$DOMAIN \
--directory=$BASEDIR \
--foreign-user \
--language=appdata \
${BASEDIR}/data/icon-requests.appdata.xml.in

# Merge the messages with existing po files
echo "Merging with existing translations... "
for file in ${BASEDIR}/po/*.po
do
echo -n $file
msgmerge --update $file $OUTPUT_FILE
done

0 comments on commit 2cf0420

Please sign in to comment.