Skip to content

Commit 22d16d2

Browse files
10110111gzotti
andauthored
SUG: Document sky culture converter (#4224)
SUG: Document sky culture converter --------- Co-authored-by: Georg Zotti <Georg.Zotti@univie.ac.at>
1 parent 93c8e9d commit 22d16d2

2 files changed

Lines changed: 72 additions & 4 deletions

File tree

guide/ch_skycultures.tex

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -678,16 +678,20 @@ \subsubsection{Planet Names}
678678
For these, the JSON key is formed from \jtag{NAME }, a space and the English name of the planet.
679679
The value vector provides dicts which include
680680
\begin{description}
681-
\item[\jtag{english}] (the translatable name),
681+
\item[\jtag{english}] (the translated name),
682682
\item[\jtag{native}] (optional) native spelling, may be in native glyphs when supported by UTF8,
683-
\item[\jtag{transliteration}] (optional) Native name in European glyphs, if needed.
683+
\item[\jtag{pronounce}] (optional) Native name in European glyphs, if needed. For Chinese, expect Pinyin here.
684+
%\item[\jtag{transliteration}] (optional) Scientific transliteration of the native name in European glyphs, if needed. For Tibetan, this is for Wylie.
685+
%\item[\jtag{IPA}] (optional) International Phonetic Alphabet.
684686
\item[\jtag{translators\_comments}] (optional) comments to be shown to translators on Transifex,
685687
\item[\jtag{references}] (optional) the sources for these names where applicable.
686688
\end{description}
687689

690+
Currently, if two \jtag{english} strings are given, the first is used as screen label. This may change as the features further evolve.
691+
688692
In earlier versions it was recommended to combine the native name with an English translation.
689693
In the new format here we should keep them separate, and the actual screen label can be combined from available components on the fly.\newFeature{25.2}
690-
However, for languages with non-European glyphs please include a transliteration as pronounciation aid to the \jtag{english} string.
694+
However, for languages with non-European glyphs please add a widely used transliteration as pronounciation aid in the \jtag{pronounce} tag.
691695
% TODO: Shall we add an optional \jtag{transliteration} tag which could itself again be translatable?
692696

693697

@@ -712,8 +716,66 @@ \subsection{Deep-Sky Objects Names}
712716
\section{The Skyculture Converter}
713717
\label{ch:SkyCultures:converter}
714718

715-
TBD
719+
Many sky cultures have been created and maintained outside of Stellarium. They follow the old format, which is no longer supported since Stellarium version 25.1.
720+
To ease the transition we have developed a converter tool. It is a console application that takes a path to the old-format sky culture directory,
721+
and a path where to put the converted sky culture.
722+
723+
The converter is installed together with the program, but there is no menu entry for it.
724+
On Windows, press the Windows key and type \texttt{cmd} to startup the command console.
725+
726+
Let us assume you have created a skyculture following the format used until version 24.4 and described in previous editions of this Guide,
727+
and that this skyculture \texttt{mine} resides in the default user data directory on Windows (see \ref{sec:Directories} for other platforms).
728+
First we rename the skyculture to indicate that it is old and outdated. Then we must call the converter in its absolute path name.
729+
730+
731+
Example command to run it:
732+
733+
\begin{commands}[\footnotesize]
734+
cd c:\Users\<ME>\AppData\Roaming\skycultures
735+
move mine mine.old
736+
"c:\Program Files\stellarium\skyculture-converter" mine.old mine
737+
\end{commands}
738+
739+
While the converter tries hard to convert the description text from HTML to Markdown adding some sections from other parts of the sky culture, the conversion may not be ideal.
740+
Formerly the description was completely free in structure, while now there are some requirements on it, so the text may need some editing to conform.
741+
742+
If you have \program{gettext} translation files (the ones whose names are in the form \file{locale-name.po}) for the names of stars, constellations etc.,
743+
you can pass the path to the directory that contains them as an optional third positional argument to the converter.
744+
745+
Additionally, there are some options that you can use to control the conversion:
746+
747+
\begin{description}
748+
\item[\texttt{-\/-footnotes-to-references}] Convert footnotes in a particular form to references. Such footnotes are expected to be in the form of
749+
\begin{htmlbit}
750+
<p id="footnote-9">This is a footnote</p>
751+
\end{htmlbit}
752+
while the references to them are expected to be in the form of
753+
\begin{htmlbit}
754+
<sup><a href="#footnote-9">[9]</a></sup>
755+
\end{htmlbit}
756+
\item[\texttt{-\/-untrans-names-are-native}] Put the names that in \file{star\_names.fab} or in
757+
\file{dso\_names.fab} are denoted without an underscore into the \jtag{native} section of the name,
758+
rather than \jtag{english}. For example, with this option \texttt{32349|("Fētūsolonuʻu")} would be
759+
used for the \jtag{native} name, while \texttt{32349|\_("Gliding Star")} would be used for the \jtag{english} tag.
760+
\item[\texttt{-\/-native-locale LOCALE}] In addition to files \file{star\_names.fab} or \file{dso\_names.fab},
761+
some sky cultures have localized versions of them, like e.g. \file{star\_names.zh\_CN.fab},
762+
that were never actually used but do contain useful information. If you pass the locale (\file{zh\_CN} in this example)
763+
as the \texttt{LOCALE} parameter, these names will be read and put into the \jtag{native} section of the corresponding JSON entry.
764+
Note that the order of stars/DSOs in the normal and localized files must be the same, otherwise there's no way to match the names.
765+
\item[\texttt{-\/-translated-md}] To check the look of the translated description texts you can use this option.
766+
The output directory will contain, in addition to \file{description.md}, files named like
767+
\file{description.es\_419.DO\_NOT\_COMMIT.md}, with the ``DO NOT COMMIT'' part reminding you that they are not a part of the sky culture.
768+
\end{description}
769+
770+
\noindent After the run, read the notes and warnings, and adjust your text accordingly.
771+
Make especially sure to prepare and adjust your old \file{description.en.utf8} for successful conversion.
772+
For example, it must start with an HTML header of level \texttt{<h1>} (the only such header in this file!) which is expected
773+
to match the skyculture \texttt{name} given in the old \file{info.ini}. If in doubt, the latter will be used in the new files.
716774
775+
Generally, clean HTML should be converted successfully.
776+
Given the wide variety of writing styles, not every conversion may however work flawlessly,
777+
and you may have to adjust the result, also in light of the new features.
778+
To protect any changes you may have added after conversion, running the converter again needs a new target directory.
717779
718780
719781
\section{Publish Your Work}

guide/structure.tex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@
262262
\lstnewenvironment{jsonfile}[1][\small]{\lstset{inputencoding=utf8,language=json,basicstyle=\ttfamily#1,showstringspaces=false,%
263263
backgroundcolor=\color{black!5},frame=shadowbox,rulecolor=\color{blue},framerule=1pt}%
264264
}{}%
265+
% Shows an HTML one-liner
266+
\lstnewenvironment{htmlbit}[1][\small]{\lstset{inputencoding=utf8,language=html,basicstyle=\ttfamily#1,showstringspaces=false,%
267+
backgroundcolor=\color{black!5}}%
268+
}{}%
265269
\lstnewenvironment{script}{\lstset{language=JavaScript,
266270
backgroundcolor=\color{black!5},%
267271
frame=leftline,%
@@ -336,6 +340,8 @@
336340
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
337341
\usepackage{newunicodechar} % Must be loaded after [utf8]inputenc
338342
\newunicodechar{°}{\degree}
343+
% Taken from https://tex.stackexchange.com/a/424538
344+
\newunicodechar{ʻ}{\raisebox{\dimexpr\fontcharht\font`A-\height}{\scalebox{0.8}{`}}}
339345
% It seems Ubuntu on Windows10 has a bit outdated utf8 inputenc? https://tex.stackexchange.com/questions/13067/utf8x-vs-utf8-inputenc
340346
% But all is OK in TeXLive2017.
341347
%\newunicodechar{ē}{\=e}

0 commit comments

Comments
 (0)