Hi juh,

> But when I run Sphinx twice with the same source I get different uuids.

Perhaps, it seems that `_build/gettext/.doctree/` was recreated. When a
doctree files holding uuid is deleted, a different uuid is given.

---

Let's explain how uuid is used in Sphinx `make gettext`.

Sphinx converts the input document into intermediate data called node, and
keeps them in the doctree file. If you enable the `gettext_uuid` option,
uuid is given to each node in the reading phase of` make gettext` and
recorded in the doctree file. In the build phase of `make gettext`, Sphinx
writes the uuid of each node as comments in each msgid of the pot file.

When a new node is added at the next `make gettext` execution, Sphinx
calculates the Levenshtein distance between all the nodes in order to check
whether a node having a sentence similar to that node is in doctree. Then,
Sphinx considers a node with the highest similarity by Levenshtein distance
and a similarity of 65% or more as "partially modified sentence" and gives
the uuid of the node which was saved. And Sphinx writes the uuid of each
node as a comment in each msgid of the pot file.

By the way, it is very costly to calculate Levenshtein distance between all
nodes. You can speed up by installing python-levenshtein, but still it
takes time to process.
As a matter of fact, when translating po files, I often use tools and
services that provide translation memory functions such as OmegaT and
transifex. Therefore, I think that the necessity of fuzzy matching by
Sphinx `gettext_uuid` is not high.


On Mon, Jun 11, 2018 at 6:45 AM Jan Ulrich Hasecke <
[email protected]> wrote:

> The docs about gettext:uuid says:
>
> """
> If true, Sphinx generates uuid information for version tracking in
> message catalogs. It is used for:
>
>     - Add uid line for each msgids in .pot files.
>     - Calculate similarity between new msgids and previously saved old
>       msgids. This calculation takes a long time.
> """
>
>
> http://www.sphinx-doc.org/en/stable/config.html?highlight=gettext_uuid#confval-gettext_uuid
>
> I thought that Sphinx would generate a hash from the msgid, so that a
> change of the hash would indicate a change in the message.
>
> But when I run Sphinx twice with the same source I get different uuids.
>
> In my memory this uuid always was some kind of random number so the text
> in the docs was surprising.
>
> How can I use this uuid for version tracking?
>
> juh
>
> --
> Das ZEN von Pandoc
> Bücher und E-Books einfach und professionell produzieren
> http://www.amazon.de/Das-ZEN-von-Pandoc-professionell/dp/1505218799/
> Paperback (232 Seiten) und E-Book
>
> --
> You received this message because you are subscribed to the Google Groups
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sphinx-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to