Skip to content

Commit

Permalink
Added translation support for Javascript callout on build summary page.
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Boos committed Jun 13, 2010
1 parent 877c998 commit d5649eb
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ HudsonTrac.egg-info
*.bak
*.patch
*.mo
HudsonTrac/htdocs/hudsontrac
2 changes: 2 additions & 0 deletions HudsonTrac/HudsonTracPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ def process_request(self, req):
builds = self._extract_builds(self._get_info(start, stop))
data = {'builds': list(builds)}
add_script(req, 'HudsonTrac/hudsontrac.js')
if req.locale is not None:
add_script(req, 'HudsonTrac/hudsontrac/%s.js' % req.locale)
add_stylesheet(req, 'HudsonTrac/hudsontrac.css')
return 'hudson-build.html', data, None

Expand Down
4 changes: 2 additions & 2 deletions HudsonTrac/htdocs/hudsontrac.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jQuery(document).ready(function($) {
top: parseInt(event.pageY) - 16 + "px"})
.append($("<p>").text(build.message))
.append($("<dl>")
.append($("<dt>").text("Name:"))
.append($("<dt>").text(_("Name:")))
.append($("<dd>").text(build.name))
.append($("<dt>").text("Author:"))
.append($("<dt>").text(_("Author:")))
.append($("<dd>").text(build.author))
);
},
Expand Down
31 changes: 31 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
tag_build = dev
tag_svn_revision = true

# Babel: Python and template translations

[extract_messages]
add_comments = TRANSLATOR:
msgid_bugs_address = cboos@neuf.fr
Expand All @@ -22,3 +24,32 @@ domain = hudsontrac
input_file = HudsonTrac/locale/messages.pot
output_dir = HudsonTrac/locale
domain = hudsontrac

# Babel: Javascript translations

[extract_messages_js]
add_comments = TRANSLATOR:
copyright_holder = Christian Boos
msgid_bugs_address = cboos@neuf.fr
output_file = HudsonTrac/locale/messages-js.pot
keywords = _ ngettext:1,2 N_
mapping_file = messages-js.cfg

[init_catalog_js]
domain = hudsontrac-js
input_file = HudsonTrac/locale/messages-js.pot
output_dir = HudsonTrac/locale

[compile_catalog_js]
domain = hudsontrac-js
directory = HudsonTrac/locale

[update_catalog_js]
domain = hudsontrac-js
input_file = HudsonTrac/locale/messages-js.pot
output_dir = HudsonTrac/locale

[generate_messages_js]
domain = hudsontrac-js
input_dir = HudsonTrac/locale
output_dir = HudsonTrac/htdocs/hudsontrac
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

extra = {}

from trac.util.dist import get_l10n_cmdclass
cmdclass = get_l10n_cmdclass()
from trac.util.dist import get_l10n_js_cmdclass
cmdclass = get_l10n_js_cmdclass()
if cmdclass:
extra['cmdclass'] = cmdclass
extra['message_extractors'] = {
Expand Down

0 comments on commit d5649eb

Please sign in to comment.