Skip to content

Commit

Permalink
Add Japanese translation
Browse files Browse the repository at this point in the history
We rely on python sphinx-intl to handle the translation, using standard .pot /
.po translation files.

The following steps are required each time the translation needs to be updated:

make gettext
sphinx-intl update -p _build/gettext -l ja

Translators can then work on the various .po files generated (or updated) in
docs/locale/ja/LC_MESSAGES/, and the translated documentation can be built
using:

make -e SPHINXOPTS="-D language='ja'" html

Once everything is ok, simply commit the modified files in docs/locale.  Note
that we don't track the .pot files, generated in docs/_build/gettext/.

Pull request #125, fixes #123

Backpatch-through: 14
Reviewed-by: Michael Paquier
  • Loading branch information
rjuju committed Mar 15, 2023
1 parent 01c2de6 commit c0a9db0
Show file tree
Hide file tree
Showing 16 changed files with 1,308 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ regression.*

# Documentation artifacts
docs/_build
docs/locale/**/*.mo
34 changes: 32 additions & 2 deletions docs/README
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Note that while markdown is more readable as raw text, it's a way simpler
syntax that lacks a lot of features that reStructuredText offers. Relying on
sphinx gives us an opportunity to later write parts of the documentation in
reStructuredText if needed, but also offers other appealing features like
multilingual documentation that we may reintroduce in a near future.
multilingual documentation.

Readthedocs is the expected target, so use its theme and follow its
recommendation about pinning various requirement versions.
Expand All @@ -35,7 +35,34 @@ update the docs/requirements.in and generate the target docs/requirements.txt
using pip-compile. See the link about this tool below for more details on how
to use it.

As a first step, simply duplicate the README.md for the documentation.
Translation
-----------

Note that each translator has to follow all those steps whenever the
translation needs to be updated. Note also that those commands assume that the
current working directory is docs/.

- Bootstrapping the translation (the .pot files) is simply done using

make gettext

This will generate the various .pot file in _build/gettext.

- The per-language translation files (the .po files) can then be generated. We
currently only support Japanese, the rest of the commands will assume a
single Japanese translation. Those files can be generated using:

sphinx-intl update -p _build/gettext -l ja

The files are generated (or updated) in the docs/locale/ja/LC_MESSAGES/.

- You can then translate the .po file with any editor (poedit, vim...)

- The translated documentation can be built using:

make -e SPHINXOPTS="-D language='ja'" html

- If everything is ok, you can commit the modifications in the .po files.

References
----------
Expand All @@ -47,3 +74,6 @@ References if you're interested in the various design choices:
- myst parser: https://myst-parser.readthedocs.io
- pip-tools / pip-compile: https://pip-tools.readthedocs.io
- RTD sphinx theme: https://sphinx-rtd-theme.readthedocs.io
- Internationalization:
https://www.sphinx-doc.org/en/master/usage/advanced/intl.html
https://docs.readthedocs.io/en/stable/localization.html#projects-with-multiple-translations-sphinx-only
8 changes: 8 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,11 @@

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']

# Internationalization
# https://www.sphinx-doc.org/en/master/usage/advanced/intl.html
# https://docs.readthedocs.io/en/stable/guides/manage-translations-sphinx.html

locale_dirs = ['locale/'] # path is example but recommended.
gettext_compact = False # optional.
gettext_uuid = True # optional.
46 changes: 46 additions & 0 deletions docs/locale/ja/LC_MESSAGES/description.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# LANGUAGE message translation file for pg_hint_plan description.
# Copyright (C) 2012-2023, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
# This file is distributed under the same license as the pg_hint_plan
# package.
# Julien Rouhaud <[email protected]>, 2023.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pg_hint_plan \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-15 10:17+0800\n"
"PO-Revision-Date: 2023-03-15 10:17+0800\n"
"Last-Translator: Julien Rouhaud <[email protected]>\n"
"Language: ja\n"
"Language-Team: ja <[email protected]>\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.12.1\n"

#: ../../description.md:1 d778eeada5834c5ba0befb83d487c605
msgid "Description"
msgstr ""

#: ../../description.md:3 94fd67ddaeb940eeb87c2b42af7726d6
msgid "Basic Usage"
msgstr ""

#: ../../description.md:5 41a7d24770704dcf9909c935a9dc77c1
msgid ""
"`pg_hint_plan` reads hinting phrases in a comment of special form given "
"with the target SQL statement. The special form is beginning by the "
"character sequence `\"/\\*+\"` and ends with `\"\\*/\"`. Hint phrases are"
" consists of hint name and following parameters enclosed by parentheses "
"and delimited by spaces. Each hinting phrases can be delimited by new "
"lines for readability."
msgstr ""

#: ../../description.md:11 fc66d4b914bd4029b8d8e2d924cc0570
msgid ""
"In the example below, hash join is selected as the joining method and "
"scanning `pgbench_accounts` by sequential scan method."
msgstr ""

78 changes: 78 additions & 0 deletions docs/locale/ja/LC_MESSAGES/errors.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# LANGUAGE message translation file for pg_hint_plan errors.
# Copyright (C) 2012-2023, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
# This file is distributed under the same license as the pg_hint_plan
# package.
# Julien Rouhaud <[email protected]>, 2023.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pg_hint_plan \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-15 10:17+0800\n"
"PO-Revision-Date: 2023-03-15 10:17+0800\n"
"Last-Translator: Julien Rouhaud <[email protected]>\n"
"Language: ja\n"
"Language-Team: ja <[email protected]>\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.12.1\n"

#: ../../errors.md:1 6c31d2df5fce47f0b201ef53f6ca189f
msgid "Errors"
msgstr ""

#: ../../errors.md:3 5621dbeef7da410aa4c18b52d3dca574
msgid ""
"`pg_hint_plan` stops parsing on any error and uses hints already parsed "
"on the most cases. Following are the typical errors."
msgstr ""

#: ../../errors.md:6 c43b0ee5dd9b4319b01ad3908d99cc54
msgid "Syntax errors"
msgstr ""

#: ../../errors.md:8 944ac767f818475a91ea7f02b322969b
msgid ""
"Any syntactical errors or wrong hint names are reported as a syntax "
"error. These errors are reported in the server log with the message level"
" specified by `pg_hint_plan.message_level` if `pg_hint_plan.debug_print` "
"is on and above."
msgstr ""

#: ../../errors.md:12 aa309a17c63b4ddf8d7dbc21d758b45c
msgid "Object misspecifications"
msgstr ""

#: ../../errors.md:14 f822578a9261442bab3c256c6d5e4044
msgid ""
"Object misspecifications result in silent ignorance of the hints. This "
"kind of error is reported as \"not used hints\" in the server log by the "
"same condition as syntax errors."
msgstr ""

#: ../../errors.md:18 46d66a7d8cec4958a54ae38dad40cfb1
msgid "Redundant or conflicting hints"
msgstr ""

#: ../../errors.md:20 b76b815c013f44e4a9d51467534a8244
msgid ""
"The last hint will be active when redundant hints or hints conflicting "
"with each other. This kind of error is reported as \"duplication hints\" "
"in the server log by the same condition to syntax errors."
msgstr ""

#: ../../errors.md:24 ef0c0435653948ab859b17cdffc371e1
msgid "Nested comments"
msgstr ""

#: ../../errors.md:26 759e99bc8994469eaaa6e44fc99cc0df
msgid ""
"Hint comment cannot include another block comment within. If "
"`pg_hint_plan` finds it, differently from other erros, it stops parsing "
"and abandans all hints already parsed. This kind of error is reported in "
"the same manner as other errors."
msgstr ""

82 changes: 82 additions & 0 deletions docs/locale/ja/LC_MESSAGES/functional_limitations.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# LANGUAGE message translation file for pg_hint_plan functional limitations.
# Copyright (C) 2012-2023, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
# This file is distributed under the same license as the pg_hint_plan
# package.
# Julien Rouhaud <[email protected]>, 2023.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pg_hint_plan \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-15 10:17+0800\n"
"PO-Revision-Date: 2023-03-15 10:17+0800\n"
"Last-Translator: Julien Rouhaud <[email protected]>\n"
"Language: ja\n"
"Language-Team: ja <[email protected]>\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.12.1\n"

#: ../../functional_limitations.md:1 5850b23944f943f2a0bd61da45d61a0c
msgid "Functional limitations"
msgstr ""

#: ../../functional_limitations.md:3 f632a7fe3bbf4889af22a0db4d731445
msgid "Influences of some of planner GUC parameters"
msgstr ""

#: ../../functional_limitations.md:5 851e75f6c30743aea40f66a59067b891
msgid ""
"The planner does not try to consider joining order for FROM clause "
"entries more than `from_collapse_limit`. `pg_hint_plan` cannot affect "
"joining order as expected for the case."
msgstr ""

#: ../../functional_limitations.md:9 fcba5b47fa6f47bf8a726b0a0c163e81
msgid "Hints trying to enforce unexecutable plans"
msgstr ""

#: ../../functional_limitations.md:11 3f9c54c5a2bf409596c030e9bc512a2a
msgid ""
"Planner chooses any executable plans when the enforced plan cannot be "
"executed."
msgstr ""

#: ../../functional_limitations.md:13 1dffc4089f2d45e281732fa79ad1a37f
msgid "`FULL OUTER JOIN` to use nested loop"
msgstr ""

#: ../../functional_limitations.md:14 7a2bb169072b489a8189de0091676a20
msgid "To use indexes that does not have columns used in quals"
msgstr ""

#: ../../functional_limitations.md:15 54ec2eac70ab4b808e0f38f226ff4a9b
msgid "To do TID scans for queries without ctid conditions"
msgstr ""

#: ../../functional_limitations.md:17 a1a0c266d0ba4a5683475b8c495656fe
msgid "Queries in ECPG"
msgstr ""

#: ../../functional_limitations.md:19 ecd54f429ced423684828e4431fcd16e
msgid ""
"ECPG removes comments in queries written as embedded SQLs so hints cannot"
" be passed form those queries. The only exception is that `EXECUTE` "
"command passes given string unmodifed. Please consider using the hint "
"table in the case."
msgstr ""

#: ../../functional_limitations.md:23 432ac66ce7634a718a58bf5c747345ab
msgid "Work with `pg_stat_statements`"
msgstr ""

#: ../../functional_limitations.md:25 aa92ff347fef44a8ad45b59addde6fd0
msgid ""
"`pg_stat_statements` generates a query id ignoring comments. As the "
"result, the identical queries with different hints are summarized as the "
"same query."
msgstr ""

Loading

0 comments on commit c0a9db0

Please sign in to comment.