Skip to content

Commit

Permalink
Close #6781: gettext Add confvals to customize headers of POT file
Browse files Browse the repository at this point in the history
* gettext_last_translator
* gettext_language_team
  • Loading branch information
tk0miya committed Dec 14, 2019
1 parent 24908e0 commit fa25d53
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Features added
authentication information when doing ``linkcheck`` builds
* #6872: linkcheck: Handles HTTP 308 Permanent Redirect
* #6613: html: Wrap section number in span tag
* #6781: gettext: Add :confval:`gettext_last_translator' and
:confval:`gettext_language_team` to customize headers of POT file

Bugs fixed
----------
Expand Down
4 changes: 4 additions & 0 deletions sphinx/builders/gettext.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ def finish(self) -> None:
'version': self.config.version,
'copyright': self.config.copyright,
'project': self.config.project,
'last_translator': self.config.gettext_last_translator,
'language_team': self.config.gettext_language_team,
'ctime': datetime.fromtimestamp(timestamp, ltz).strftime('%Y-%m-%d %H:%M%z'),
'display_location': self.config.gettext_location,
'display_uuid': self.config.gettext_uuid,
Expand Down Expand Up @@ -311,6 +313,8 @@ def setup(app: Sphinx) -> Dict[str, Any]:
app.add_config_value('gettext_uuid', False, 'gettext')
app.add_config_value('gettext_auto_build', True, 'env')
app.add_config_value('gettext_additional_targets', [], 'env')
app.add_config_value('gettext_last_translator', 'FULL NAME <EMAIL@ADDRESS>', 'gettext')
app.add_config_value('gettext_language_team', 'LANGUAGE <LL@li.org>', 'gettext')

return {
'version': 'builtin',
Expand Down
4 changes: 2 additions & 2 deletions sphinx/templates/gettext/message.pot_t
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: {{ ctime|e }}\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"
"Last-Translator: {{ last_translator|e }}\n"
"Language-Team: {{ language_team|e }}\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down

0 comments on commit fa25d53

Please sign in to comment.