From 4ac0def80be4a2a16c5c0a17fafbc90c2587fdbe Mon Sep 17 00:00:00 2001 From: Mauro Scomparin Date: Wed, 11 Jul 2018 01:26:15 +0200 Subject: [PATCH] looks like it works like this --- money/money.py | 8 ++- money/translations/it/LC_MESSAGES/money.mo | Bin 0 -> 925 bytes money/translations/it/LC_MESSAGES/money.po | 66 +++++++++++++++++++++ {po => money/translations}/money.pot | 4 -- setup.py | 28 +++++---- 5 files changed, 90 insertions(+), 16 deletions(-) create mode 100644 money/translations/it/LC_MESSAGES/money.mo create mode 100644 money/translations/it/LC_MESSAGES/money.po rename {po => money/translations}/money.pot (95%) diff --git a/money/money.py b/money/money.py index 472d29c..05f9974 100755 --- a/money/money.py +++ b/money/money.py @@ -2,9 +2,15 @@ from time import localtime, gmtime, strftime, strptime from os.path import expanduser, join, exists, abspath from pprint import pprint from decimal import * +from pkg_resources import resource_filename import json + import gettext -_ = gettext.gettext + +loc_dir = resource_filename('money', 'translations') +t = gettext.translation('money', localedir = loc_dir, fallback=True) +_ = t.gettext +t.install() DATA_FILE_NAME = 'dataFile' LAST_MOVEMENT_NUMBER = 'latestMovementsNumber' diff --git a/money/translations/it/LC_MESSAGES/money.mo b/money/translations/it/LC_MESSAGES/money.mo new file mode 100644 index 0000000000000000000000000000000000000000..a8dacac2f82cdf2da4a0b4f4087a943df5c78535 GIT binary patch literal 925 zcmZva&2H2%5XTLauK*HMT#z`J8wk84%b``;MX03}mAYcJS~wz^-Px>BVn?=9TD}g5 z7vNA{feR-dh$rA7_)j)agc$AQXU|UNZ_nh%>dLWzU4h?(e}Z3w|Ae!pr-Zl)W?%wt zfh*t;yabNB{R{9q_EYc-cnF>a-+`;(N093tgZ%#2?*DJ#9R3~7c{lJf>)Zo5Zw+Lf zO%Olv1P|8P2hV{T208Bw2nlf-j%8~czu2u=gLTit`P`S`Y}^;N z3vkvEdKw#D$^%_Cl*_m8#Y{&n=cc5bmn3Esrry-iI4c&e@uEaDM5M~f9Z*F!hFn

UZR*Cedn&k$10X8r9xRJtrR^lcTVuBboKmUY3lh zc0Q_MD9lW4HAPSpm&<@!wR==l+LS%4lhMMU)!S51*r+?Dwlh>y3zJeIF}|S z!@c3o$<=VFWZT(@wy6oakjqGi@qS%uV>jenC}9iaB|;gBH$=Epoa3 z5|u|~<8`Taov+YnTesUV=x@m7a&X(qTLYQh*+{tA&Xd%U$Gx014_RWyrk%9zCjADD vA>q6hO&LvPxIfn+;f(+(OV)*+a`L($Z(6BoY#>`mX* literal 0 HcmV?d00001 diff --git a/money/translations/it/LC_MESSAGES/money.po b/money/translations/it/LC_MESSAGES/money.po new file mode 100644 index 0000000..053e348 --- /dev/null +++ b/money/translations/it/LC_MESSAGES/money.po @@ -0,0 +1,66 @@ +# Translations for money template file. +# Copyright (C) 2018 Mauro Scomparin +# This file is distributed under the same license as the money package. +# Mauro Scomparin , 2018. +# +msgid "" +msgstr "" +"Project-Id-Version: money 1.0.1\n" +"Report-Msgid-Bugs-To: scompo@gmail.com\n" +"POT-Creation-Date: 2018-07-10 23:10+0200\n" +"PO-Revision-Date: 2018-07-10 23:17+0200\n" +"Last-Translator: \n" +"Language-Team: Italian\n" +"Language: it\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" + +#: money/money.py:14 +msgid "type" +msgstr "tipo" + +#: money/money.py:15 +msgid "value" +msgstr "valore" + +#: money/money.py:16 +msgid "date" +msgstr "data" + +#: money/money.py:17 +msgid "hour" +msgstr "ora" + +#: money/money.py:18 +msgid "description" +msgstr "descrizione" + +#: money/money.py:24 +msgid "today" +msgstr "oggi" + +#: money/money.py:25 +msgid "now" +msgstr "adesso" + +#: money/money.py:97 +msgid "data file:" +msgstr "file dati:" + +#: money/money.py:196 +msgid "latest {} movements:" +msgstr "ultimi {} movimenti:" + +#: money/money.py:216 +msgid "actual value: {}" +msgstr "valore attuale: {}" + +#: money/money.py:217 +msgid "total incomes: {}" +msgstr "incassi totali: {}" + +#: money/money.py:218 +msgid "total expenses: {}" +msgstr "spese totali: {}" diff --git a/po/money.pot b/money/translations/money.pot similarity index 95% rename from po/money.pot rename to money/translations/money.pot index a17d549..dfab6f2 100644 --- a/po/money.pot +++ b/money/translations/money.pot @@ -64,7 +64,3 @@ msgstr "" #: money/money.py:218 msgid "total expenses: {}" msgstr "" - -#: setup.py:13 -msgid "Money handling program" -msgstr "" diff --git a/setup.py b/setup.py index d935b4d..25f327d 100644 --- a/setup.py +++ b/setup.py @@ -4,21 +4,27 @@ from os import path here = path.abspath(path.dirname(__file__)) -with open(path.join(here, 'README.rst'), encoding = 'utf-8') as f: +with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup( - name = 'money', - version = '1.0.1', - description = _('Money handling program'), - long_description = long_description, - url = 'http://code.scompo.it:3000/scompo/money', - author = 'Mauro Scomparin', - author_email = 'scompo@gmail.com', - license = 'BSD', - packages=find_packages(exclude=['contrib', 'docs', 'tests', 'utils', 'scripts']), + name='money', + version='1.0.1', + description='Money handling program', + long_description=long_description, + url='http://code.scompo.it:3000/scompo/money', + author='Mauro Scomparin', + author_email='scompo@gmail.com', + license='BSD', + packages=find_packages( + exclude=['contrib', 'docs', 'tests', 'utils', 'scripts']), + package_data={ + 'money': [ + 'translations/*/LC_MESSAGES/money.mo' + ], + }, entry_points={ - 'console_scripts' : [ + 'console_scripts': [ 'money-insert=money.money:read_new_movement', 'money-latest=money.money:latest_movements', ], -- 2.25.1