Add Russian translation.
--- /dev/null
+
+import gettext
+import locale
+import os
+
+language = locale.getdefaultlocale()[0]
+mo_filename = os.path.join(
+ os.path.dirname(__file__), 'translations', language + '.mo')
+if os.path.exists(mo_filename):
+ mo_file = open(mo_filename, 'rb')
+ translation = gettext.GNUTranslations(mo_file)
+ mo_file.close()
+else:
+ translation = gettext.NullTranslations()
+translation.install(unicode=True)
--- /dev/null
+%.mo: %.po
+ msgfmt -o $@ -- $<
+
+po_files = $(shell echo *.po)
+mo_files = $(patsubst %.po,%.mo,$(po_files))
+
+.PHONY: all
+all: $(mo_files)
--- /dev/null
+# Russian translation
+# Copyright 2016 (C) PhiloSoft Design
+# Created by Oleg Broytman <phd@phdru.name>
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: 0.0.3\n"
+"POT-Creation-Date: 2016-03-29\n"
+"PO-Revision-Date: 2016-03-29\n"
+"Last-Translator: Oleg Broytman <phd@phdru.name>\n"
+"Language-Team: None yet\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8-bit\n"
+"Generated-By: pygettext.py 1.5\n"
+
+msgid "books"
+msgstr "книг"
#! /usr/bin/env python
-# coding: utf-8
import argparse
from m_lib.defenc import default_encoding
from m_librarian.search import search_authors, search_books, \
search_extensions, search_genres, search_languages
+import m_librarian.translations
def _search_authors(args):
(author.surname, author.name, author.misc_name))
full_name = u' '.join(full_name)
print full_name.encode(default_encoding), \
- u"(книг: %d)".encode(default_encoding) % author.count
+ (u"(%s: %d)" % (_('books'), author.count)).encode(default_encoding)
if __name__ == '__main__':