Weblog by shuuji3

Happy Software Engineering

Translating psycopg3 documentation

This post was actually written on March 25, 2023, but completely forgot to publish. During that period, I wrote TakahΔ“ articles and translated psycopg3 documentation into Japanese at the same time.

I continue translating psycopg3 into Japanese one by one. It’s fun to learn unknown PostgreSQL features and how psycopg3 is handling connections and queries under the hood for database libraries in Python!

ReStructuredText syntax

By translating documentation written in ReStructuredText syntax, I become much familiar with this syntax and finally come to get confident with them. Surely I read in a lot of various Python documentations and translated huge amount of Django translation text on Transifex. But somehow I couldn’t fully understand a few syntaxes.

That lack of confidence has almost disappeared and I can see the power and flexibility of this syntax now.

Contributing to sphinx-socialgraph

I noticed that psycopg documentation doesn’t have any OpenGraph Protocol meta data in <head />. And after a quick search, I found sphinx-socialgraph just for this addition.

Unfortunately, its generated card image only support default embedded Roboto Flex font file at that time, so any CJK language characters cannot be rendered other than many Tofu ⬜⬜⬜ !

There was an existing issue too: Bundled Roboto font does not support Japanese (social images) Β· Issue #108 Β· wpilibsuite/sphinxext-opengraph

As the issue explains, the card image is rendered with matplotlib but its custom font loading feature was still “TODO” state. As I had some experience with matplotlib for a while ago, I somehow could solve the problem to allow the library to load any detectable font file from matplotlib.

The PR is waiting for the review and hopefully to be merged soon. (later merged on Oct 28, 2023 πŸŽ‰)

Before

image

After

image

Translation rules

While translating docs, I built up the following rules to be consistent:

  • place spaces between Japanese and ASCII characters.
  • put a space in between multiple Katakana words
    • But “server-side” and “client-side” are concatenated with “-” and they should be treated as one word, so they are translated to “ァーバーァむド” and “γ‚―γƒ©γ‚€γ‚’γƒ³γƒˆγ‚΅γ‚€γƒ‰” accordingly (not “ァーバー ァむド”)
  • behave = ε‹•δ½œγ™γ‚‹ (not ζŒ―γ‚‹θˆžγ†)
    • I felt this may help map one word and concept in mind more connected due to the higher density of Kanji characters.
  • advanced = η™Ίε±•ηš„γͺ
  • open/close = γ‚ͺープン/γ‚―γƒ­γƒΌγ‚Ί (I though 開く/ι–‰γ˜γ‚‹ is acceptable but γ‚ͺープン is more natural like in the verb “γ‚ͺープンする”
  • connection = コネクション、コネクションする (not ζŽ₯碚 or ζŽ₯ηΆšγ™γ‚‹)
    • both are understandable but the conversion cost of ζŽ₯碚 -> コネクション in brain has a bit more resistance.
  • statement = γ‚Ήγƒ†γƒΌγƒˆγƒ‘γƒ³γƒˆ, not ζ–‡
    • similarly, γ‚Ήγƒ†γƒΌγƒˆγƒ‘γƒ³γƒˆ can be mapped to statement more directly, and one might question like “Which ζ–‡ means here?”
  • use = 使用 (not εˆ©η”¨)

Comments