Explorar el Código

fix: make the graph translatable

tags/v0.8.0
Jérôme Deuchnord hace 4 años
padre
commit
cd121969e6
No se encontró ninguna clave conocida en la base de datos para esta firma ID de clave GPG: BF7828A4E3722466
Se han modificado 4 ficheros con 55 adiciones y 29 borrados
  1. +11
    -11
      kosmorrolib/assets/pdf/kosmorro.sty
  2. +12
    -0
      kosmorrolib/assets/pdf/template.tex
  3. +16
    -6
      kosmorrolib/dumper.py
  4. +16
    -12
      kosmorrolib/locales/messages.pot

+ 11
- 11
kosmorrolib/assets/pdf/kosmorro.sty Ver fichero

@@ -51,20 +51,20 @@
\sffamily\footnotesize
\arabic{hour}\stepcounter{hour}\stepcounter{hour}
}
\put(49,-3.5){\sffamily\footnotesize hours}
\put(49,-3.5){\sffamily\footnotesize \hourslabel}

% Graduation

\put(50,-0.5){\sffamily\footnotesize Pluto}
\put(50,1.5){\sffamily\footnotesize Neptune}
\put(50,3.5){\sffamily\footnotesize Uranus}
\put(50,5.5){\sffamily\footnotesize Saturn}
\put(50,7.5){\sffamily\footnotesize Jupiter}
\put(50,9.5){\sffamily\footnotesize Mars}
\put(50,11.5){\sffamily\footnotesize Venus}
\put(50,13.5){\sffamily\footnotesize Mercury}
\put(50,15.5){\sffamily\footnotesize Moon}
\put(50,17.5){\sffamily\footnotesize Sun}
\put(50,-0.5){\sffamily\footnotesize \Pluto}
\put(50,1.5){\sffamily\footnotesize \Neptune}
\put(50,3.5){\sffamily\footnotesize \Uranus}
\put(50,5.5){\sffamily\footnotesize \Saturn}
\put(50,7.5){\sffamily\footnotesize \Jupiter}
\put(50,9.5){\sffamily\footnotesize \Mars}
\put(50,11.5){\sffamily\footnotesize \Venus}
\put(50,13.5){\sffamily\footnotesize \Mercury}
\put(50,15.5){\sffamily\footnotesize \Moon}
\put(50,17.5){\sffamily\footnotesize \Sun}

\multiput(0,0)(0,2){10}{
\color{gray}\line(1,0){48}


+ 12
- 0
kosmorrolib/assets/pdf/template.tex Ver fichero

@@ -12,6 +12,18 @@
\newcommand{\ephemeridesrisetimetitle}{+++EPHEMERIDES-RISE-TIME+++}
\newcommand{\ephemeridesculminationtimetitle}{+++EPHEMERIDES-CULMINATION-TIME+++}
\newcommand{\ephemeridessettimetitle}{+++EPHEMERIDES-SET-TIME+++}
\newcommand{\hourslabel}{+++GRAPH_LABEL_HOURS+++}

\newcommand{\Pluto}{+++ASTER_PLUTO+++}
\newcommand{\Neptune}{+++ASTER_NEPTUNE+++}
\newcommand{\Uranus}{+++ASTER_URANUS+++}
\newcommand{\Saturn}{+++ASTER_SATURN+++}
\newcommand{\Jupiter}{+++ASTER_JUPITER+++}
\newcommand{\Mars}{+++ASTER_MARS+++}
\newcommand{\Venus}{+++ASTER_VENUS+++}
\newcommand{\Mercury}{+++ASTER_MERCURY+++}
\newcommand{\Moon}{+++ASTER_MOON+++}
\newcommand{\Sun}{+++ASTER_SUN+++}

% Fix Unicode issues
\DeclareUnicodeCharacter{202F}{~}


+ 16
- 6
kosmorrolib/dumper.py Ver fichero

@@ -24,7 +24,7 @@ from pathlib import Path
from tabulate import tabulate
from numpy import int64
from termcolor import colored
from .data import Object, AsterEphemerides, MoonPhase, Event
from .data import ASTERS, Object, AsterEphemerides, MoonPhase, Event
from .i18n import _
from .version import VERSION
from .exceptions import UnavailableFeatureError
@@ -258,6 +258,17 @@ class _LatexDumper(Dumper):
if len(self.events) == 0:
document = self._remove_section(document, 'events')

document = self.add_strings(document, kosmorro_logo_path, moon_phase_graphics)

if self.show_graph:
# The graphephemerides environment beginning tag must end with a percent symbol to ensure
# that no extra space will interfere with the graph.
document = document.replace(r'\begin{ephemerides}', r'\begin{graphephemerides}%')\
.replace(r'\end{ephemerides}', r'\end{graphephemerides}')

return document

def add_strings(self, document, kosmorro_logo_path, moon_phase_graphics) -> str:
document = document \
.replace('+++KOSMORRO-VERSION+++', VERSION) \
.replace('+++KOSMORRO-LOGO+++', kosmorro_logo_path) \
@@ -279,17 +290,16 @@ class _LatexDumper(Dumper):
.replace('+++EPHEMERIDES-CULMINATION-TIME+++', _('Culmination time')) \
.replace('+++EPHEMERIDES-SET-TIME+++', _('Set time')) \
.replace('+++EPHEMERIDES+++', self._make_ephemerides()) \
.replace('+++GRAPH_LABEL_HOURS+++', _('hours')) \
.replace('+++MOON-PHASE-GRAPHICS+++', moon_phase_graphics) \
.replace('+++CURRENT-MOON-PHASE-TITLE+++', _('Moon phase:')) \
.replace('+++CURRENT-MOON-PHASE+++', self.moon_phase.get_phase()) \
.replace('+++SECTION-EVENTS+++', _('Expected events')) \
.replace('+++EVENTS+++', self._make_events())

if self.show_graph:
# The graphephemerides environment beginning tag must end with a percent symbol to ensure
# that no extra space will interfere with the graph.
document = document.replace(r'\begin{ephemerides}', r'\begin{graphephemerides}%')\
.replace(r'\end{ephemerides}', r'\end{graphephemerides}')
for aster in ASTERS:
document = document.replace('+++ASTER_%s+++' % aster.skyfield_name.upper().split(' ')[0],
aster.name)

return document



+ 16
- 12
kosmorrolib/locales/messages.pot Ver fichero

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: kosmorro 0.7.0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2020-05-12 13:42+0200\n"
"POT-Creation-Date: 2020-05-13 13:11+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"
@@ -143,23 +143,23 @@ msgstr ""
msgid "Note: All the hours are given in the UTC{offset} timezone."
msgstr ""

#: kosmorrolib/dumper.py:208 kosmorrolib/dumper.py:277
#: kosmorrolib/dumper.py:208 kosmorrolib/dumper.py:288
msgid "Object"
msgstr ""

#: kosmorrolib/dumper.py:209 kosmorrolib/dumper.py:278
#: kosmorrolib/dumper.py:209 kosmorrolib/dumper.py:289
msgid "Rise time"
msgstr ""

#: kosmorrolib/dumper.py:210 kosmorrolib/dumper.py:279
#: kosmorrolib/dumper.py:210 kosmorrolib/dumper.py:290
msgid "Culmination time"
msgstr ""

#: kosmorrolib/dumper.py:211 kosmorrolib/dumper.py:280
#: kosmorrolib/dumper.py:211 kosmorrolib/dumper.py:291
msgid "Set time"
msgstr ""

#: kosmorrolib/dumper.py:225 kosmorrolib/dumper.py:283
#: kosmorrolib/dumper.py:225 kosmorrolib/dumper.py:295
msgid "Moon phase:"
msgstr ""

@@ -167,32 +167,36 @@ msgstr ""
msgid "{next_moon_phase} on {next_moon_phase_date} at {next_moon_phase_time}"
msgstr ""

#: kosmorrolib/dumper.py:264
#: kosmorrolib/dumper.py:275
msgid "A Summary of your Sky"
msgstr ""

#: kosmorrolib/dumper.py:268
#: kosmorrolib/dumper.py:279
msgid ""
"This document summarizes the ephemerides and the events of {date}. It "
"aims to help you to prepare your observation session. All the hours are "
"given in {timezone}."
msgstr ""

#: kosmorrolib/dumper.py:274
#: kosmorrolib/dumper.py:285
msgid ""
"Don't forget to check the weather forecast before you go out with your "
"equipment."
msgstr ""

#: kosmorrolib/dumper.py:276
#: kosmorrolib/dumper.py:287
msgid "Ephemerides of the day"
msgstr ""

#: kosmorrolib/dumper.py:285
#: kosmorrolib/dumper.py:293
msgid "hours"
msgstr ""

#: kosmorrolib/dumper.py:297
msgid "Expected events"
msgstr ""

#: kosmorrolib/dumper.py:405
#: kosmorrolib/dumper.py:415
msgid ""
"Building PDFs was not possible, because some dependencies are not "
"installed.\n"


Cargando…
Cancelar
Guardar